Thread: Loading News/Text for a Text file to server

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37
  1. #1 Loading News/Text for a Text file to server 
    sex inFamous's Avatar
    Join Date
    Sep 2008
    Posts
    0
    Thanks given
    6
    Thanks received
    4
    Rep Power
    0
    Ok i am going to teach you how to load News or any text from a .txt file into your server as a welcome message.

    Step 1)Create a text file called "wmessage.txt"

    Step 2)Open the txt file and add this

    Code:
    END OF WMESSAGE.TXT EDITING
    -----------------------------------------------------------
    START OF CLIENT.JAVA EDITING
    Step 3) open client.java and search for this:
    Code:
    public void
    After you find that add the below code after the end of the public void
    Code:
    public void wmessage()
        {
            try
            {
                BufferedReader in = new BufferedReader(new FileReader("data/wmessage.txt"));
                String data = null;
                while ((data = in.readLine()) != null)
                {
                    sendMessage(data);
                }
            }
            catch (IOException e)
            {
                System.out.println("Critical error while reading welcome message file!");
                e.printStackTrace();
            }
        }
    Step 4) Search for:
    Code:
    openWelcomeScreen
    You should see something like this:
    Code:
    MainHelpMenu();
    		//openWelcomeScreen(201, false, 3, (127 << 24)+1, misc.random(10));
    		ResetBonus();
    		GetBonus();
    		WriteBonus();
                    Poisoned = false;
    		sendMessage("Welcome to (server name");
                    sendMessage("Type ::commands for list of useful commands!");
                    sendMessage("Train Combat on NPC's! ");
                    sendMessage("Type ::servermenu for help.");
                    sendMessage("S");
    		sendMessage("PLEASE DON'T ASK TO BECOME A PLAYER MOD!!!");
    		sendMessage("IT WONT WORK!!!!");
                    sendMessage("Ecto tokens are now a replacement to bloods due to server crashes.");
    		sendMessage("TYPE ::menuhelp FOR A LIST OF MENU's");
    		sendMessage("Before playing please read ::disclaimer");
    Replace that with this:
    Code:
    wmessage(); //Read & Print welcome message from file


    Now Save and compile.

    Step 5)
    Now open that .txt file you made before and you can put anything you want in, so when you log in your server, that txt would be displayed as a welcome message.


    100% Credits to Public boolean

    Yes this works for 508s aswell.
    i'm back...
    Reply With Quote  
     

  2. #2  
    Registered Member sure im crazy's Avatar
    Join Date
    Jan 2009
    Age
    26
    Posts
    539
    Thanks given
    25
    Thanks received
    7
    Rep Power
    10
    This is cool ill just replace that other 1 i have.
    No signature no problem.
    Reply With Quote  
     

  3. #3  
    sex inFamous's Avatar
    Join Date
    Sep 2008
    Posts
    0
    Thanks given
    6
    Thanks received
    4
    Rep Power
    0
    Yup, thats what it is for ;0
    i'm back...
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Feb 2008
    Posts
    204
    Thanks given
    3
    Thanks received
    0
    Rep Power
    4
    we dont have a client in 508 so how do i add it can i add it in action sender
    Reply With Quote  
     

  5. #5  
    Bot
    Bot is offline
    You're My Favourite!

    Join Date
    Aug 2007
    Posts
    1,282
    Thanks given
    485
    Thanks received
    72
    Rep Power
    1397
    Ahh nice job


    [Only registered and activated users can see links. ]

    With Love, Bot.
    Reply With Quote  
     

  6. #6  
    sex inFamous's Avatar
    Join Date
    Sep 2008
    Posts
    0
    Thanks given
    6
    Thanks received
    4
    Rep Power
    0
    Quote Originally Posted by nobiwa View Post
    we dont have a client in 508 so how do i add it can i add it in action sender
    Its pretty obvuois... login.java...
    i'm back...
    Reply With Quote  
     

  7. #7  
    Rukin1


    Rukin1's Avatar
    Join Date
    Apr 2007
    Age
    28
    Posts
    5,003
    Thanks given
    228
    Thanks received
    229
    Discord
    View profile
    Rep Power
    4179
    This isn't that hard lol...
    Spoiler for large sig:


    Reply With Quote  
     

  8. #8  
    sex inFamous's Avatar
    Join Date
    Sep 2008
    Posts
    0
    Thanks given
    6
    Thanks received
    4
    Rep Power
    0
    Yes i know it isnt hard :/ its jyst most people hate recompileing work every time when people gota chnage news in server, so i made this tut where it auto reads from the text file to the server without re-compiling or restarting
    i'm back...
    Reply With Quote  
     

  9. #9  
    Registered Member Tzar's Avatar
    Join Date
    Aug 2007
    Posts
    1,046
    Thanks given
    54
    Thanks received
    12
    Discord
    View profile
    Rep Power
    260
    You forgot some imports(if not already there):
    Code:
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;
    Also your code should look like this:
    Code:
    public void wmessage(Player p)
        {
            try
            {
                BufferedReader in = new BufferedReader(new FileReader("data/wmessage.txt"));
                String data = null;
                while ((data = in.readLine()) != null)
                {
                    sendMessage(p, data);
                }
            }
            catch (IOException e)
            {
                System.out.println("Critical error while reading welcome message file!");
                e.printStackTrace();
            }
        }
    Code:
    wmessage(p);
    But really good neat thing



    [Only registered and activated users can see links. ]



    Reply With Quote  
     

  10. #10  
    sex inFamous's Avatar
    Join Date
    Sep 2008
    Posts
    0
    Thanks given
    6
    Thanks received
    4
    Rep Power
    0
    thanks kadir,
    i'm back...
    Reply With Quote  
     

Page 1 of 4 123 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •