General > Developers Corner
Countdown Command
Caustic Soda-Senpai:
So I'm trying to set up a ULX Command for a server restart by utilizing a countdown as a warning before it actually restarts. Is it possible to create a tick event so the command waits for (x) minutes to actually run _RESTART and display a tsay corresponding to how many minutes are left? The answer is probably right here in front of me but whatever.
JamminR:
My idea;
timer.simple - set time and function to run - every minute = good idea.
in function,
check if current time equals ( previously sched time) - Yes, restart. (you'll have to figure out some rounding tricks to account for variance, timer might not run function until .25 before or after your scheduled time.
check if current time is greater than ( previously set time var - 10min ) and less than (previously set future time) Yes? Display ( set time - current time) which will be (10, 9, 8 ...) each time looped.
set specific (static server time?) (manually set time 10 min from now?) variable -
run the timer.simple again
end
Caustic Soda-Senpai:
Yeah I was thinking something along those lines. I guess its play around till I get it.
XxLMM13xX:
Hello i think this would be a AWESOME thing to do i dont know if there is a really simple way to do this for like beginner coders so ill look into it!
Caustic Soda-Senpai:
I think I more or less have it. I'll post the finished product.
Navigation
[0] Message Index
[#] Next page
Go to full version