Thread: How to make a global int?

Results 1 to 10 of 10
  1. #1 How to make a global int? 
    Stanyer
    Guest
    For example if i was to make castlewars and i wanted an int for the time as 1200.

    To prevent each user logging on and the timer being unique to them, so it may be 1200 for them but 500 for another person.

    How would i make a global int, so the number is the same for everyone?
    Reply With Quote  
     

  2. #2  
    Stanyer
    Guest
    There must be some way, JaGeX made castlewars have a 20 minute timer which is global.
    Reply With Quote  
     

  3. #3  
    Stanyer
    Guest
    I know, but that would still be differant for each user.

    Right say for example player x logs on.

    Timer 1 starts on 1000 and decreases by 1 each second.

    30 seconds later Player x's Timer 1 is on 970, however player y logs on, but timer 1 would be 1000 for him, and timer 1 for player x would be 970.
    Reply With Quote  
     

  4. #4  
    Community Veteran

    Jake_'s Avatar
    Join Date
    Apr 2007
    Age
    28
    Posts
    2,048
    Thanks given
    18
    Thanks received
    80
    Discord
    View profile
    Rep Power
    253
    or.. each person can have their own seperate int, but they all start the game at the same time.
    Reply With Quote  
     

  5. #5  
    Stanyer
    Guest
    So playerHandler is basically run via the server.

    So if i made

    Timer1 = 1200;

    and made the timer1 decrease by 1 each second.

    If player x logs on, then 30 seconds later when player y logs on, although player x's timer1 will now be 970, so will player x's?
    Reply With Quote  
     

  6. #6  
    Stanyer
    Guest
    Alright if it works thankz.

    Also, if i was to call a method in PlayerHandler, would it call it for everyone?

    For example if the method in playerHandler contained "teleportToX = xxxx" and i called it, would everyone get teleported to xxxx?
    Last edited by Stanyer; 01-09-2008 at 11:51 PM. Reason: Double posting is not allowed!
    Reply With Quote  
     

  7. #7  
    mr s' sock
    Guest
    public static int

    static is global.
    Reply With Quote  
     

  8. #8  
    Stanyer
    Guest
    Alright cheers
    Reply With Quote  
     

  9. #9  
    Fallen Azn SinZ
    Guest
    mr s'sock, static makes the object (variable/method), able to be called upon in any class, without having to define it again.
    Reply With Quote  
     

  10. #10  
    Gander
    Guest
    static Integer imgay = new Integer(1);
    Reply With Quote  
     


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
  •