Thread: Happy Hour

Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1 Happy Hour 
    Registered Member

    Join Date
    Jul 2007
    Posts
    95
    Thanks given
    0
    Thanks received
    0
    Rep Power
    79
    Description: To add an hour of time in which players can recieve double exp for everything they do!

    Difficulty: 1/10

    Assumed Knowledge: Copy+Paste, able to replace a few things

    Classes Modified: Server.java, Client.java

    Tested on: Czar

    Process:

    Step 1: Declarations
    Open up server.java and under or above

    Code:
    public static final int cycleTime = 500;
    Add:

    Code:
    public static boolean HappyHour = false;
    public static int HHTime = 0;
    Step 2: Tell players when happy hour is activated

    Save+Close Server.java
    Open Client.java
    Find your welcome messages
    Usually under:
    Code:
    playerLastConnect = connectedFrom;
    Add:

    Code:
    if (server.HappyHour == true) {
    sendMessage("Happy Hour is activated! Hury only " + server.HHTime / 120 + " minutes left!");
    } else {
    sendMessage("Happy Hour is not activated, maybe [OWNERS NAME] will be nice enough to turn it on?");
    }
    Replace [OWNERS NAME] with your name

    Step 3: Adding the Command
    In client.java search:
    Code:
    customCommand(string command)
    under that put:
    Code:
    if ((command.equalsIgnoreCase("Happy Hour")) && (playerName.equalsIgnoreCase("[OWNERS NAME]"))) {
    if (server.HappyHour == false) {
    server.HHTime = 7200;
    server.HappyHour = true;
    sendMessage("Happy Hour Enabled");
    PlayerHandler.messageToAll = playerName + " has started Happy Hour! You now get double xp for everything you do!";
    } else {
    server.HHTime = 0;
    server.HappyHour = false;
    sendMessage("Happy Hour Disabled");
    PlayerHandler.messageToAll = playerName + " has disabled Happy Hour. what did you do?";
    }
    }
    Once again replace [OWNERS NAME] with your name
    This checks if it is enabled or disabled if its disabled, it turns it on with a one hour timer, if it is on it shuts it off and removes the timer amount.

    Step 4: Making the timer work
    In client.java search:
    Code:
    public void process() {
    or
    Code:
    public boolean process() {
    Under it add:

    Code:
    if ((server.HHTime > 0) && (server.HappyHour == true)) {
    server.HHTime -= 1;
    } else if ((server.HHTime < 1) && (server.HappyHour == true)) {
    server.HappyHour = false;
    server.HHTime = 0;
    PlayerHandler.messageToAll = "Happy Hour is over! Sorry!";
    }
    While you're in process you have the option of adding this:
    Code:
    if (server.HappyHour == true) {
    if (misc.random(1000) == 1) {
    PlayerHandler.messageToAll = "Time left for happy hour: " + server.HHTime / 120 + " minutes";
    }
    }
    It's a random message, will run about 8 times an hour

    Step 5: Fix AddSkillXP

    In client.java search:

    Code:
    playerXP[skill] += amount;
    and replace it with:

    Code:
    if (server.HappyHour == true) {
    playerXP[skill] += amount * 2;
    } else {
    playerXP[skill] += amount;
    }
    Credits: 100% me!

    Errors: Post them here!


    Yay 13000+ Rep
     

  2. #2  
    Banned

    Join Date
    Dec 2006
    Age
    25
    Posts
    2,196
    Thanks given
    5
    Thanks received
    23
    Rep Power
    0
    cool idea kinda like on halo(double xp weekend) or rapidshare(happy hour) good job! rep++
     

  3. #3  
    alley
    Guest
    nice job lol
     

  4. #4  
    Registered Member

    Join Date
    Jul 2007
    Posts
    95
    Thanks given
    0
    Thanks received
    0
    Rep Power
    79
    Quote Originally Posted by Shocker View Post
    cool idea kinda like on halo(double xp weekend) or rapidshare(happy hour) good job! rep++
    I got the idea when I went to download something off RapidShare lol


    Yay 13000+ Rep
     

  5. #5  
    Registered Member

    Join Date
    Sep 2007
    Posts
    1,394
    Thanks given
    3
    Thanks received
    2
    Rep Power
    323
    Wow, Thats awesome i would add but don't have a server atm, Good job. Love the idea
     

  6. #6  
    Registered Member

    Join Date
    Jul 2007
    Posts
    95
    Thanks given
    0
    Thanks received
    0
    Rep Power
    79
    Wow, I didn't think I'd get this many responses this fast about Happy Hour lol


    If I don't get anymore posts within the next week, or so, I'm removing it!


    Yay 13000+ Rep
     

  7. #7  
    Optimist

    Vice's Avatar
    Join Date
    Nov 2007
    Age
    25
    Posts
    3,263
    Thanks given
    3
    Thanks received
    59
    Rep Power
    2536
    Nice idea
    Jack
    Scotland
    Undergraduate - BSc Computing Science
     

  8. #8  
    Registered Member
    JakobWolthers's Avatar
    Join Date
    Aug 2007
    Age
    28
    Posts
    616
    Thanks given
    16
    Thanks received
    3
    Rep Power
    84
    cool idea i like it and maybe add to my server so Ty m8
    [Only registered and activated users can see links. ]
     

  9. #9  
    Registered Member

    Join Date
    Jul 2007
    Posts
    95
    Thanks given
    0
    Thanks received
    0
    Rep Power
    79
    yep, thanks for the comments =P


    Yay 13000+ Rep
     

  10. #10  
    orunu159
    Guest
    i got his error
    Code:
    server.java:140: cannot find symbol
    symbol  : variable updateSeconds
    location: class server
            updateSeconds = 180 - ((int) (curTime - startTime) / 1000);
            ^
    server.java:141: cannot find symbol
    symbol  : variable updateSeconds
    location: class server
            if (updateSeconds == 0) {
                ^
    Note: stream.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    2 errors
    Press any key to continue . . .
    wat do i need to do?

    p.s: I posted this tut on mopar 99.9% cred to u for making and .1% cred to me for posting it on there is this ok?
     

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