[Release] Console V2 - Tutorial to help new people + make your server sexy
TERMS OF USE: This modification to the TitanMS source may not be included in any repack at all, unless my permission is given.
Currently the only people i give permission to distribute my code in a repack or anyway they want are: Afikbar, Klook and Doyos
I'm trying to stop the amount of new people in this community, so i'll explain best i can
Text on the line after '//' (without the quotes) is a comment, meaning it wont affect the program at all. I have included these to explain what im doing.
1. Open Acceptor.cpp and find:
Code:
printf ("accept\n");
We dont want this line to be effective anymore, but instead of deleting it, we will comment it in case it is needed later on. So replace it with:
Code:
//printf ("accept\n");
Open up Player.cpp and find this block:
Now the line underneath should look like this:
Now underneath this line we want to add a print command like so:
Code:
printf ("%s is offline.\n", this->getName()); //Prints command in console when char logs into game
So 'printf' means its going to send a message to the console (your program)
We want to add a message for when the character goes online also, so we do the same thing, but in a different location.
Scroll down and find:
Code:
void Player::playerConnect(){
Now in this block, a littlebit below, you should be able to find this line:
Code:
Maps::newMap(this);
Underneath it we wish to input a print command:
Code:
printf ("%s is Online.\n", this->getName()); //Prints command in console when char logs into game
Now you can change the text that appears as the server starts, open MaplestoryServer.cpp and find this block:
Now below it, is obviously what appears when our server starts up. Edit this entire block to look the way you want! Here is what I did, and recommend:
Code:
void main(){
Initializing::initializing();
printf("Timers :: ");
Timer::timer = new Timer();
Skills::startTimer();
Maps::startTimer();
printf("Success\n");
printf("Database :: ");
if(MySQL::connectToMySQL())
printf("Success\n");
else{
printf("Epic Fail\n");
exit(1);
}
Server::initialize();
WSADATA wsaData;
int iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
if (iResult != NO_ERROR) printf("Error at WSAStartup()\n");
srand((unsigned char)time(0));
Selector* selector = new Selector();
Acceptor::Acceptor(8484, selector, new PlayerLoginFactory());
for(int i=0; i<5; i++){
Acceptor::Acceptor(8888+i, selector, new PlayerFactory());
}
while(getchar()){}
}
But wait, there is more! For some reason, Klook wanted to make things harder for us and added the second part in another file ^^;
Open up Initializing.cpp and find this block:
Code:
void Initializing::initializing(){
And now edit away! Here is what I have done, it goes in well to suit the above edit:
Code:
void Initializing::initializing(){
printf("Monsters :: ");
initializeMobs();
printf("Success\n");
printf("Items :: ");
initializeItems();
printf("Success\n");
printf("NPCs :: ");
initializeNPCs();
printf("Success\n");
printf("Loot :: ");
initializeDrops();
printf("Success\n");
printf("Equipment :: ");
initializeEquips();
printf("Success\n");
printf("Shops :: ");
initializeShops();
printf("Success\n");
printf("Quests :: ");
initializeQuests();
printf("Success\n");
printf("Skills :: ");
initializeSkills();
printf("Success\n");
printf("Maps :: ");
initializeMaps();
printf("Success\n");
}
Now for another touch up, you can goto Login.cpp and find this line:
Code:
printf("%s logged in.\n", username);
It doesnt look so good anymore, because our server tells us when a player logs in, it can get confusing!
So here is what i changed mine to look like:
Code:
printf("Username: %s.\n", username);
So yeah, just play around with printf
Also if you have a look in players.cpp you might be able to figure out how to make it print when a GM uses a command ^^
Should work on rev 8 and 7.
If you get an error, try reading replies. Afikbar for one posted a fix.
Re: [Release] Better Server Console + Tells when char online/offline
Very nice, ill try it out later. Good work =)
Re: [Release] Better Server Console + Tells when char online/offline
Oh and it looks real nice if you align the ::'s all in one straight vertical. :)
http://img254.imageshack.us/img254/8923/tempwr1.jpg
Re: [Release] Better Server Console + Tells when char online/offline
yea that accept thing is annoying it fills my cmd box with it =P
Re: [Release] Better Server Console + Tells when char online/offline
Sweet :] had to spice up that dull console a bit.
Re: [Release] Better Server Console + Tells when char online/offline
That gives me an idea. Perhaps its possible to alter the !dc command and make it show in the console that "*player name* has been kicked" seems easy enough, right? o_o
Re: [Release] Better Server Console + Tells when char online/offline
That's really easy.
Just add a printf to the !dc command.
Re: [Release] Better Server Console + Tells when char online/offline
Good release. I never thought to change the text. Wish I knew how to make it create a log file now.
Re: [Release] Better Server Console + Tells when char online/offline
Quote:
Originally Posted by
TehSkull
That gives me an idea. Perhaps its possible to alter the !dc command and make it show in the console that "*player name* has been kicked" seems easy enough, right? o_o
I could help you if you wish?
Re: [Release] Better Server Console + Tells when char online/offline
Quote:
Originally Posted by
Cam1596
Good release. I never thought to change the text. Wish I knew how to make it create a log file now.
Accually thats a good idea, i'm not to fluent with c++ (hint why this is my first release), so i dont really know how to go about doing it. Perhaps someone who knows alot about c++ could tutor us on how to output to a file. Would be great. Also if it could record what packets are sent and recieved, could detect hackers too!
Re: [Release] Better Server Console + Tells when char online/offline
It was said before on how to log everything to a .txt file. Think It was deleted though.
Re: [Release] Better Server Console + Tells when char online/offline
looks nice, my custom one has colours though :)
Re: [Release] Better Server Console + Tells when char online/offline
mm,
i dont understand, u said "and if you have krypticals repack, find this chunk of text:"
what im doing if i dont have it....
o.O
Re: [Release] Better Server Console + Tells when char online/offline
Yes, I don't have Kryptical's Repack and when I compiled, gave me a bunch of errors.
Re: [Release] Better Server Console + Tells when char online/offline
Okay okay, i will have to rewrite it, please give me time, and i might add some more features too ^^