So I’m trying to find a script that everytime the server is about to restart it will give 3 warnings, it will say 30min,10 min before restart, 5min and then 1 min to logout to save data. but seem to not have found anything other than bat scripts to restart my server which work, just need to have a thing for the chat now to let players know when the restart is going to happen, so they can save their data before restart.
running esx, and windows server.
How much time between each 30 minute warning?
well it starts at 30, like 30 min before restart then goes to 15 min, then 10, 5 then 1min then the server restarts i have a restart script already just not anything that says the server is going to restart.
Just do a command:
RegisterCommand("restartimer, function()
Then do a wait
Citizen.Wait(TIME IN MS)
Then a chat message
TriggerClientEvent("chatMessage", -1, "RESTART", {255,255,255}, "TIME minutes until a server restart.")
Then 2 more waits with messages inbetween.
then finish it off with an end
end)
You would end up with:
RegisterCommand("restarttimer", function()
TriggerClientEvent("chatMessage", -1, "RESTART", {255,255,255}, "30 minutes until a server restart.")
Citizen.Wait(900000)
TriggerClientEvent("chatMessage", -1, "RESTART", {255,255,255}, "15 minutes until a server restart.")
Citizen.Wait(600000)
TriggerClientEvent("chatMessage", -1, "RESTART", {255,255,255}, "5 minutes until a server restart.")
Citizen.Wait(300000)
TriggerClientEvent("chatMessage", -1, "RESTART", {255,255,255}, "Server restarting.")
[Execute Your Restart Script Here]
end)
Thanks, Scott where would i be putting this exactly? kinda confused on that, also my server restarts every 4 hours.
Also i changed the times for my 4 hour restart.
Just wondering where to put this in my resources or in my bat script for my server to restart.
RegisterCommand("restarttimer", function()
TriggerClientEvent("chatMessage", -1, "RESTART", {255,255,255}, "30 minutes until a server restart.")
Citizen.Wait(12600)
TriggerClientEvent("chatMessage", -1, "RESTART", {255,255,255}, "15 minutes until a server restart.")
Citizen.Wait(13500)
TriggerClientEvent("chatMessage", -1, "RESTART", {255,255,255}, "5 minutes until a server restart.")
Citizen.Wait(14100)
TriggerClientEvent("chatMessage", -1, "RESTART", {255,255,255}, "Server restarting.")
[Execute Your Restart Script Here]
end)
still needing some help with this, basically i need a script where it says the server is going to restart, in the chat so people can disconnect without losing anything.