• 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!

Solved HELP GlobalEvents TFS 1.2 ServerSave.

Zodia

Member
Joined
Feb 21, 2020
Messages
220
Reaction score
20
I am using the Nostalrius 7.7 server, which is TFS 1.2
I'm looking to understand how ServerSave works....



My Globalevents.XML is:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<globalevents>
    <globalevent type="startup" name="ServerStartup" script="startup.lua"/>
    <globalevent type="record" name="PlayerRecord" script="record.lua"/>
    <globalevent name="Server Save" time="06:00:00" script="serversave.lua" />
</globalevents>


My Serversave.Lua is:
Code:
local shutdownAtServerSave = true
local cleanMapAtServerSave = true

local function serverSave()
    if shutdownAtServerSave then
        Game.setGameState(GAME_STATE_SHUTDOWN)
    else
        Game.setGameState(GAME_STATE_CLOSED)

        if cleanMapAtServerSave then
            cleanMap()
        end

        Game.setGameState(GAME_STATE_NORMAL)
    end
end

local function secondServerSaveWarning()
    broadcastMessage("Server is saving game in one minute.\nPlease log out.", MESSAGE_STATUS_WARNING)
    addEvent(serverSave, 60000)
end

local function firstServerSaveWarning()
    broadcastMessage("Server is saving game in 3 minutes.\nPlease come back in 10 minutes.", MESSAGE_STATUS_WARNING)
    addEvent(secondServerSaveWarning, 120000)
end

function onTime(interval)
    broadcastMessage("Server is saving game in 5 minutes.\nPlease come back in 10 minutes.", MESSAGE_STATUS_WARNING)
    Game.setGameState(GAME_STATE_STARTUP)
    addEvent(firstServerSaveWarning, 120000)
    return not shutdownAtServerSave
end

I'm running on Ubuntu 14.04.6.

The problem is that at 06:00 AM it did not give the server save as I imagined. How it works? How can I do to get what I want? Where do I start? The idea is that in the morning, the server will close, save and, if possible, start automatically automatically. Can someone help me?


I got an AutoRestarter.sh for Linux, now I don't know how it works (and if it works) this serversave.lua
Post automatically merged:


@@@@EDIT
My problem has been solved. I needed to know the time of the linux machine using date on the console. I changed and tested it. You can close or delete the topic, problem solved!
 
Last edited:
Yes, the time you put in time attribute in your globalevents.xml is the local time of your machine (host server) that your ot server currently runs on.
 
Back
Top