Thread: [PI] Timer

Results 1 to 3 of 3
  1. #1 [PI] Timer 
    Registered Member ashitrin's Avatar
    Join Date
    Jul 2010
    Posts
    560
    Thanks given
    41
    Thanks received
    78
    Rep Power
    70
    Hello, I need a timer that goes off every 4 hours and 59 minutes because my server restarts every 5 hours and I need an alert that tells the players it's going to restart. Will REP
    Reply With Quote  
     

  2. #2  
    Donator

    Robgob69's Avatar
    Join Date
    Oct 2010
    Age
    33
    Posts
    749
    Thanks given
    71
    Thanks received
    139
    Rep Power
    117
    In your Server.java define these:
    Code:
    	public long resetTimer = System.currentTimeMillis();
    	public boolean resetSent = false;
    	public static void messageAll(String s) {
    		for(Player p : PlayerHandler.players) {
    			if(p == null)
    				continue;
    			Client c = (Client)p;
    			c.sendMessage(s);
    		}
    		if(!s.startsWith("Alert##"))
    		System.out.println("[Server]: " + s);
    	}
    and then search for:
    Code:
    while (!Server.shutdownServer) {
    and under that line add this:
    Code:
    	if (!resetSent && System.currentTimeMillis() - lastMassSave > 7140000) {
    		messageAll("The server will reset in 60 seconds.");
    		resetSent = true;
    	}
    potatoes.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member ashitrin's Avatar
    Join Date
    Jul 2010
    Posts
    560
    Thanks given
    41
    Thanks received
    78
    Rep Power
    70
    Thanks bro.
    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

Similar Threads

  1. [PI] Pk Timer - Safe Timer [PI]
    By Trivzor in forum Tutorials
    Replies: 43
    Last Post: 06-24-2014, 07:49 AM
  2. Replies: 6
    Last Post: 06-07-2011, 02:10 PM
  3. How to add this timer? ++REP
    By Affliction in forum Application Development
    Replies: 0
    Last Post: 08-20-2010, 02:58 PM
  4. more then one timer?
    By Balla in forum Help
    Replies: 10
    Last Post: 08-29-2009, 08:24 PM
  5. How do i add an sM with a timer?
    By Mojave in forum Help
    Replies: 6
    Last Post: 04-12-2009, 09:10 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •