Countdown

Discussion in 'Plugin Development' started by Reinified, Feb 11, 2019.

Thread Status:
Not open for further replies.
  1. So, I have a small minigame plugin which uses a custom class as the way to initialise a specific game (for example, 1v1 is 1 object that has information such as playercount, status (in game or in lobby), displayname, etc) I want to make it so when I run the start() function of the class a 2 minute counter begins counting down. Once the timer reaches zero, a second function is run. If possible, it would be nice to have warnings every 30 seconds with info on how much time remains. How could this be done?
     
  2. Offline

    Tango_

    Just schedule a a repeating task every 20 ticks (1 second) and have a variable to store the default count down time in seconds. Inside the repeating task, minus 1 every time from the variable. Then you can check if the variables value is equal to the time at 1m 30s, 1m 0s, 30s, and 0s and notify the players. Then you can cancel the task and once it reaches 0 you can begin your game.
     
Thread Status:
Not open for further replies.

Share This Page