• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Global Save + Shutdown (You choose hour)

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
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:p

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:
I cannot take credits for something I haven't done :(

http://otland.net/f82/globalsave-156197/

I deleted my post by mistake <_<.. That guy didn't make it either so credits should go to X.

EDIT: Just saying, editing posts with iPhone sux..
 
Uhmmm easier, at config.lua:

globalSaveEnabled = true
globalSaveHour = 5
globalSaveMinute = 30
shutdownAtGlobalSave = true
cleanMapAtGlobalSave = false

It will shutdown server at 5:30 AM, easy?
 
No, you need auto restarter then.
 
Back
Top