22.02.2015, 21:40
Trying to get help for a friend who has an issue with MySQL
Alright so I followed newbienoob's tutorial a while ago and converted my script into mysql by it. Now after a while of using it, I noticed a problem in which if the player with ID 0 quit and the player with ID 1 quit and then came back with the ID 0, it would result them into wrong password.
I tested this 3 times and each time it happened, I quit from my ID 0 while my friend was ID 1 then he'd quit and rejoin right away to take over ID 0 and MySql would seem to fail at loading his password (maybe even his whole data). However in other circumstances the script works fine without any issues.
Disconnection:
Alright so I followed newbienoob's tutorial a while ago and converted my script into mysql by it. Now after a while of using it, I noticed a problem in which if the player with ID 0 quit and the player with ID 1 quit and then came back with the ID 0, it would result them into wrong password.
I tested this 3 times and each time it happened, I quit from my ID 0 while my friend was ID 1 then he'd quit and rejoin right away to take over ID 0 and MySql would seem to fail at loading his password (maybe even his whole data). However in other circumstances the script works fine without any issues.
Disconnection:
pawn Код:
forward SaveAccountStats(playerid);
public SaveAccountStats(playerid)
{
if(Logged[playerid] == 1)
{
new query[1024];
mysql_format(mysql, query, sizeof(query), "UPDATE `users` SET `Money`=%d, `Admin`=%d, `Vip`=%d, `Kills`=%d, `Deaths`=%d, `Score`=%d, `Rank`=%d, `Banned`=%d, `Warns`=%d, ",\
PlayerInfo[playerid][pMoney], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pVip] , PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pScore], PlayerInfo[playerid][pRank], PlayerInfo[playerid][pBanned],\
PlayerInfo[playerid][pWarns]);
mysql_format(mysql, query, sizeof(query), "%s`VW`=%d, `Interior`=%d, `Min`=%d, `Hours`=%d, `PM`=%d, `Color`=%d, `Turfs`=%d, `Clan`=%d, ",\
query, PlayerInfo[playerid][pVW], PlayerInfo[playerid][pInt], PlayerInfo[playerid][pMin], PlayerInfo[playerid][pHour], PlayerInfo[playerid][pPM], PlayerInfo[playerid][pColor], PlayerInfo[playerid][pTurfs], PlayerInfo[playerid][pClan]);
mysql_format(mysql, query, sizeof(query), "%s`ClRank`=%d, `ClLeader`=%d, `Invited`=%d, `Inviting`=%d WHERE `ID`=%d",\
query, PlayerInfo[playerid][pClRank], PlayerInfo[playerid][pClLeader], PlayerInfo[playerid][pInvited], PlayerInfo[playerid][pInviting], PlayerInfo[playerid][pID]);
mysql_tquery(mysql, query, "", "");
return 1;
}
return 0;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
SaveAccountStats(playerid);
Spawned[playerid] = 0;
MOTD[playerid] = 0;
gTeam[playerid] = 0;
KillStreak[playerid] = 0;
ABCheck[playerid] = 0;
KillTimer(timer[playerid]);
KillTimer(PlayTimer[playerid]);
return 1;
}