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

command shutdown tfs 1.0

/closeserver shutdown
shutdown 5 and server restart in 5 minutes
/closerver shutdown (cant add time)
like
/shutdown 5
and message server is restarting 5minutes please logut
server is restarting 4minutes please logout
server is restarting 3minutes please logout
server is restarting 2minutes please loguot
server is restarting 1minutes please loguot
and when minutes 0 server restarting and automatic save
 
Well you use the shutdown command.. then let an external program restart the program for you.
Here's the program I've used in the past.
https://goo.gl/MiEWN4 -- download
https://goo.gl/DQGt0a -- Virus Total for Website
https://goo.gl/nxxEXu -- Virus Total for File

edit --
Apparently google url shortner has a conflict with terms of use for downloadable content?

anyways here's the direct link for the download
http://1drv.ms/1j4NVry
 
Last edited:
Code:
local function shutdownServer()
    Game.setGameState(GAME_STATE_SHUTDOWN)
end

local function shutdownMessage(timeLeft)
    if timeLeft == 1 then
        broadcastMessage("Server is going down in 1 minute. Please logout.", MESSAGE_STATUS_WARNING)

        addEvent(shutdownServer, 1 * 60 * 1000)
        return
    end

    broadcastMessage("Server is going down in ".. timeLeft .." minutes. Please logout.", MESSAGE_STATUS_WARNING)
    shutdownEvent = addEvent(shutdownMessage, 1 * 60 * 1000, timeLeft - 1)

end

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

    if param == "kill" then
        os.exit()
        return false
    end

    if SHUTDOWN_STATE then
        if param == "cancel" or param == "stop" then
            broadcastMessage("Shutdown event has been stopped. Sorry for the inconvenience.", MESSAGE_STATUS_WARNING)
            SHUTDOWN_STATE = false
            stopEvent(shutdownEvent)
        else     
            player:sendCancelMessage("Server is already in a shutdown state. To cancel shutdown use the \"/shutdown stop\" command.")
        end
      
        return false
    end 

    local number = tonumber(param)
    if not number then
        player:sendCancelMessage("Numeric param may not be lower than 0.")
        return false
    end
 
    if number == 0 then
        shutdownServer()
        return false
    end  

    shutdownMessage(number)
    SHUTDOWN_STATE = true
    return false
end
 
Last edited:
Code:
local function shutdownServer()
    Game.setGameState(GAME_STATE_SHUTDOWN)
end

local function shutdownMessage(timeLeft)
    if timeLeft == 1 then
        broadcastMessage("Server is going down in 1 minute. Please logout.", MESSAGE_STATUS_WARNING)

        addEvent(shutdownServer, 1 * 60 * 1000)
        return
    end

    broadcastMessage("Server is going down in ".. timeLeft .." minutes. Please logout.", MESSAGE_STATUS_WARNING)
  
    shutdownEvent = addEvent(shutdownMessage, 1 * 60 * 1000, timeLeft - 1)

end

function onSay(player, words, param)
    local number = tonumber(param)
    if number then
        if number == 0 then
            shutdownServer()
            return false
        end
    end

    if Game.getGameState() == GAME_STATE_CLOSED then
        if param ~= "" then
            if param == "cancel" or param == "stop" then
                broadcastMessage("Shutdown event has been stopped. Sorry for the inconvenience.", MESSAGE_STATUS_WARNING)

                Game.setGameState(GAME_STATE_NORMAL)
                stopEvent(shutdownEvent)
            elseif param == "kill" then
                os.exit()
            end

            return false
        end          

        player:sendCancelMessage("Server is already in a shutdown state. To cancel shutdown use the \"/shutdown stop\" command.")
        return false
    end      

    shutdownMessage(number)
    Game.setGameState(GAME_STATE_CLOSED)
    return false
end
error
Screen_Shot_10_14_15_at_07_30_AM.png


Use the command @Tarek1337 said and create a shell script that handles the restart.

Code:
while true; do ./tfs; done
can you explain im newbie
 
Back
Top