• 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.x Error when add player in vip

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
My server is possible to log 2 players on the same account.
for example, the account has 2 players:
Player A and Player B.

Reproducing a bug:
All players from this account are online (player A and player B).
Player A add Player C in your vip.
PLayer B add Player C in your vip.

as the vip list is the same for players on the same account, the error occurs
Lua:
[Error - mysql_real_query] Query: INSERT INTO `account_viplist` (`account_id`, `player_id`) VALUES (476,1010)
Message: Duplicate entry '476-1010' for key 'account_player_index'

code:
iologindata.cpp
C++:
void IOLoginData::addVIPEntry(uint32_t accountId, uint32_t guid)
{
    Database& db = Database::getInstance();

    std::ostringstream query;
    query << "INSERT INTO `account_viplist` (`account_id`, `player_id`) VALUES (" << accountId << ',' << guid << ')';
    db.executeQuery(query.str());
}

player.cpp
C:
bool Player::addVIP(uint32_t vipGuid, const std::string& vipName, VipStatus_t status)
{
    if (VIPList.size() >= getMaxVIPEntries() || VIPList.size() == 200) { // max number of buddies is 200 in 9.53
        sendTextMessage(MESSAGE_STATUS_SMALL, "You cannot add more buddies.");
        return false;
    }

    auto result = VIPList.insert(vipGuid);
    if (!result.second) {
        sendTextMessage(MESSAGE_STATUS_SMALL, "This player is already in your list.");
        return false;
    }

    IOLoginData::addVIPEntry(accountNumber, vipGuid);
    if (client) {
        client->sendVIP(vipGuid, vipName, status);
    }
    return true;
}
 
Last edited:
This database schema and server code does not allow to login 2 players from same account in same time.
I use it this way for a long time, the only problem I have until today is that of the vip list.
I thought it would be possible to fix it.
but apparently there is no correction, due to the structure that was not made to work this way
 
This error appeared for me today. What is this about? Using TFS 1.5 downgraded by Nekiro (8.60)
Is this a critical error? Something to care about? I understand what gesior said, but I want to be sure that I shouldn't be warned about it.

asd.png
 
Back
Top