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

C++ Onlinetime nood work right

Engradiel

Member
Joined
May 3, 2009
Messages
150
Reaction score
14
Location
Brazil
Hello friends, the onlinetime functionality that should get the top when you log in and the time when you log out or when you die doesn't work well. A few characters bug when they exit or save in some way. I've been at this for months and it continues to bug.Can anyone help me?

C++:
void IOLoginData::updateOnlineTime(Player* player, std::ostringstream& query)
{
    if (!player || player->isOffline()) {
        return;
    }

    time_t currentTime = time(nullptr);

    uint32_t onlineMinutes = static_cast<uint32_t>((currentTime - player->lastLoginSaved) / 60);


    query << "`onlinetime` = `onlinetime` + " << onlineMinutes << ',';

    // removido para testes
    //player->lastLoginSaved = currentTime;
}
 
u r probably looking at the wrong place. code above seens just fine, i think that the code is not updating the lastLoginSaved itself in some place it should do this... it's just a guess without access to your source, but try searching for "lastLoginSaved" and for updateOnlineTime's call hierarchy
 
Last edited:
Back
Top