• 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+ Tfs 1.3 8.6 default source, bug in online players, after some time (rare bug)

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
hello, I'm using tfs 1.3 8.6 and there is a bug that happens rare (very rare)
there are 50 players playing and the site shows 50 for several days (ok).

but out of nowhere, someday, there are for example 50 players online and the site shows 40.
function website that count players online:

HTML:
function user_count_online() {
    $online = mysql_select_single("SELECT COUNT(`player_id`) AS `value` FROM `players_online`;");
    return ($online !== false) ? $online['value'] : 0;
}

the function is correct, the error is that the site in players_online, sometimes shows the wrong number.
has 50 online, but the players_online table, for some reason bugs and shows only 40

the error could then be in the source, in this function (remembering that the bug is very rare, it happens about 1 time every 10 or 15 days).
edit: I have the impression that bug when the site receives some attack Ddos, wich website down or stay very slow. Could this be it or am I wrong?
C++:
void IOLoginData::updateOnlineStatus(uint32_t guid, bool login)
{
    if (g_config.getBoolean(ConfigManager::ALLOW_CLONES)) {
        return;
    }

    std::ostringstream query;
    if (login) {
        query << "INSERT INTO `players_online` VALUES (" << guid << ')';
    } else {
        query << "DELETE FROM `players_online` WHERE `player_id` = " << guid;
    }
    Database::getInstance().executeQuery(query.str());
}
 
Back
Top