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

TFS [1.4.2] MAP CLEAN

OTcreator

Active Member
Joined
Feb 14, 2022
Messages
425
Solutions
1
Reaction score
44
Hello!
Is it possible to create a script and add as in older TFS to make, for example, clean happen at 12:00?
In TFS 1.4 I do not see a script responsible for cleaning the map in globalevents...
 
Solution
Do you have Server Save script on interval?
in globalevents/scripts add a serverave.lua
Lua:
local shutdownAtServerSave = false  -- leave true if you want to shut down the server
local cleanMapAtServerSave = false   -- leave true if you want to clear the map

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

    if cleanMapAtServerSave then
        cleanMap()
    end

    saveServer()
end

local function secondServerSaveWarning()
    Game.broadcastMessage('Server is saving game in one minute. Please go to a safe place.', MESSAGE_STATUS_WARNING)
    addEvent(serverSave, 60000)
end

local function...
This link that I tested is functional and perfect. I'm also using TFS 1.4.2.

Do you have Server Save script on interval?
 
Do you have Server Save script on interval?
in globalevents/scripts add a serverave.lua
Lua:
local shutdownAtServerSave = false  -- leave true if you want to shut down the server
local cleanMapAtServerSave = false   -- leave true if you want to clear the map

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

    if cleanMapAtServerSave then
        cleanMap()
    end

    saveServer()
end

local function secondServerSaveWarning()
    Game.broadcastMessage('Server is saving game in one minute. Please go to a safe place.', MESSAGE_STATUS_WARNING)
    addEvent(serverSave, 60000)
end

local function firstServerSaveWarning()
    Game.broadcastMessage('Server is saving game in 3 minutes. Please go to a safe place.', MESSAGE_STATUS_WARNING)
    addEvent(secondServerSaveWarning, 120000)
end

function onTime(interval)
    Game.broadcastMessage('Server is saving game in 5 minutes. Please go to a safe place.', MESSAGE_STATUS_WARNING)
    Game.setGameState(GAME_STATE_STARTUP)
    addEvent(firstServerSaveWarning, 120000)
    return not shutdownAtServerSave
end
in globalevents.xml
XML:
<globalevent name="ServerSave" interval="1800000" script="serversave.lua" />
f you activate the option to turn off the server, instead of interval="1800000" put time="04:55:00"
 
Solution
Back
Top