Score not updating (Mysql) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Score not updating (Mysql) (
/showthread.php?tid=608541)
Score not updating (Mysql) -
Deroxi - 02.06.2016
So for some reason the score of a player wont update to mysql:
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new
query[128],
Float:pos[4],
name[24],
score;
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerFacingAngle(playerid, pos[3]);
GetPlayerName(playerid, name, 24);
GetPlayerScore(playerid, Player[playerid][Score]);
mysql_format(mysql, query, sizeof(query), "UPDATE `accounts` SET `Money` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f, `PosA` = %f WHERE `ID` = %d",
GetPlayerMoney(playerid), pos[0], pos[1], pos[2], pos[3], Player[playerid][ID]);
mysql_format(mysql, query, sizeof query, "UPDATE 'accounts' SET 'Score' = '%i' WHERE 'Name' = '%s'", score, name);
mysql_tquery(mysql, query, "", "");
return true;
}
Could you help me out?
Re: Score not updating (Mysql) -
BloodyRP - 02.06.2016
That should work.
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new
query[128],
Float:pos[4];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerFacingAngle(playerid, pos[3]);
GetPlayerScore(playerid, Player[playerid][Score]);
mysql_format(mysql, query, sizeof(query), "UPDATE `accounts` SET Money='%d',Score='%i',PosX`='%f',PosY='%f',PosZ='%f',PosA='%f' WHERE ID='%d'",GetPlayerMoney(playerid),Player[playerid][Score], pos[0], pos[1], pos[2], pos[3], Player[playerid][ID]);
mysql_tquery(mysql, query);
return true;
}
Re: Score not updating (Mysql) -
Deroxi - 02.06.2016
Thanks
Re: Score not updating (Mysql) -
oMa37 - 02.06.2016
use GetPlayerMoney, GetPlayerScore for updating.
Quote:
Originally Posted by BloodyRP
Already fixed by me, bro ![Cheesy](images/smilies/biggrin.png)
|
I'm just saying to avoid this in future.
Re: Score not updating (Mysql) -
BloodyRP - 02.06.2016
Quote:
Originally Posted by oMa37
use GetPlayerMoney, GetPlayerScore for updating.
|
Already fixed by me, bro