Not saving position in the SQL Server
#1

Okay, So, i made a script that is supposed to save the position etc of the player when they disconnect. here it is.
pawn Код:
new query[500], Float:FacingAngle, Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X,Y,X);
    GetPlayerFacingAngle(playerid, FacingAngle);
    if(IsLoggedIn[playerid] == 1 && playerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid))
    {
        mysql_format(MysqlCon, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `Vip`=%d, `Money`=%d, `Score`=%d, `TrustedLevel`=%d, `Deaths`=%d, `Kills`=%d, `X`=%f, `Y`=%f, `Z`=%f, 'FacingAngle'=%f, `Interior`=%d, 'VW'=0 WHERE `ID`=%d AND `user`='%e'",
        pInfo[playerid][pAdmin],
        pInfo[playerid][pVip],
        GetPlayerMoney(playerid),
        GetPlayerScore(playerid),
        pInfo[playerid][pTrustedLevel],
        pInfo[playerid][pDeaths],
        pInfo[playerid][pKills],
        X,
        Y,
        Z,
        FacingAngle,
        GetPlayerInterior(playerid),
        pInfo[playerid][pID],
        PlayerName(playerid));
        mysql_tquery(MysqlCon, query, "", "");
        resetVar(playerid);
        print(query);
    }
But I got a problem, On My print(query); this is in my server log
Код:
[17:26:58] [join] Brad_Nunchr has joined the server (0:127.0.0.1)
[17:27:39] UPDATE `players` SET `Admin`=0, `Vip`=0, `Money`=1250, `Score`=0, `TrustedLevel`=0, `Deaths`=0, `Kills`=0, `X`=-95.805450, `Y`=1194.072876, `Z`=19.589136, 'FacingAngle'=0.000000, `Interior`=0, 'VW'=1133108785 WHERE `ID`=5 AND `user`='Brad_Nunchr'
[17:27:39] [part] Brad_Nunchr has left the server (0:1)
But in my phpmyadmin it says the X, Y, Z is 0 > http://prntscr.com/3m22bd
Please help me fix this issue
Reply
#2

use "%1f" instead of "%f" for floats
Reply
#3

still doesntwork...
Reply
#4

SQL Log>
Код:
(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 ''FacingAngle'=347.153259, `Interior`=0, 'VW'=0 WHERE `ID`=7 AND `user`='Brad_nun' at line 1
Reply
#5

Change this in the query

pawn Код:
'FacingAngle'=%f
to

pawn Код:
`FacingAngle`=%f
Reply
#6

Код:
mysql_format(MysqlCon, query, sizeof(query), "UPDATE players SET Admin = %d, Vip = %d, Money = %d, Score = %d, TrustedLevel = %d, Deaths = %d, Kills = %d, X = %f, Y = %f, Z = %f, FacingAngle = %.1f, Interior = %d, VW = 0 WHERE ID = %d AND user = '%e'"
Try this - you had 'VW' instead of `VW` or VW - character ` isn't required.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)