Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.
If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!
Now, what are you waiting for? Join the community now!
You can always check out skUnity Downloads for downloads and any other information about Skript!
hmm will it work with 1.8?
on skript load:
set {restart::timer} to now formatted human-readable
every 1 second:
set {_diff} to difference between {restart::timer} and now
if {_diff} is 1 hour:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c3 HOURS.&e&l'"
else if {_diff} is 2 hour:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c2 HOURS.&e&l'"
else if {_diff} is 3 hours:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c1 HOUR.&e&l'"
else if {_diff} is 3 hours and 55 minutes:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c5 MINUTES.&e&l'"
else if {_diff} is 3 hours and 57 minutes:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c3 MINUTES..&e&l'"
else if {_diff} is 3 hours and 58 minutes:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c2 MINUTE.&e&l'"
else if {_diff} is 3 hours and 59 minutes:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c1 MINUTE.&e&l'"
else if {_diff} is 3 hours and 59 minutes and 30 seconds:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c30 SECONDS.&e&l'"
else if {_diff} is 3 hours and 59 minutes and 50 seconds:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c10 SECOND.&e&l'"
else if {_diff} is 3 hours and 59 minutes and 57 seconds:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c3 SECOND.&e&l'"
else if {_diff} is 3 hours and 59 minutes and 58 seconds:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c2 SECOND.&e&l'"
else if {_diff} is 3 hours and 59 minutes and 59 seconds:
broadcast "&4&l(!) &e&lSERVER RESTARTING IN '&c1 SECOND.&e&l'"
execute console command "restart"
command /nextrestart:
trigger:
set {_time} to difference between {restart::timer} and now
send "&e&l(!) &2Next Restart: &a&l%difference between 4 hours and {_time}%" to player
the formatted time expression returns a string not a timespan, use it when you want to broadcast the time not when youre setting the var
command /nextrestart:
trigger:
set {_time} to difference between {restart::timer} and now
set {_now} to difference between 4 hours and {_time}
send "&e&l(!) &2Next Restart: &a&l%{_now} formatted human-readable%" to player
function getTimeString(time: timespan) :: string:
set {_hours} to floor({_time}.getMilliSeconds() / 3600000)
set {_minutes} to floor(mod({_time}.getMilliSeconds() / 60000, 60))
set {_seconds} to floor(mod({_time}.getMilliSeconds() / 1000, 60))
set {_hours} to "%{_hours}%" if {_hours} is greater than 9 else ("0%{_hours}%")
set {_minutes} to "%{_minutes}%" if {_minutes} is greater than 9 else ("0%{_minutes}%")
set {_seconds} to "%{_seconds}%" if {_seconds} is greater than 9 else ("0%{_seconds}%")
return "%{_hours}%::%{_minutes}%::%{_seconds}%"