Cornwallis
Member
- Joined
- Jan 3, 2010
- Messages
- 480
- Reaction score
- 16
Is there a way that you can make a script to close the ot and then run it again at the same time everyday?
function onTimer()
doBroadcastMessage('shutdown in 2 minutes.')
return addEvent(onShutdown,2*60*1000)
end
function onShutdown()
return doSetGameState(GAMESTATE_SHUTDOWN)
end
Does it save before the restart?
function onTimer()
doBroadcastMessage('shutdown in 2 minutes.')
return addEvent(onShutdown,2*60*1000)
end
function onShutdown()
doSaveServer()
return doSetGameState(GAMESTATE_SHUTDOWN)
end
globalSaveEnabled = false
globalSaveHour = 8
shutdownAtGlobalSave = true
cleanMapAtGlobalSave = false
<?xml version="1.0" encoding="UTF-8"?>
<globalevents>
<globalevent name="effects" interval="1" event="script" value="talkingtiles.lua"/>
<globalevent name="save" interval="43200" event="script" value="save.lua"/>
<globalevent name="shop" interval="30" event="script" value="shop.lua"/>
<globalevent name="info" interval="120" event="script" value="information.lua"/>
<globalevent name="clean" interval="7200" event="script" value="clean.lua"/>
<globalevent name="serverstart" type="start" event="script" value="start.lua"/>
<globalevent name="playersrecord" type="record" event="script" value="record.lua"/>
</globalevents>
local config = {
broadcast = {120, 30},
shallow = "no",
delay = 120,
events = 30
}
config.shallow = getBooleanFromString(config.shallow)
local function executeSave(seconds)
if(isInArray(config.broadcast, seconds)) then
local text = ""
if(not config.shallow) then
text = "Full s"
else
text = "S"
end
text = text .. "erver save within " .. seconds .. " seconds, please mind it may freeze!"
end
if(seconds > 0) then
addEvent(executeSave, config.events * 1000, seconds - config.events)
else
doSaveServer(config.shallow)
end
end
function onThink(interval, lastExecution, thinkInterval)
if(table.maxn(config.broadcast) == 0) then
doSaveServer(config.shallow)
else
executeSave(config.delay)
end
return true
end