Stats sometimes get reset - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Stats sometimes get reset (
/showthread.php?tid=164949)
Stats sometimes get reset -
Saurik - 02.08.2010
Well i ran into a bug where sometimes stats reset. Idk it really never happened to my account but it does happen to others.
Sometimes the stats get reset and adminlevel and score get reset to 0 when a person logs in...
I did add a function that is supposed to save the files [onplayerdisconnect]
Code:
stock OnPlayerAccountUpdate(playerid)
{
new string[128], mysqlud[256];
format(string,sizeof(string),"/accounts/%s.ini", ReturnName(playerid));
dini_IntSet(string, "Score", GetPlayerScore(playerid));
dini_IntSet(string, "Cash", GetPlayerMoney(playerid));
dini_IntSet(string, "Rank", PlayerInfo[playerid][Rank]);
dini_IntSet(string, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
dini_IntSet(string, "Hours", PlayerInfo[playerid][Hours]);
dini_IntSet(string, "Minutes", PlayerInfo[playerid][Minutes]);
dini_IntSet(string, "Seconds", PlayerInfo[playerid][Seconds]);
format(mysqlud,sizeof(mysqlud),"UPDATE `paccounts` SET `score` = '%d' `cash` = '%d' `rank` = '%d' `hours` = '%d' `mins` = '%d' `secs` = '%d' `adminlvl` = '%d' WHERE `name` = '%s'", GetPlayerScore(playerid), GetPlayerMoney(playerid), PlayerInfo[playerid][Rank], PlayerInfo[playerid][Hours], PlayerInfo[playerid][Minutes], PlayerInfo[playerid][Seconds], PlayerInfo[playerid][AdminLevel], ReturnName(playerid));
mysql_query(mysqlud);
return 1;
}
funny thing is that the kills / deaths always save.
Re: Stats sometimes get reset -
iLinx - 02.08.2010
This might be a simple idea, but are you reseting the adminlevel and score values in OnPlayerDisconnect before updating the account by any chance? I would imagine that would probably screw it up.
Re: Stats sometimes get reset -
Ash. - 02.08.2010
Quote:
Originally Posted by iLinx
This might be a simple idea, but are you reseting the adminlevel and score values in OnPlayerDisconnect before updating the account by any chance? I would imagine that would probably screw it up.
|
That. And check your MySQL Database Connection logs to see what data was being recieved (if you can) - then you can figure out where the problem lies, because MySQL might not be sending the correct data back