• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[REQUEST] Talkaction shutdown server after 5 min

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,758
Solutions
127
Reaction score
2,277
Hello, i have request i need talkaction to shutdown server after 5 minutes, something like server save :p

Server is going to restart in 5,3,1 minute and save server then restart.
 
I didn't tested, should work.
Code:
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)
   Game.setGameState(GAME_STATE_STARTUP)
   addEvent(firstServerSaveWarning, 120000)
   return not shutdownAtServerSave
end


function onSay(player, words, param)
  if not player:getGroup():getAccess() then
  return true
  end

  if player:getAccountType() < ACCOUNT_TYPE_GOD then
  return false
  end

   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
 
Back
Top