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

Linux log out / death = server freeze

vlexip

New Member
Joined
Mar 10, 2011
Messages
5
Reaction score
0
When somebody die or log out server has a freeze. 3/4 logout ends freez, engine is tfs 0.4 tibia 8.6, somebody can help me?
 
Have you modified any code in any way? Did you add any scripts? Was there ever a time when this problem didn't exist?
 
I modified the engine for a long time, I've added a lot of scripts, hunting arena, war system, task system, and more. but I did not notice problems earlier. the server was tested with five players, but when i started ots, and plays on it 30+ players you can feel the freez. So I can not say when the problem occurred : ( anyone know where I can start to look for the cause?
 
I would start with all triggering scripts such as creaturescripts. Maybe you have any logout/death/kill scripts on your server? Try to switch off one after another and check if there still are lags on server. If lags would end - then you'll just need to fix this one script.
 
on creaturescripts.xml i got only:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
    <event type="login" name="PlayerLogin" event="script" value="login.lua"/>

    <event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
    <event type="receivemail" name="Mail" event="script" value="mail.lua"/>
    <event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
    <event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>

    <event type="think" name="Idle" event="script" value="idle.lua"/>
    <event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>
    <event type="kill" name="Kills" event="script" value="boss.lua"/>

    <event type="advance" name="Advanceitems1" event="script" value="item50.lua"/>
    <event type="advance" name="Advanceitems2" event="script" value="item100.lua"/>
    <event type="advance" name="Advanceitems3" event="script" value="item200.lua"/>
    <event type="advance" name="points1" event="script" value="points300.lua"/>
    <event type="advance" name="points2" event="script" value="points500.lua"/>
</creaturescripts>

and i think login.lua looking good:
Code:
local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

-- To dodajemy w miejsce słów function onLogin(cid)
local welcome = {
                  ON = true,
                  Access = 6,
                  Nr_text = MESSAGE_INFO_DESCR,
                  Nr_text_2 = MESSAGE_EVENT_ORANGE,
                  Storage = 9928
                }
local Login_number = true
------- config ----------
local antyMagebombEnabled = 1 
local maxClientsFromIp = 2 
local loginPeriodSeconds = 2 
local banAutoMagebombAccount = 1 
local banAutoMagebombIp = 1
local banAccountPeriod = 2 * 60 * 60
local banIpPeriod = 2 * 60 * 60
------- /config --------

local last_login = os.time(t)
local last_ipaddr = 0
local magebomb_count = 0
local last_guid = 0
local last_account = 0
function onLogin(cid)
if antyMagebombEnabled == 1 then   
    local now = os.time(t)
    local ip = getPlayerIp(cid)
    local guid = getPlayerGUID(cid)
    local gracz = getCreatureName(cid)
    local playeracc = getAccountIdByName(gracz)

    if(ip==last_ipaddr and last_guid ~= guid and last_account ~= playeracc) then
        if(last_login+loginPeriodSeconds > now) then
            magebomb_count = magebomb_count + 1
            if magebomb_count > 1 then
                if banAutoMagebombAccount == 1 then
                    doAddBanishment(playeracc, banAccountPeriod, 11, 2, 'Banished by AntyMagebomb System', 0)
                end
                if banAutoMagebombIp == 1 then
                    doAddIpBanishment(ip, 4294967295, banIpPeriod, "Detected by AntyMagebomb System")
                end
            end
            return FALSE -- wyrzuca z gry
        else
        magebomb_count = 0
        end
    else
        magebomb_count = 0
    end
   
    if maxClientsFromIp > 0 then
    local list = {}
    local ips = {}
    local players = getPlayersOnline()
    local i = 0
    for i, pid in ipairs(players) do
        local ip = getPlayerIp(pid)
        local name = getCreatureName(pid)
        local tmp = table.find(ips, ip)
        if(tmp ~= nil) then
            if(table.countElements(list, ip) == 0) then
                list[players[tmp]] = ip
            end

            list[pid] = ip
        end
    table.insert(ips, ip)
    end
        if(table.maxn(list) > 0) then
            for pid, ip in pairs(list) do
                if getPlayerIp(cid) == ip then
                    i=i+1
                end
            end
        end
       
        if i > maxClientsFromIp and maxClientsFromIp > 0 then -- sprawdzanie ilosci graczy z tym samym IP
            doPlayerPopupFYI(cid,'Sorry, only 3 multi-clients allowed (from one IP), not more!')
            return FALSE
        end
    end   
       
end

    last_ipaddr = getPlayerIp(cid)
    last_login = os.time(t)
    last_guid = getPlayerGUID(cid)
        last_account = playeracc
local names = getCreatureName(cid)
local welcome_2 = {
                  [0] = "Witam cie "..names,
                  [1] = "Witamy Spowrotem "..names..".  !",
                  }
if welcome.ON == true then
local sex = getPlayerSex(cid)
local char_storage = getPlayerStorageValue(cid, welcome.Storage)
    if char_storage == -1 then
      doPlayerSetStorageValue(cid, welcome.Storage, 1)
    else
      char_storage = char_storage + 1
      doPlayerSetStorageValue(cid, welcome.Storage, char_storage)
    end
if getPlayerAccess(cid) <= welcome.Access then
  doPlayerSendTextMessage(cid, welcome.Nr_text, welcome_2[sex])
  if Login_number == true then
      doPlayerSendTextMessage(cid, welcome.Nr_text_2, "Jest to Twoje "..char_storage.." logowanie")
  end
end
end

    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Idle")
    registerCreatureEvent(cid, "Advanceitems1")
registerCreatureEvent(cid, "Advanceitems2")
registerCreatureEvent(cid, "Advanceitems3")
    registerCreatureEvent(cid, "points1")
registerCreatureEvent(cid, "points2")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
    registerCreatureEvent(cid, 'Kills')
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")
    return true
end

I think the problem is in saving character after logout, where i can find script responsible for it?
 
Back
Top