need help for saving player stats
#2

Each time you format a string, you delete what was in it before. Try this:
pawn Код:
new string[1000];
format(string, sizeof(string), "UPDATE Users SET Password='%s',Admin='%d',Money='%d', VIP='%d'", PlayerInfo[playerid][Password], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pCash], PlayerInfo[playerid][pDonateRank]);
format(string, sizeof(string), "%s, Banned='%d', Warnings='%d', Kills='%d', Deaths='%d'", string, PlayerInfo[playerid][pBanned], PlayerInfo[playerid][pWarns], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths];
format(string, sizeof(string), "%s, AdminDuty='%d', FactionMember='%d', FactionRank='%d'", string, PlayerInfo[playerid][aDuty], PlayerInfo[playerid][pMember], PlayerInfo[playerid][pRank]);
format(string, sizeof(string), "%s, Level='%d', Exp='%d' WHERE Name='%s'", string, PlayerInfo[playerid][Level], PlayerInfo[playerid][Exp], PlayerInfo[playerid][pMember], PlayerInfo[playerid][Name]);
mysql_query(string);
It should work perfectly!
P.S: you were saving Faction Rank twice.
Also, don't use the methods below where the guy uses mysql_query four times, it's bad. It's very unnecessary. All you need to do is append the continuation to the string each time you reformat. See how I do it above. After that, you only need to use mysql_query once.
Reply


Messages In This Thread
need help for saving player stats - by MrTinder - 08.05.2013, 17:40
Re: need help for saving player stats - by silvohex - 08.05.2013, 19:14
Re: need help for saving player stats - by SKAzini - 08.05.2013, 19:17
Re: need help for saving player stats - by Yashas - 08.05.2013, 19:19
Re : need help for saving player stats - by DaTa[X] - 08.05.2013, 19:20
Re: need help for saving player stats - by MrTinder - 09.05.2013, 09:22

Forum Jump:


Users browsing this thread: 2 Guest(s)