LucasFerraz
Systems Analyst
Credits to Someone I don't know who for function prepareShutdown.
Special thanks to Ninja
Thank you to Summ to getWorldUpTime()
If you want to give rep or like, give it to Ninja
Default = 3h (dawn)
Special thanks to Ninja
Thank you to Summ to getWorldUpTime()
If you want to give rep or like, give it to Ninja
XML:
<globalevent name="globalsave" time="3:00" event="script" value="globalsave.lua"/>
Lua:
function prepareShutdown(minutes) if(minutes <= 0) then
doSetGameState(GAMESTATE_SHUTDOWN)
return false
end
if(minutes == 1) then
doBroadcastMessage("Server is going down in " .. minutes .. " minute for global save, please log out now!")
elseif(minutes <= 3) then
doBroadcastMessage("Server is going down in " .. minutes .. " minutes for global save, please log out.")
else
doBroadcastMessage("Server is going down in " .. minutes .. " minutes for global save.")
end
shutdownEvent = addEvent(prepareShutdown, 60000, minutes - 1)
return true
end
function onTime(interval)
if os.date('%H') == "3" and getWorldUpTime() > 20*60*60 then
return prepareShutdown(10)
end
return TRUE
end
Default = 3h (dawn)
Last edited: