26.04.2011, 14:39
Hello..
Here's the script;
When player connects to server, Cash and all other stats are automacilly imposed to default (New user). When player logins, his stats are loaded from mysql DB and written to PlayerInfo[..].But here's the bug..
When player connects to server, his cash is 432$ (default, new user)
When player logins, server prints out that his cash is about 100000$ (print was before sscanf)
When sscanf updates PlayerInfo, his money is still 432$ (So do other stats) (format was after sscanf). Every time player logins, his stats are deleted. So sscanf doesn't change PlayerInfo's to new values. Why's that?
Here's the script;
pawn Код:
format(query2, 256, "SELECT cash,account,adminlevel,level,experience,upgradepoints,kills,gun1,gun2,gun3,ammo1,ammo2 FROM users WHERE username='%s'", playername2);
mysql_query(query2);
mysql_store_result(MySQL_Conn);
while(mysql_fetch_row_format(result, "|") == 1)
{
sscanf(result, "p<|>dddddddddddd",PlayerInfo[playerid][pCash],PlayerInfo[playerid][pAccount],PlayerInfo[playerid][pAdmin],PlayerInfo[playerid][pLevel],PlayerInfo[playerid][pExp],PlayerInfo[playerid][gPupgrade],PlayerInfo[playerid][pKills],PlayerInfo[playerid][pGun1],PlayerInfo[playerid][pGun2],PlayerInfo[playerid][pGun3],PlayerInfo[playerid][pAmmo1],PlayerInfo[playerid][pAmmo2]);
}
mysql_free_result(MySQL_Conn);
When player connects to server, his cash is 432$ (default, new user)
When player logins, server prints out that his cash is about 100000$ (print was before sscanf)
When sscanf updates PlayerInfo, his money is still 432$ (So do other stats) (format was after sscanf). Every time player logins, his stats are deleted. So sscanf doesn't change PlayerInfo's to new values. Why's that?