need help for saving player stats
#4

Quote:
Originally Posted by MrTinder
Посмотреть сообщение
Hi.I start using mysql but i have problem now.Server save only
pawn Код:
new string[1000];
        format(string, sizeof(string), "UPDATE Users SET Password='%s',Admin='%d',Money='%d', VIP='%d' WHERE Name='%s'", PlayerInfo[playerid][Password], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pCash], PlayerInfo[playerid][pDonateRank], PlayerInfo[playerid][Name]);
but my code is
pawn Код:
new string[1000];
        format(string, sizeof(string), "UPDATE Users SET Password='%s',Admin='%d',Money='%d', VIP='%d' WHERE Name='%s'", PlayerInfo[playerid][Password], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pCash], PlayerInfo[playerid][pDonateRank], PlayerInfo[playerid][Name]);
        format(string, sizeof(string), "UPDATE Users SET Banned='%d', Warnings='%d', Kills='%d', Deaths='%d' WHERE Name='%s'", PlayerInfo[playerid][pBanned], PlayerInfo[playerid][pWarns], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][Name]);
        format(string, sizeof(string), "UPDATE Users SET AdminDuty='%d', FactionMember='%d', FactionRank='%d' WHERE Name='%s'", PlayerInfo[playerid][aDuty], PlayerInfo[playerid][pMember], PlayerInfo[playerid][pRank], PlayerInfo[playerid][Name]);
        format(string, sizeof(string), "UPDATE Users SET Level='%d', Exp='%d', FactionRank='%d' WHERE Name='%s'", PlayerInfo[playerid][Level], PlayerInfo[playerid][Exp], PlayerInfo[playerid][pMember], PlayerInfo[playerid][pRank], PlayerInfo[playerid][Name]);
        mysql_query(string);
Where's the problem?
lol thats a simple mistake you forgot to call mysql_query after each format

You code should be like this
pawn Код:
new string[1000];
        format(string, sizeof(string), "UPDATE Users SET Password='%s',Admin='%d',Money='%d', VIP='%d' WHERE Name='%s'", PlayerInfo[playerid][Password], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pCash], PlayerInfo[playerid][pDonateRank], PlayerInfo[playerid][Name]);
mysql_query(string);
        format(string, sizeof(string), "UPDATE Users SET Banned='%d', Warnings='%d', Kills='%d', Deaths='%d' WHERE Name='%s'", PlayerInfo[playerid][pBanned], PlayerInfo[playerid][pWarns], PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][Name]);
mysql_query(string);
        format(string, sizeof(string), "UPDATE Users SET AdminDuty='%d', FactionMember='%d', FactionRank='%d' WHERE Name='%s'", PlayerInfo[playerid][aDuty], PlayerInfo[playerid][pMember], PlayerInfo[playerid][pRank], PlayerInfo[playerid][Name]);
mysql_query(string);
        format(string, sizeof(string), "UPDATE Users SET Level='%d', Exp='%d', FactionRank='%d' WHERE Name='%s'", PlayerInfo[playerid][Level], PlayerInfo[playerid][Exp], PlayerInfo[playerid][pMember], PlayerInfo[playerid][pRank], PlayerInfo[playerid][Name]);
        mysql_query(string);
And your string needn't be 1000 , reduce it to 200 or less.You are wasting precious memory.
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: 1 Guest(s)