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

TFS 0.X Message after server saved

potinho

Intermediate OT User
Joined
Oct 11, 2009
Messages
1,397
Solutions
17
Reaction score
148
Location
Brazil
Hi guys,

I want to put a simple message after server saved, like (server saved), just for players know, where i put this message?

Lua:
local config = {
    broadcast = {120, 30},
    flags = 13,
    delay = 120,
    events = 30
}

local function executeSave(seconds)
    if(isInArray(config.broadcast, seconds)) then
        doBroadcastMessage("Server save within " .. seconds .. " seconds, please mind it may freeze!")
    end

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

function onThink(interval)
    if(table.maxn(config.broadcast) == 0) then
        doSaveServer(config.flags)
    else
        executeSave(config.delay)
    end

    return true
end

[CODE]
 
Below add
doBroadcastMessage("Fully saved server.")
For something precise, try:
C++:
Game.cpp - Game::saveGameState
below
C++:
std::clog << "> SAVE: Complete in " << (OTSYS_TIME() - start) / (1000.) << " seconds using " << storage << " house storage." << std::endl;
add
Code:
if (shallow) {
    broadcastMessage("Server saved...", MSG_STATUS_WARNING);
} else { // NOTE: full save is only called on close/shutdown server or /save talkaction - by doSaveServer(false) or doSaveServer()
    broadcastMessage("Full server saved...", MSG_STATUS_WARNING);
}

NOTE:
doSaveServer(full save? true or false)
u can use config.flags = true/false
 
Last edited:
Back
Top