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

Looking for script to shutdown server TFS1.2

GodSugar

New Member
Joined
Mar 5, 2024
Messages
17
Reaction score
0
Hello as in topic, looking for globalevents lua script which will make serversave and will close server everyday on same hour. Mine is actually not shouting down server it make only save. TFS,1.2
local shutdownAtServerSave = false
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. Please logout.", MESSAGE_STATUS_WARNING)
addEvent(serverSave, 60000)
end

local function firstServerSaveWarning()
broadcastMessage("Server is saving game in 3 minutes. Please logout.", MESSAGE_STATUS_WARNING)
addEvent(secondServerSaveWarning, 120000)
end

function onTime(interval)
broadcastMessage("Server is saving game in 5 minutes. Please logout.", MESSAGE_STATUS_WARNING)
Game.setGameState(GAME_STATE_STARTUP)
addEvent(firstServerSaveWarning, 120000)
return not shutdownAtServerSave
end
 
Did it and nothing happened it only close server to prevent login players it's not turning off the server

Lua:
local shutdownAtServerSave = true
local cleanMapAtServerSave = false

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. Please logout.", MESSAGE_STATUS_WARNING)
addEvent(serverSave, 60000)
end

local function firstServerSaveWarning()
broadcastMessage("Server is saving game in 3 minutes. Please logout.", MESSAGE_STATUS_WARNING)
addEvent(secondServerSaveWarning, 120000)
end

function onTime(interval)
broadcastMessage("Server is saving game in 5 minutes. Please logout.", MESSAGE_STATUS_WARNING)
addEvent(firstServerSaveWarning, 120000)
return not shutdownAtServerSave
end



Change your code to what I posted, and I added a file to restart your .exe if you use Windows to connect your server, open it and edit the name of your .exe where the word HERE is found and be happy I hope I helped.
 

Attachments

  • AUTO_RESTARTER.rar
    324 bytes · Views: 1 · VirusTotal
Back
Top