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

Compiling Help with Auto Save on TFS 0.4

suicunei

New Member
Joined
Jun 27, 2013
Messages
61
Solutions
1
Reaction score
2
Well guys, I've been searching for this feature on some TFS 0.4 in the internet, but I didn't find it, then, I'm here searching for help.

I asked for help in others forums that I won't quote them, but until now, none of them solved my problem, but the member @fireelement said that to add this function in my TFS 0.4 I need to edit the function called "shutdown" into the game.cpp archive... I don't know where to edit this etc, but there is my game.cpp archive:

https://notepad.cc/gunoicke49

I don't know another website to write the game.cpp code into, then, DO NOT EDIT THE CODE INSIDE THAT LINK, CREATE ANOTHER LINK PLEASE! THANK YOU ALL!
 
Do you only need a save function that saves the server after a certain time?
Then use a globalevent script (lua) instead of source editing:
Code:
local config = {
    broadcast = {120, 30},
    shallow = "no",
    delay = 120,
    events = 30
}

config.shallow = getBooleanFromString(config.shallow)

local function executeSave(seconds)
    if(isInArray(config.broadcast, seconds)) then
        local text = ""
        if(not config.shallow) then
            text = "Full s"
        else
            text = "S"
        end

        text = text .. "erver save within " .. seconds .. " seconds, please mind it may freeze!"
        doBroadcastMessage(text)
    end

    if(seconds > 0) then
        addEvent(executeSave, config.events * 1000, seconds - config.events)
    else
        doSaveServer(config.shallow)
    end
end

function onThink(interval, lastExecution, thinkInterval)
    if(table.maxn(config.broadcast) == 0) then
        doSaveServer(config.shallow)
    else
        executeSave(config.delay)
    end

    return true
end


Save already exists in the sources.
 
Do you only need a save function that saves the server after a certain time?
Then use a globalevent script (lua) instead of source editing:
Code:
local config = {
    broadcast = {120, 30},
    shallow = "no",
    delay = 120,
    events = 30
}

config.shallow = getBooleanFromString(config.shallow)

local function executeSave(seconds)
    if(isInArray(config.broadcast, seconds)) then
        local text = ""
        if(not config.shallow) then
            text = "Full s"
        else
            text = "S"
        end

        text = text .. "erver save within " .. seconds .. " seconds, please mind it may freeze!"
        doBroadcastMessage(text)
    end

    if(seconds > 0) then
        addEvent(executeSave, config.events * 1000, seconds - config.events)
    else
        doSaveServer(config.shallow)
    end
end

function onThink(interval, lastExecution, thinkInterval)
    if(table.maxn(config.broadcast) == 0) then
        doSaveServer(config.shallow)
    else
        executeSave(config.delay)
    end

    return true
end


Save already exists in the sources.


Noo, sorry if I didn't give the right info. Well, I need the save funciton into the TFS 0.4 as the GUI version, when you close a distro GUI, it saves de server automatically. Did you understand?
 
Back
Top