public OnPlayerDisconnect(playerid, reason)
{
new query[512];
new Float: tmpX, Float: tmpY, Float: tmpZ, Float: tmpA;
GetPlayerPos(playerid, tmpX, tmpY, tmpZ);
GetPlayerFacingAngle(playerid, tmpA);
pData[playerid][p_SavePosInterior] = GetPlayerInterior(playerid);
pData[playerid][p_SavePosVW] = GetPlayerVirtualWorld(playerid);
mysql_format(mysql, query, sizeof query, "UPDATE `players` SET `AdminLevel`=%d `SavePos`=%d `SavePosX`=%f `SavePosY`=%f `SavePosZ`=%f `SavePosA`=%f `SavePosInterior`=%d `SavePosVW`=%d `Kills`=%d `Deaths`=%d \
`Score`=%d `Money`=%d WHERE ID=%d", pData[playerid][p_AdminLevel], pData[playerid][p_SavePos], tmpX, tmpY, tmpZ, tmpA,
pData[playerid][p_SavePosInterior], pData[playerid][p_SavePosVW], pData[playerid][p_Kills], pData[playerid][p_Deaths], GetPlayerScore(playerid), GetPlayerMoney(playerid), pData[playerid][p_ID]);
mysql_tquery(mysql, query, "", "");
return 1;
}
`SavePosX`='%f' `SavePosY`='%f' `SavePosZ`='%f' `SavePosA`='%f'
Escape float like this :
Код:
`SavePosX`='%f' `SavePosY`='%f' `SavePosZ`='%f' `SavePosA`='%f' |
mysql_format(mysql, query, sizeof query, "UPDATE `players` SET `AdminLevel`=%d `SavePos`=%d `SavePosX`='%f' `SavePosY`='%f' `SavePosZ`='%f' `SavePosA`='%f' `SavePosInterior`=%d `SavePosVW`=%d `Kills`=%d `Deaths`=%d \
`Score`=%d `Money`=%d WHERE ID=%d", pData[playerid][p_AdminLevel], pData[playerid][p_SavePos], tmpX, tmpY, tmpZ, tmpA,
pData[playerid][p_SavePosInterior], pData[playerid][p_SavePosVW], pData[playerid][p_Kills], pData[playerid][p_Deaths], GetPlayerScore(playerid), GetPlayerMoney(playerid), pData[playerid][p_ID]);
In the root of your server, you will find a log file for MySQL. Does that contain any errors?
|
[17:20:37] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`SavePos`=0 `SavePosX`='1959.273' `SavePosY`='1343.243' `SavePosZ`='15.375' `Sav' at line 1 |
"... SET `AdminLevel`=%d, `SavePos`=%d, `SavePosX`=%f, `SavePosY`=%f, `SavePosZ`=%f, ..."
You have to separate the fields it's going to update by a comma:
pawn Код:
|
mysql_format(mysql, query, sizeof query, "UPDATE `players` SET `AdminLevel`=%d, `SavePos`=%d,, `SavePosX`=%f, `SavePosY`=%f, `SavePosZ`=%f, `SavePosA`=%f, `SavePosInterior`=%d, `SavePosVW`=%d, `Kills`=%d, `Deaths`=%d, \
`Score`=%d, `Money`=%d WHERE `ID`=%d", pData[playerid][p_AdminLevel], pData[playerid][p_SavePos], tmpX, tmpY, tmpZ, tmpA,
pData[playerid][p_SavePosInterior], pData[playerid][p_SavePosVW], pData[playerid][p_Kills], pData[playerid][p_Deaths], GetPlayerScore(playerid), GetPlayerMoney(playerid), pData[playerid][p_ID]);
[17:48:13] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' `SavePosX`=1955.152, `SavePosY`=1367.763, `SavePosZ`=9.258, `SavePosA`=3.203, `' at line 1 |