[Release] Console V2 - Tutorial to help new people + make your server sexy

Results 1 to 25 of 25
  1. #1
    Account Upgraded | Title Enabled! lukyjay is offline
    MemberRank
    Jul 2006 Join Date
    AustraliaLocation
    745Posts

    Cool [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:
    Code:
    Player::~Player(){
    Now the line underneath should look like this:
    Code:
    	if(isconnect){
    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:
    Code:
    void main(){
    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.
    Last edited by lukyjay; 30-04-08 at 06:14 AM.


  2. #2
    Account Upgraded | Title Enabled! KillShadow05 is offline
    MemberRank
    Apr 2008 Join Date
    United StatesLocation
    705Posts

    Re: [Release] Better Server Console + Tells when char online/offline

    Very nice, ill try it out later. Good work =)

  3. #3
    Account Upgraded | Title Enabled! lukyjay is offline
    MemberRank
    Jul 2006 Join Date
    AustraliaLocation
    745Posts

    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. :)

  4. #4
    Account Upgraded | Title Enabled! theonendonly is offline
    MemberRank
    Apr 2008 Join Date
    411Posts

    Re: [Release] Better Server Console + Tells when char online/offline

    yea that accept thing is annoying it fills my cmd box with it =P

  5. #5
    Account Upgraded | Title Enabled! xnBlaze is offline
    MemberRank
    Apr 2008 Join Date
    860Posts

    Re: [Release] Better Server Console + Tells when char online/offline

    Sweet :] had to spice up that dull console a bit.

  6. #6
    Proficient Member TehSkull is offline
    MemberRank
    Apr 2008 Join Date
    LouisianaLocation
    151Posts

    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

  7. #7
    Enthusiast MacMike is offline
    MemberRank
    May 2007 Join Date
    37Posts

    Re: [Release] Better Server Console + Tells when char online/offline

    That's really easy.
    Just add a printf to the !dc command.

  8. #8
    Enthusiast Cam1596 is offline
    MemberRank
    Apr 2008 Join Date
    42Posts

    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.

  9. #9
    Account Upgraded | Title Enabled! lukyjay is offline
    MemberRank
    Jul 2006 Join Date
    AustraliaLocation
    745Posts

    Re: [Release] Better Server Console + Tells when char online/offline

    Quote Originally Posted by TehSkull View Post
    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?

  10. #10
    Account Upgraded | Title Enabled! lukyjay is offline
    MemberRank
    Jul 2006 Join Date
    AustraliaLocation
    745Posts

    Re: [Release] Better Server Console + Tells when char online/offline

    Quote Originally Posted by Cam1596 View Post
    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!

  11. #11
    Member 1q1q is offline
    MemberRank
    Apr 2008 Join Date
    97Posts

    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.

  12. #12
    Proficient Member CCoffee is offline
    MemberRank
    Apr 2008 Join Date
    186Posts

    Re: [Release] Better Server Console + Tells when char online/offline

    looks nice, my custom one has colours though :)

  13. #13
    Enthusiast afikbar is offline
    MemberRank
    Aug 2007 Join Date
    42Posts

    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

  14. #14
    Proficient Member Xterminatorz is offline
    MemberRank
    Apr 2008 Join Date
    CaliforniaLocation
    168Posts

    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.

  15. #15
    Account Upgraded | Title Enabled! lukyjay is offline
    MemberRank
    Jul 2006 Join Date
    AustraliaLocation
    745Posts

    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 ^^

  16. #16
    Proficient Member Myth? is offline
    MemberRank
    May 2007 Join Date
    In Your House LLocation
    184Posts

    Re: [Release] Better Server Console + Tells when char online/offline

    alrite

  17. #17
    Valued Member ZacTheSin is offline
    MemberRank
    Mar 2007 Join Date
    138Posts

    Re: [Release] Better Server Console + Tells when char online/offline

    Some features eh?
    Like closing from the command line? D: Or maybe adding times when things were executed?
    Like what ;-; ?

    *Has no clue how to do anything like that*

    Also, how do you do colors? :<
    I wanna make a pretty one :3

  18. #18
    Account Upgraded | Title Enabled! lukyjay is offline
    MemberRank
    Jul 2006 Join Date
    AustraliaLocation
    745Posts

    Re: [Release] Better Server Console + Tells when char online/offline

    Quote Originally Posted by ZacTheSin View Post
    Some features eh?
    Like closing from the command line? D: Or maybe adding times when things were executed?
    Like what ;-; ?

    *Has no clue how to do anything like that*

    Also, how do you do colors? :<
    I wanna make a pretty one :3
    Some things i dont know how to do, ill admit im not exactly a guru when it comes to C++, but i know more than some.

  19. #19
    Account Upgraded | Title Enabled! lukyjay is offline
    MemberRank
    Jul 2006 Join Date
    AustraliaLocation
    745Posts

    Re: [Release] Better Server Console + Tells when char online/offline

    Quote Originally Posted by afikbar View Post
    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
    Okay updated, please test. If you get errors tell me them ^^

  20. #20
    Enthusiast afikbar is offline
    MemberRank
    Aug 2007 Join Date
    42Posts

    Re: [Release] Console V2 - Tutorial to help new people + make your server sexy

    kk,
    thank you ^^
    here is the errors i get,
    probably since u have identifier in player.h, which i dont,
    since i dont use repack,
    Player.cpp
    .\Player.cpp(158) : error C2065: 'chrSignOn' : undeclared identifier

    check if u have any ChrSignOn in player.h,
    and if there is, post the whole line here please ^^

  21. #21
    Member lookathenoob is offline
    MemberRank
    Apr 2008 Join Date
    67Posts

    Re: [Release] Console V2 - Tutorial to help new people + make your server sexy

    its from the new release, all in same raw.
    cool ty.

  22. #22
    Enthusiast afikbar is offline
    MemberRank
    Aug 2007 Join Date
    42Posts

    Re: [Release] Console V2 - Tutorial to help new people + make your server sexy

    Quote Originally Posted by lookathenoob View Post
    its from the new release, all in same raw.
    cool ty.

    u refer to my post?
    if so,
    what do u mean "its from the new release"?

  23. #23
    Enthusiast afikbar is offline
    MemberRank
    Aug 2007 Join Date
    42Posts

    Re: [Release] Console V2 - Tutorial to help new people + make your server sexy

    Here is a simplified fix,
    instead of doing this:
    Underneath it we wish to input a print command:
    Code:

    strcat_s(chrSignOn, 35, "' has logged on! :)"); //Prints command in console when char logs into game
    just post this:
    Code:
    printf ("%s is Online.\n", this->getName()); //Prints command in console when char logs into game

  24. #24
    Account Upgraded | Title Enabled! npmaple is offline
    MemberRank
    Apr 2008 Join Date
    Israel - a bad placeLocation
    281Posts

    Re: [Release] Console V2 - Tutorial to help new people + make your server sexy

    nice but i dont have power to add...
    tnx alot anyway

  25. #25
    Account Upgraded | Title Enabled! lukyjay is offline
    MemberRank
    Jul 2006 Join Date
    AustraliaLocation
    745Posts

    Re: [Release] Console V2 - Tutorial to help new people + make your server sexy

    Quote Originally Posted by afikbar View Post
    Here is a simplified fix,
    instead of doing this:


    just post this:
    Code:
    printf ("%s is Online.\n", this->getName()); //Prints command in console when char logs into game
    Oops, i copied the wrong line. Thanks for correcting =P



Advertisement