22.02.2015, 22:26
pawn Code:
stock IsPlayerRegistered(playerid)
{
printf("CALLED BY ID : %d", playerid);
new query[128];
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `PLAYERS` WHERE `USERNAME` = '%e' LIMIT 1", PlayerName(playerid));
mysql_pquery(mysql, query, "OnPlayerAccountCheck", "dd", playerid, pData[playerid][P_MYSQL_RACE_CHECK]);
printf("%s", query);
inline OnPlayerAccountCheck(check)
{
if (check != pData[playerid][P_MYSQL_RACE_CHECK])
return KickPlayer(playerid, "MySQL race occured, please reconnect!");
if (cache_num_rows() > 0)
{
cache_get_field_content(0, "PASSWORD", pData[playerid][P_PASSWORD], mysql, 129);
ShowPlayerCustomDialog(playerid, 2);
BitFlag_On(fData[playerid], P_REGISTERED);
}
else
{
ShowPlayerCustomDialog(playerid, 1);
SendClientMessage(playerid, 0xA6D8A6FF, "New player? /help /rules /cmds");
GivePlayerMoney(playerid, 3000);
pData[playerid][P_MONEY] = 3000;
BitFlag_Off(fData[playerid], P_REGISTERED);
}
}
mysql_tquery_inline(mysql, query, using inline OnPlayerAccountCheck, "d", pData[playerid][P_MYSQL_RACE_CHECK]);
return 1;
}
I spent like 20 minutes to find the issue which pissed me off.