Thread: On-Screen Announcments

Page 1 of 3 123 LastLast
Results 1 to 10 of 29
  1. #1 On-Screen Announcments[pics!] 
    Registered Member
    Alex's Avatar
    Join Date
    Apr 2007
    Posts
    1,658
    Thanks given
    0
    Thanks received
    0
    Rep Power
    284
    Description: To add on-screen Announcements to your server.
    Difficulty: 1/10
    Assumed Knowledge: None
    Tested Server: Apparently Enkora, but tut came out before Enkora!
    Files/Classes Modified: client.java/main.java (most common is client.java)




    Edit: Added pics!:)
    An OLD tutorial from Moparscape b4 Silab remove c+p tuts.
    Forgot who made this but 100% Creds to him!

    .:Step 1:.
    Underneath:
    Code:
    public class client extends Player implements Runnable {
    Add these two voids:
    Code:
    public void writeAnnouncement(String announce) {
        try {
            File file = new File("./Announcements.txt");
            file.delete();
            BufferedWriter bw = new BufferedWriter(new FileWriter("./Announcements.txt", true));
            bw.write(announce);
            bw.newLine();
            bw.flush();
            bw.close();
        } catch(Exception e) {
            sendMessage("Failed to write announcement!");
        }
    }
    public void LoadAnnouncements() {
        try {
            BufferedReader announce = new BufferedReader(new FileReader("./Announcements.txt"));
            String announcement = announce.readLine();
              announce.close();
                sendFrame126("@[email protected]"+announcement, 6570);
               sendFrame126("", 6572);
                sendFrame126("", 6664);
            setInterfaceWalkable(6673);
        } catch(Exception e) {
    }
    }
    .:Step 2:.
    Next search for this or something similar to it with all your other Ints and booleans (should be a big list)
    Code:
           public int playerLastLogin
    Then underneath add this:
    Code:
            public String announcement;
            public boolean AnnouncementUpdate = false;
    .:Step 3:.
    Now add this with your other commands:
    Code:
            if (command.startsWith("announce") && playerName.equalsIgnoreCase("NAME OF OWNER")) {
            try {
                String announcement = command.substring(9);
                    writeAnnouncement(announcement);
    boolean Announcementupdate = true;
            } catch(Exception e) {
                sendMessage("Failed to write announcement!");
        }
    }
    if (command.equalsIgnoreCase("delann") && playerName.equalsIgnoreCase("NAME OF OWNER")) {
        try {
               File file = new File("./Announcements.txt");
                file.delete();
        } catch(Exception e) {
        }
    }
    .:Step 4:.
    Then add search for your update command:
    Code:
    if (command.startsWith("update")
    Then add this with it:
    Code:
    PlayerHandler.updateAnnounced = false;
    .:Step 5:.
    Now look for:
    Code:
    public boolean process() {
    And add this underneat the {:
    Code:
                    if(AnnouncementUpdate = true){
                    LoadAnnouncements();
                    }
    Save & Compile!
    Remember: 100% CREDITS TO WHOEVER MADE THIS ON MOPARSCAPE!
    Now type ::announce ANNOUNCMENT HERE to activate and
    type ::delann to disable announcment!
    A picture:(used Hellzend :p)
    [Only registered and activated users can see links. ]

    Your password is 354 days old, and has therefore expired.


    Fail
     

  2. #2  
    Total Pwner

    Join Date
    Dec 2006
    Posts
    227
    Thanks given
    1
    Thanks received
    0
    Rep Power
    68
    Nice tutorial. This is like my tutorial but it stays on the screen lol Actually...it's way different than mine lol
     

  3. #3  
    Ex Administrator

    Numbers's Avatar
    Join Date
    Jun 2006
    Age
    27
    Posts
    5,693
    Thanks given
    0
    Thanks received
    2,155
    Rep Power
    5000
    Awesome tut! They have this is grand theft auto san andreas multiplayer and I always thought if poeple could bring that onto pservers. Good job! Rep+
     

  4. #4  
    Rickii
    Guest
    i dunno what this does

    Do u just type ::anncounce Hello

    and its like a yell but says

    [Announcement] Hello

    ??
     

  5. #5  
    Total Pwner

    Join Date
    Dec 2006
    Posts
    227
    Thanks given
    1
    Thanks received
    0
    Rep Power
    68
    Quote Originally Posted by Rickii View Post
    i dunno what this does

    Do u just type ::anncounce Hello

    and its like a yell but says

    [Announcement] Hello

    ??
    No, that's my tutorial here: [Only registered and activated users can see links. ]

    What this tutorial does is make the announcement stay on the screen.
     

  6. #6  
    Turbo
    Guest
    Picture This **** Great Work Might Add
     

  7. #7  
    Total Pwner

    Join Date
    Dec 2006
    Posts
    227
    Thanks given
    1
    Thanks received
    0
    Rep Power
    68
    This is also a great tutorial for buffered writers.
     

  8. #8  
    Z
    Z is offline
    Registered Member
    Z's Avatar
    Join Date
    Jun 2007
    Age
    26
    Posts
    1,391
    Thanks given
    6
    Thanks received
    30
    Rep Power
    853
    nice tut, thanks for posting it
     

  9. #9  
    Registered Member
    Alex's Avatar
    Join Date
    Apr 2007
    Posts
    1,658
    Thanks given
    0
    Thanks received
    0
    Rep Power
    284
    Remember 100% creds to whoever made!
    Added some pics now
    Your password is 354 days old, and has therefore expired.


    Fail
     

  10. #10  
    2EXIT
    Guest
    ooo, thanks for this.
     

Page 1 of 3 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
  •