SA-MP Forums Archive
MySQL position saving and loading - 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: MySQL position saving and loading (/showthread.php?tid=299793)



MySQL position saving and loading - vent - 27.11.2011

Well, i have an problem.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(Logged[playerid] == 1)
    {
        new mangutunde = GetPlayerScore(playerid);
        new raha = GetPlayerMoney(playerid);
        new Float:x, Float:y, Float:z, query[200], pname[24];
        GetPlayerName(playerid, pname, 24);
        GetPlayerPos(playerid, x, y, z);
        format(query, sizeof(query), "UPDATE playerinfo SET mangutunde=%d AND raha=%d AND `x`= '%f' AND `y`= '%f' AND `z`= '%f' WHERE kasutaja='%s'", mangutunde, raha, x, y, z, pname);
        mysql_query(query);

    }
    return 1;
}
This code wont save x,y and z. Can somebody help me?

http://www.upload.ee/image/1843317/lolololo.PNG this is at the phpmyadmin.


Re: MySQL position saving and loading - vardanega - 27.11.2011

try like this:

Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(Logged[playerid] == 1)
    {
        new mangutunde = GetPlayerScore(playerid);
        new raha = GetPlayerMoney(playerid);
        new Float:x, Float:y, Float:z, query[200], pname[24];
        GetPlayerName(playerid, pname, 24);
        GetPlayerPos(playerid, x, y, z);
        format(query, sizeof(query), "UPDATE playerinfo SET `mangutunde`='%d', `raha`='%d', `x`= '%f', `y`= '%f' ,`z`= '%f' WHERE kasutaja='%s'", mangutunde, raha, x, y, z, pname);
        mysql_query(query);

    }
    return 1;
}



Re: MySQL position saving and loading - KaleOtter - 27.11.2011

"UPDATE playerinfo SET mangutunde=%d, aha=%d, `x`= '%f', `y`= '%f', `z`= '%f' WHERE kasutaja='%s'"

Try this.

And be sure all your variable's have to good valeu.
So your x,y,z colums in your database should be FLOAT.
If it still doesn't work tell me.

Edit: Look above, I was to late


Re: MySQL position saving and loading - vent - 27.11.2011

Still
x = 0
y = 0
z = 0
and these variables are float?


Re: MySQL position saving and loading - KaleOtter - 27.11.2011

Can you make a screenshot of the structuur of your database if you don't bother...

(You also should enable your MySQL debug function so you can see if there are any errors.


Re: MySQL position saving and loading - vent - 27.11.2011

http://www.upload.ee/image/1844026/lol.PNG