• 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 1.X+ exit after kill player and lose pk

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
931
Solutions
7
Reaction score
127
Location
Brazil
YouTube
caruniawikibr
I have a problem in TFS 1.5 when the player kills another and exits. Then 1 minute later, the player falls, whereas the character should stay for 15 minutes.
 
Solution
Hope it helps everyone with the same problem.

Diff:
diff --git a/src/player.cpp b/src/player.cpp
index aa728d2..e4f9a03 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -940,11 +940,7 @@ void Player::sendPing()
     }
 
     int32_t noPongKickTime = vocation->getNoPongKickTime();
-    if (pzLocked && noPongKickTime < 60000) {
-        noPongKickTime = 60000;
-    }
-
-    if (noPongTime >= noPongKickTime) {
+    if (!pzLocked && noPongTime >= noPongKickTime) {
         if (isConnecting || getTile()->hasFlag(TILESTATE_NOLOGOUT)) {
             return;
         }
@@ -953,7 +949,7 @@ void Player::sendPing()
             return;
         }
 
-        if (client) {
+        if (client && client->getIP() != 0) {...
Last edited:
Code:
[Error - mysql_real_query] Query: INSERT INTO `account_bans`
(`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`)
VALUES (4, 'Too many unjustified kills', 1710725427, 1713317427, 1);
Message: Cannot add or update a child row: a
foreign key constraint fails
(`otserver`.`account_bans`, CONSTRAINT `account_bans_ibfk_2`
FOREIGN KEY (`banned_by`)
REFERENCES `players` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)

I also get this bug when I'm going to be banned, so I'm not banned anymore. :/
Post automatically merged:

Sounds like noPongKickTime, property noPongKickTime in data/XML/vocations.xml or default 60000.
You can write some custom onLogout creatureEvent script that'd do some additional checks and make it return false in such cases.


C++:
    if (pzLocked && noPongKickTime < 60000) {
        noPongKickTime = 60000;
    }

Post automatically merged:

the problem is that I have a lot of things related to frags etc.. like the frag counter, the frags with old tibia system, and I also implemented the rule violation, so I don't know where these 2 errors come from.
Post automatically merged:

the pz is leaving quickly, the player can fall while he is pz, I have problems with banning if I kill too many. Looks like I'm a little screwed up here


Post automatically merged:

My player.cpp

C++:
void Player::addUnjustifiedDead(const Player* attacked)
{
    if (hasFlag(PlayerFlag_NotGainInFight) || attacked == this || g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED) {
        return;
    }

    sendTextMessage(MESSAGE_STATUS_WARNING, "Warning! The murder of " + attacked->getName() + " was not justified.");

    // current unjustified kill!
    murderTimeStamps.push_back(std::time(nullptr));

    if (playerKillerEnd == 0) {
        // white skull time, it only sets on first kill!
        playerKillerEnd = std::time(nullptr) + g_config.getNumber(ConfigManager::WHITE_SKULL_TIME);
    }

    uint32_t murderResult = checkPlayerKilling();
    if (murderResult >= 1) {
        // red skull player
        playerKillerEnd = std::time(nullptr) + g_config.getNumber(ConfigManager::RED_SKULL_TIME);
        setSkull(SKULL_RED);

        if (murderResult == 2) {
            // banishment for too many unjustified kills
            Database& db = Database::getInstance();

            std::ostringstream ss;
            ss << "INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (";
            ss << getAccount() << ", ";
            ss << db.escapeString("Too many unjustified kills") << ", ";
            ss << std::time(nullptr) << ", ";
            ss << std::time(nullptr) + g_config.getNumber(ConfigManager::BAN_LENGTH) << ", ";
            ss << "1);";

            db.executeQuery(ss.str());

            g_game.addMagicEffect(getPosition(), CONST_ME_GREEN_RINGS);
            g_game.removeCreature(this);
            disconnect();
        }
    }
}

void Player::checkSkullTicks(int64_t ticks)
{
    time_t today = std::time(nullptr);

    if (!hasCondition(CONDITION_INFIGHT) && ((skull == SKULL_RED && today >= playerKillerEnd) || (skull == SKULL_WHITE))) {
        setSkull(SKULL_NONE);
    }
}

uint32_t Player::checkPlayerKilling()
{
    time_t today = std::time(nullptr);
    uint32_t lastDay = 0;
    uint32_t lastWeek = 0;
    uint32_t lastMonth = 0;
    uint64_t egibleMurders = 0;

    time_t dayTimestamp = today - (24 * 60 * 60);
    time_t weekTimestamp = today - (7 * 24 * 60 * 60);
    time_t monthTimestamp = today - (30 * 24 * 60 * 60);

    for (time_t currentMurderTimestamp : murderTimeStamps) {
        if (currentMurderTimestamp > dayTimestamp) {
            lastDay++;
        }

        if (currentMurderTimestamp > weekTimestamp) {
            lastWeek++;
        }

        egibleMurders = lastMonth + 1;

        if (currentMurderTimestamp <= monthTimestamp) {
            egibleMurders = lastMonth;
        }

        lastMonth = egibleMurders;
    }

    if (lastDay >= g_config.getNumber(ConfigManager::KILLS_DAY_BANISHMENT) ||
        lastWeek >= g_config.getNumber(ConfigManager::KILLS_WEEK_BANISHMENT) ||
        lastMonth >= g_config.getNumber(ConfigManager::KILLS_MONTH_BANISHMENT)) {
        return 2; // banishment!
    }

    if (lastDay >= g_config.getNumber(ConfigManager::KILLS_DAY_RED_SKULL) ||
        lastWeek >= g_config.getNumber(ConfigManager::KILLS_WEEK_RED_SKULL) ||
        lastMonth >= g_config.getNumber(ConfigManager::KILLS_MONTH_RED_SKULL)) {
        return 1; // red skull!
    }

    return 0;
}

playercpp original 1.5


C++:
void Player::addUnjustifiedDead(const Player* attacked)
{
    if (hasFlag(PlayerFlag_NotGainInFight) || attacked == this || g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED) {
        return;
    }

    sendTextMessage(MESSAGE_EVENT_ADVANCE, "Warning! The murder of " + attacked->getName() + " was not justified.");

    skullTicks += g_config.getNumber(ConfigManager::FRAG_TIME);

    if (getSkull() != SKULL_BLACK) {
        if (g_config.getNumber(ConfigManager::KILLS_TO_BLACK) != 0 &&
            skullTicks > (g_config.getNumber(ConfigManager::KILLS_TO_BLACK) - 1) *
                             static_cast<int64_t>(g_config.getNumber(ConfigManager::FRAG_TIME))) {
            setSkull(SKULL_BLACK);
        } else if (getSkull() != SKULL_RED && g_config.getNumber(ConfigManager::KILLS_TO_RED) != 0 &&
                   skullTicks > (g_config.getNumber(ConfigManager::KILLS_TO_RED) - 1) *
                                    static_cast<int64_t>(g_config.getNumber(ConfigManager::FRAG_TIME))) {
            setSkull(SKULL_RED);
        }
    }
}

void Player::checkSkullTicks(int64_t ticks)
{
    int64_t newTicks = skullTicks - ticks;
    if (newTicks < 0) {
        skullTicks = 0;
    } else {
        skullTicks = newTicks;
    }

    if ((skull == SKULL_RED || skull == SKULL_BLACK) && skullTicks < 1 && !hasCondition(CONDITION_INFIGHT)) {
        setSkull(SKULL_NONE);
    }
}
Post automatically merged:

ban problem solved! You need to have a gm level 6 player with an ID number to ban. the problem now is the protect zone and the kick when I get a kill.

1710728065182.png


I don't know how to resolve this. I don't understand why the player loses pz quickly, and can exit pz and be able to log out.
 
Last edited:
Code:
[Error - mysql_real_query] Query: INSERT INTO `account_bans`
(`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`)
VALUES (4, 'Too many unjustified kills', 1710725427, 1713317427, 1);
Message: Cannot add or update a child row: a
foreign key constraint fails
(`otserver`.`account_bans`, CONSTRAINT `account_bans_ibfk_2`
FOREIGN KEY (`banned_by`)
REFERENCES `players` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)

I also get this bug when I'm going to be banned, so I'm not banned anymore. :/
Post automatically merged:



Post automatically merged:

the problem is that I have a lot of things related to frags etc.. like the frag counter, the frags with old tibia system, and I also implemented the rule violation, so I don't know where these 2 errors come from.
Post automatically merged:

the pz is leaving quickly, the player can fall while he is pz, I have problems with banning if I kill too many. Looks like I'm a little screwed up here


Post automatically merged:

My player.cpp

C++:
void Player::addUnjustifiedDead(const Player* attacked)
{
    if (hasFlag(PlayerFlag_NotGainInFight) || attacked == this || g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED) {
        return;
    }

    sendTextMessage(MESSAGE_STATUS_WARNING, "Warning! The murder of " + attacked->getName() + " was not justified.");

    // current unjustified kill!
    murderTimeStamps.push_back(std::time(nullptr));

    if (playerKillerEnd == 0) {
        // white skull time, it only sets on first kill!
        playerKillerEnd = std::time(nullptr) + g_config.getNumber(ConfigManager::WHITE_SKULL_TIME);
    }

    uint32_t murderResult = checkPlayerKilling();
    if (murderResult >= 1) {
        // red skull player
        playerKillerEnd = std::time(nullptr) + g_config.getNumber(ConfigManager::RED_SKULL_TIME);
        setSkull(SKULL_RED);

        if (murderResult == 2) {
            // banishment for too many unjustified kills
            Database& db = Database::getInstance();

            std::ostringstream ss;
            ss << "INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (";
            ss << getAccount() << ", ";
            ss << db.escapeString("Too many unjustified kills") << ", ";
            ss << std::time(nullptr) << ", ";
            ss << std::time(nullptr) + g_config.getNumber(ConfigManager::BAN_LENGTH) << ", ";
            ss << "1);";

            db.executeQuery(ss.str());

            g_game.addMagicEffect(getPosition(), CONST_ME_GREEN_RINGS);
            g_game.removeCreature(this);
            disconnect();
        }
    }
}

void Player::checkSkullTicks(int64_t ticks)
{
    time_t today = std::time(nullptr);

    if (!hasCondition(CONDITION_INFIGHT) && ((skull == SKULL_RED && today >= playerKillerEnd) || (skull == SKULL_WHITE))) {
        setSkull(SKULL_NONE);
    }
}

uint32_t Player::checkPlayerKilling()
{
    time_t today = std::time(nullptr);
    uint32_t lastDay = 0;
    uint32_t lastWeek = 0;
    uint32_t lastMonth = 0;
    uint64_t egibleMurders = 0;

    time_t dayTimestamp = today - (24 * 60 * 60);
    time_t weekTimestamp = today - (7 * 24 * 60 * 60);
    time_t monthTimestamp = today - (30 * 24 * 60 * 60);

    for (time_t currentMurderTimestamp : murderTimeStamps) {
        if (currentMurderTimestamp > dayTimestamp) {
            lastDay++;
        }

        if (currentMurderTimestamp > weekTimestamp) {
            lastWeek++;
        }

        egibleMurders = lastMonth + 1;

        if (currentMurderTimestamp <= monthTimestamp) {
            egibleMurders = lastMonth;
        }

        lastMonth = egibleMurders;
    }

    if (lastDay >= g_config.getNumber(ConfigManager::KILLS_DAY_BANISHMENT) ||
        lastWeek >= g_config.getNumber(ConfigManager::KILLS_WEEK_BANISHMENT) ||
        lastMonth >= g_config.getNumber(ConfigManager::KILLS_MONTH_BANISHMENT)) {
        return 2; // banishment!
    }

    if (lastDay >= g_config.getNumber(ConfigManager::KILLS_DAY_RED_SKULL) ||
        lastWeek >= g_config.getNumber(ConfigManager::KILLS_WEEK_RED_SKULL) ||
        lastMonth >= g_config.getNumber(ConfigManager::KILLS_MONTH_RED_SKULL)) {
        return 1; // red skull!
    }

    return 0;
}

playercpp original 1.5


C++:
void Player::addUnjustifiedDead(const Player* attacked)
{
    if (hasFlag(PlayerFlag_NotGainInFight) || attacked == this || g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED) {
        return;
    }

    sendTextMessage(MESSAGE_EVENT_ADVANCE, "Warning! The murder of " + attacked->getName() + " was not justified.");

    skullTicks += g_config.getNumber(ConfigManager::FRAG_TIME);

    if (getSkull() != SKULL_BLACK) {
        if (g_config.getNumber(ConfigManager::KILLS_TO_BLACK) != 0 &&
            skullTicks > (g_config.getNumber(ConfigManager::KILLS_TO_BLACK) - 1) *
                             static_cast<int64_t>(g_config.getNumber(ConfigManager::FRAG_TIME))) {
            setSkull(SKULL_BLACK);
        } else if (getSkull() != SKULL_RED && g_config.getNumber(ConfigManager::KILLS_TO_RED) != 0 &&
                   skullTicks > (g_config.getNumber(ConfigManager::KILLS_TO_RED) - 1) *
                                    static_cast<int64_t>(g_config.getNumber(ConfigManager::FRAG_TIME))) {
            setSkull(SKULL_RED);
        }
    }
}

void Player::checkSkullTicks(int64_t ticks)
{
    int64_t newTicks = skullTicks - ticks;
    if (newTicks < 0) {
        skullTicks = 0;
    } else {
        skullTicks = newTicks;
    }

    if ((skull == SKULL_RED || skull == SKULL_BLACK) && skullTicks < 1 && !hasCondition(CONDITION_INFIGHT)) {
        setSkull(SKULL_NONE);
    }
}
Post automatically merged:

ban problem solved! You need to have a gm level 6 player with an ID number to ban. the problem now is the protect zone and the kick when I get a kill.

View attachment 83056


I don't know how to resolve this. I don't understand why the player loses pz quickly, and can exit pz and be able to log out.
The problem is related to the code inserting a row with banned_by set to 1 for an automated excessive frag ban.
You got that error because you have no player with the id of 1.

Make a player with the database row id of 1 called "the system".
Then anytime someone gets an automatic excessive frag ban, it will say:
Your account has been banned until 16 Apr 2024 by the system.
 
Make a player with the database row id of 1 called "the system".
Then it will say:
Your account has been banned until 16 Apr 2024 by the system.
I solved it. The problem now lies with the player when he takes the frag and loses his skull quickly. The time is wrong, I don't know why the time is normal.
23:55 Warning! The murder of Kin on Carunia was not justified.
exit....
23:56 character logout... and lose skull.

config.lua
timeToDecreaseFrags = 24 * 60 * 60
whiteSkullTime = 15 * 60
pzLocked = 60000
Post automatically merged:

and my player.cpp unjust


Lua:
void Player::addUnjustifiedDead(const Player* attacked)
{
    if (hasFlag(PlayerFlag_NotGainInFight) || attacked == this || g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED) {
        return;
    }

    sendTextMessage(MESSAGE_STATUS_WARNING, "Warning! The murder of " + attacked->getName() + " was not justified.");
   
    // current unjustified kill!
    murderTimeStamps.push_back(std::time(nullptr));
 
    if (playerKillerEnd == 0) {
        // white skull time, it only sets on first kill!
        playerKillerEnd = std::time(nullptr) + g_config.getNumber(ConfigManager::WHITE_SKULL_TIME);
    }

    uint32_t murderResult = checkPlayerKilling();
    if (murderResult >= 1) {
        // red skull player
        playerKillerEnd = std::time(nullptr) + g_config.getNumber(ConfigManager::RED_SKULL_TIME);
        setSkull(SKULL_RED);

        if (murderResult == 2) {
            // banishment for too many unjustified kills
            Database& db = Database::getInstance();

            std::ostringstream ss;
            ss << "INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (";
            ss << getAccount() << ", ";
            ss << db.escapeString("Too many unjustified kills") << ", ";
            ss << std::time(nullptr) << ", ";
            ss << std::time(nullptr) + g_config.getNumber(ConfigManager::BAN_LENGTH) << ", ";
            ss << "1);";

            db.executeQuery(ss.str());

            g_game.addMagicEffect(getPosition(), CONST_ME_GREEN_RINGS);
            g_game.removeCreature(this);
            disconnect();
        }
    }
}



Lua:
bool Player::onKilledCreature(Creature* target, bool lastHit/* = true*/)
{
    bool unjustified = false;

    if (hasFlag(PlayerFlag_NotGenerateLoot)) {
        target->setDropLoot(false);
    }

    Creature::onKilledCreature(target, lastHit);

    Player* targetPlayer = target->getPlayer();
    if (!targetPlayer) {
        return false;
    }

    if (targetPlayer->getZone() == ZONE_PVP) {
        targetPlayer->setDropLoot(false);
        targetPlayer->setSkillLoss(false);
    } else if (!hasFlag(PlayerFlag_NotGainInFight) && !isPartner(targetPlayer)) {
        if (!Combat::isInPvpZone(this, targetPlayer) && hasAttacked(targetPlayer) && !targetPlayer->hasAttacked(this)  && targetPlayer != this) {
            if (targetPlayer->getSkull() == SKULL_NONE && !isInWar(targetPlayer)) {
                unjustified = true;
                if (lastHit) {
                    addUnjustifiedDead(targetPlayer);
                }
            }

            if (lastHit && hasCondition(CONDITION_INFIGHT)) {
                pzLocked = true;
                Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_INFIGHT, g_config.getNumber(ConfigManager::WHITE_SKULL_TIME) * 1000, 0);
                addCondition(condition);
            }
        }
    }

    return unjustified;
}
 
Last edited:
I solved it. The problem now lies with the player when he takes the frag and loses his skull quickly. The time is wrong, I don't know why the time is normal.
23:55 Warning! The murder of Kin on Carunia was not justified.
exit....
23:56 character logout... and lose skull.

config.lua
timeToDecreaseFrags = 24 * 60 * 60
whiteSkullTime = 15 * 60
pzLocked = 60000
Post automatically merged:

and my player.cpp unjust


Lua:
void Player::addUnjustifiedDead(const Player* attacked)
{
    if (hasFlag(PlayerFlag_NotGainInFight) || attacked == this || g_game.getWorldType() == WORLD_TYPE_PVP_ENFORCED) {
        return;
    }

    sendTextMessage(MESSAGE_STATUS_WARNING, "Warning! The murder of " + attacked->getName() + " was not justified.");
   
    // current unjustified kill!
    murderTimeStamps.push_back(std::time(nullptr));
 
    if (playerKillerEnd == 0) {
        // white skull time, it only sets on first kill!
        playerKillerEnd = std::time(nullptr) + g_config.getNumber(ConfigManager::WHITE_SKULL_TIME);
    }

    uint32_t murderResult = checkPlayerKilling();
    if (murderResult >= 1) {
        // red skull player
        playerKillerEnd = std::time(nullptr) + g_config.getNumber(ConfigManager::RED_SKULL_TIME);
        setSkull(SKULL_RED);

        if (murderResult == 2) {
            // banishment for too many unjustified kills
            Database& db = Database::getInstance();

            std::ostringstream ss;
            ss << "INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (";
            ss << getAccount() << ", ";
            ss << db.escapeString("Too many unjustified kills") << ", ";
            ss << std::time(nullptr) << ", ";
            ss << std::time(nullptr) + g_config.getNumber(ConfigManager::BAN_LENGTH) << ", ";
            ss << "1);";

            db.executeQuery(ss.str());

            g_game.addMagicEffect(getPosition(), CONST_ME_GREEN_RINGS);
            g_game.removeCreature(this);
            disconnect();
        }
    }
}
what do you have set as your white skull time in config
 
whiteSkullTime = 15 * 60
pzLocked = 60000

that's not answering my question............
Lua:
void Player::sendPing()
{
    int64_t timeNow = OTSYS_TIME();

    bool hasLostConnection = false;
    if ((timeNow - lastPing) >= 5000) {
        lastPing = timeNow;
        if (client) {
            client->sendPing();
        } else {
            hasLostConnection = true;
        }
    }

    int64_t noPongTime = timeNow - lastPong;
    if ((hasLostConnection || noPongTime >= 7000) && attackedCreature && attackedCreature->getPlayer()) {
        setAttackedCreature(nullptr);
    }

    int32_t noPongKickTime = vocation->getNoPongKickTime();
    if (pzLocked && noPongKickTime < 60000) {
        noPongKickTime = 60000;
    }

    if (noPongTime >= noPongKickTime) {
        if (isConnecting || getTile()->hasFlag(TILESTATE_NOLOGOUT)) {
            return;
        }

        if (!g_creatureEvents->playerLogout(this)) {
            return;
        }

        if (client) {
            client->logout(true, true);
        } else {
            g_game.removeCreature(this, true);
        }
    }
}
 
whiteSkullTime = 15 * 60
pzLocked = 60000


Lua:
void Player::sendPing()
{
    int64_t timeNow = OTSYS_TIME();

    bool hasLostConnection = false;
    if ((timeNow - lastPing) >= 5000) {
        lastPing = timeNow;
        if (client) {
            client->sendPing();
        } else {
            hasLostConnection = true;
        }
    }

    int64_t noPongTime = timeNow - lastPong;
    if ((hasLostConnection || noPongTime >= 7000) && attackedCreature && attackedCreature->getPlayer()) {
        setAttackedCreature(nullptr);
    }

    int32_t noPongKickTime = vocation->getNoPongKickTime();
    if (pzLocked && noPongKickTime < 60000) {
        noPongKickTime = 60000;
    }

    if (noPongTime >= noPongKickTime) {
        if (isConnecting || getTile()->hasFlag(TILESTATE_NOLOGOUT)) {
            return;
        }

        if (!g_creatureEvents->playerLogout(this)) {
            return;
        }

        if (client) {
            client->logout(true, true);
        } else {
            g_game.removeCreature(this, true);
        }
    }
}
In Player::addUnjustifiedDead
Looks like you can remove this, its only really used for red skull,
your ticks are looking at the infight condition to remove the white skull, and that looks all fine.
C++:
if (playerKillerEnd == 0) {
    // white skull time, it only sets on first kill!
    playerKillerEnd = std::time(nullptr) + g_config.getNumber(ConfigManager::WHITE_SKULL_TIME);
}

So yeah, something else is removing the infight condition, could be a pong/logout issue...
 
i think the problem is
Lua:
sendTextMessage(MESSAGE_EVENT_ADVANCE, "Warning! The murder of " + attacked->getName() + " was not justified.");


    skullTicks += g_config.getNumber(ConfigManager::FRAG_TIME);

but my code is
Lua:
sendTextMessage(MESSAGE_STATUS_WARNING, "Warning! The murder of " + attacked->getName() + " was not justified.");


    // current unjustified kill!
    murderTimeStamps.push_back(std::time(nullptr));
Post automatically merged:

After exiting, in just 1 minute I lose pk and the character disappears. If anyone can help me I would appreciate it.
Post automatically merged:

I'm testing it, and I saw that the pk respects it while I'm on the character, now I need to find out where the setting is when force logout (exit)

the problem is right there.
 
Last edited:
Hope it helps everyone with the same problem.

Diff:
diff --git a/src/player.cpp b/src/player.cpp
index aa728d2..e4f9a03 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -940,11 +940,7 @@ void Player::sendPing()
     }
 
     int32_t noPongKickTime = vocation->getNoPongKickTime();
-    if (pzLocked && noPongKickTime < 60000) {
-        noPongKickTime = 60000;
-    }
-
-    if (noPongTime >= noPongKickTime) {
+    if (!pzLocked && noPongTime >= noPongKickTime) {
         if (isConnecting || getTile()->hasFlag(TILESTATE_NOLOGOUT)) {
             return;
         }
@@ -953,7 +949,7 @@ void Player::sendPing()
             return;
         }
 
-        if (client) {
+        if (client && client->getIP() != 0) {
             client->logout(true, true);
         } else {
             g_game.removeCreature(this, true);
diff --git a/src/protocolgame.cpp b/src/protocolgame.cpp
index 82f49be..63c4a41 100644
--- a/src/protocolgame.cpp
+++ b/src/protocolgame.cpp
@@ -355,6 +355,7 @@ void ProtocolGame::connect(uint32_t playerId, OperatingSystem_t operatingSystem)
     g_chat->removeUserFromAllChannels(*player);
     player->setOperatingSystem(operatingSystem);
     player->isConnecting = false;
+    player->lastPong = OTSYS_TIME();
 
     player->client->setOwner(getThis());
     sendAddCreature(player, player->getPosition(), 0, false);
 
Solution
I wanted to take advantage of you Roddet, who is a moderator, and could you tell me why I can't select the solution options. I've been trying to make an appointment for a while now and I haven't been able to, I think it's been more than a year.
1710763552365.png
 
I wanted to take advantage of you Roddet, who is a moderator, and could you tell me why I can't select the solution options. I've been trying to make an appointment for a while now and I haven't been able to, I think it's been more than a year.
View attachment 83066
If the script only solves the problem, then mark it as 'up' and comment/uncover at the same time, for example, 'thank you, working perfectly 100%,' etc. Then wait a few minutes or hours; a moderator or administrator will see your comment and be happy that it was a solution provided by someone who helped you, and will mark it as a solution. Done!
 
Back
Top