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

REQUEST - GlobalEvent - ServerSave

chaotical

New Member
Joined
Jan 3, 2008
Messages
302
Reaction score
0
Location
Tokyo
I am using TFS 1.0 and I am looking for a working script that saves the server every 10 minutes without broadcasting. Thank you in advance!
 
Code:
local shutdownAtServerSave = false
local cleanMapAtServerSave = false

local function serverSave()
    if shutdownAtServerSave then
        Game.setGameState(GAME_STATE_SHUTDOWN)
    end
   
    if cleanMapAtServerSave then
        cleanMap()
    end
   
    saveServer()
    Game.setGameState(GAME_STATE_NORMAL)
end


function onThink(interval)
    addEvent(serverSave, 1)
    return not shutdownAtServerSave
end
 
Code:
local shutdownAtServerSave = false
local cleanMapAtServerSave = false

local function serverSave()
    if shutdownAtServerSave then
        Game.setGameState(GAME_STATE_SHUTDOWN)
    end
  
    if cleanMapAtServerSave then
        cleanMap()
    end
  
    saveServer()
    Game.setGameState(GAME_STATE_NORMAL)
end


function onThink(interval)
    addEvent(serverSave, 1)
    return not shutdownAtServerSave
end


It is perfect! Thank you!
 
Back
Top