18.07.2016, 10:03
It is called race condition. The query finishes when the player has already disconnected and another player has connected. You should always have a check to important data and the only solution is to kick the player.
pawn Код:
// global:
new gPlayer_RaceCondition[MAX_PLAYERS];
// OnPlayerConnect:
gPlayer_RaceCondition[playerid]++;
...
mysql_tquery(mysql_handle_here, "...", "callback_here", "ii", playerid, gPlayer_RaceCondition[playerid]);
// OnPlayerDisconnect
gPlayer_RaceCondition[playerid]++;
// in the callbacks specified in mysql_tquery and race condition was passed as argument:
forward callback_here(playerid, race_check);
public callback_here(playerid, race_check)
{
if (race_check != gPlayer_RaceCondition[playerid])
{
// kick the player
}
// code for retrieving the data
}