Thread: [Delta] Making seconds into real seconds or minutes

Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1 [Delta] Making seconds into real seconds or minutes 
    Registered Member

    Join Date
    Feb 2008
    Posts
    420
    Thanks given
    8
    Thanks received
    28
    Rep Power
    84
    This is a tutorial on how to fix timers on your server i recommend delta base because i only tested on delta not any other source.

    I am going to be explaining what each step does and everything so here we go,

    First open playerhandler.java
    Real Seconds:
    now scroll down a little bit until you see alot of declared int's and add this in some where..


    Code:
    public static int seconds = 0;
    public static int rseconds = 0;
    all that is doing is adding the int and declaring the int.

    Next search for something like
    Code:
    if(pitsWaitTimer > 0){
    pitsWaitTimer -= 1;
    }
    add this after that

    Code:
    if(rseconds > 0){
    rseconds = seconds/2;
    }
    if(seconds > 0){
    rseconds -= 1;
    }
    that is making the fake seconds into real seconds

    next search for
    Code:
    if(pitsWaitTimer == 0){
    pitsWaitTimer = 0;
    }
    after that add

    Code:
    if(rseconds == 0){
    rseconds = 0;
    }
    if(seconds == 0){
    seconds = 0;
    }
    all that is doing is making sure the seconds do not go below 0

    now to add this to make it show in a message or something go into client.java and add this into a message

    Code:
    "+PlayerHandler.rseconds+"
    which should make it look something like this

    Code:
    sM("Welcome to HeyOrSomething you have "+PlayerHandler.rseconds+" to get verified.");
    also in client.java make sure when u declare the seconds it cant be rseconds it has to be seconds and u have to double the seconds on what you want the seconds to really be for ex: if you wanted 60 seconds you would make

    Code:
    PlayerHandler.seconds = 120;

    --

    Now for the minutes, all you have to do to change the seconds into minutes is add this integer like we did above, i have explained everything so i do not need to here

    Code:
    public static int minutes = 0;
    search for
    Code:
    if(rseconds == 0){
    rseconds = 0;
    }
    if(seconds == 0){
    seconds = 0;
    }
    and add this under it

    Code:
    if(minutes > 0){
    minutes = rseconds/60;
    }
    if(rseconds > 0){
    minutes -= 1;
    }
    search for this

    Code:
    if(rseconds == 0){
    rseconds = 0;
    }
    if(seconds == 0){
    seconds = 0;
    }
    and add this under it

    Code:
    if(minutes == 0){
    minutes = 0;
    }
    and for the minutes to show add the message like this


    Code:
    sM("Welcome to HeyOrSomething you have "+PlayerHandler.minutes+" to get verified.");
    to declare minutes correctly make it so it shows like this

    Code:
    PlayerHandler.seconds = 240;
    for 2 minutes

    not much of a difference in real seconds and minutes but yea i added this to my server 100% by myself it wasnt that hard just a little confusing with numbers.


    I didnt look at my source the whole way through on adding this so if there is some kind of error please post it! Thanks!
    Reply With Quote  
     

  2. #2  
    Austin_
    Guest
    first post!, looks great!
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Feb 2008
    Posts
    420
    Thanks given
    8
    Thanks received
    28
    Rep Power
    84
    Thanks!
    Reply With Quote  
     

  4. #4  
    Registered Member
    Homie Pimpson's Avatar
    Join Date
    Jul 2008
    Age
    26
    Posts
    982
    Thanks given
    280
    Thanks received
    124
    Rep Power
    175
    Great, now i won't have to calculate how many seconds are minutes thanks
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Feb 2008
    Posts
    420
    Thanks given
    8
    Thanks received
    28
    Rep Power
    84
    is that being smart elic?
    Reply With Quote  
     

  6. #6  
    Registered Member
    Homie Pimpson's Avatar
    Join Date
    Jul 2008
    Age
    26
    Posts
    982
    Thanks given
    280
    Thanks received
    124
    Rep Power
    175
    What? I'm just saying it's good.
    Reply With Quote  
     

  7. #7  
    Registered Member Anthony''s Avatar
    Join Date
    Oct 2008
    Age
    36
    Posts
    252
    Thanks given
    3
    Thanks received
    12
    Rep Power
    42
    Quote Originally Posted by Pew Pewed View Post
    first post!, looks great!
    your siggy makes me so scared of you over the net
    Reply With Quote  
     

  8. #8  
    Renown Programmer
    Method's Avatar
    Join Date
    Feb 2009
    Posts
    1,455
    Thanks given
    0
    Thanks received
    843
    Rep Power
    3019
    Code:
    if(rseconds == 0){
    rseconds = 0;
    }
    if(seconds == 0){
    seconds = 0;
    }
    What...? If either of those are equal to zero, you set them to zero. That's pointless.
    Reply With Quote  
     

  9. #9  
    Registered Member

    Join Date
    Feb 2008
    Posts
    420
    Thanks given
    8
    Thanks received
    28
    Rep Power
    84
    dude u must declare them in client.java to be like seconds = 343; or something
    Reply With Quote  
     

  10. #10  
    Nuthin
    Guest
    Quote Originally Posted by Jbird View Post
    is that being smart elic?
    I believe the term is "Smart Alec".
    Reply With Quote  
     

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
  •