Stats sometimes get reset
#1

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.
Reply
#2

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.
Reply
#3

Quote:
Originally Posted by iLinx
View Post
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)