sscanf not working with mysql
#1

Hello..
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, 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?
Reply


Messages In This Thread
sscanf not working with mysql - by SaW_[VrTx] - 26.04.2011, 14:39
Re: sscanf not working with mysql - by Alby Fire - 26.04.2011, 14:56
Re: sscanf not working with mysql - by Aldo. - 26.04.2011, 15:29
Re: sscanf not working with mysql - by Alby Fire - 26.04.2011, 15:40
Re: sscanf not working with mysql - by [NoV]LaZ - 26.04.2011, 15:50
Re: sscanf not working with mysql - by MadeMan - 26.04.2011, 16:35
Re: sscanf not working with mysql - by JaTochNietDan - 26.04.2011, 16:37
Re: sscanf not working with mysql - by SaW_[VrTx] - 26.04.2011, 18:48
Re: sscanf not working with mysql - by Raimis_R - 26.04.2011, 18:55

Forum Jump:


Users browsing this thread: 1 Guest(s)