I did not create this script, I just picked up some functions of the tfs
Tested on tfs 0.4 rev 3777 and 3884
Create a file named GlobalSave.lua in /data/globalevents/scripts/ and place this code
In globalevents.xml put this
XX:XX is the time you want to global save.
sorry bad english :/
Tested on tfs 0.4 rev 3777 and 3884
Create a file named GlobalSave.lua in /data/globalevents/scripts/ and place this code
Code:
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()
return prepareShutdown(10) -- minutes to save and shutdown before time configured on globalevents.xml
end
In globalevents.xml put this
Code:
<globalevent name="GlobalSave" time="XX:XX" event="script" value="GlobalSave.lua"/>
XX:XX is the time you want to global save.
sorry bad english :/