Position saving with 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: Position saving with MySQL (
/showthread.php?tid=524977)
Position saving with MySQL -
Sturra - 09.07.2014
Hey,
Can anyone told how can i save player PosX,PosY,PosZ with MySQL,when player disconnect and later connect again his character will spawn same destination where he disconnected. I'm using this gamemode:
https://sampforum.blast.hk/showthread.php?tid=520021 there are only spawnpoint system. Hope you can help.
Regards, Sturra
Re: Position saving with MySQL -
AMouldyLemon - 09.07.2014
Set 3 more values in your MySQL database under your Player data, PosX, PosY and PosZ. Set them to FLOAT with the length of 10.
pawn Код:
enum pData
{
Float:PosX,
Float:PosY,
Float:PosZ
//etc..
};
pawn Код:
public OnPlayerDisconnect(playerid)
{
new query[128];
format(query, sizeof(query), "UPDATE PlayerData SET PosX=%f, PosY=%f, PosZ=%f WHERE pName='%s'", Player[playerid][PosX], Player[playerid][PosY], Player[playerid][PosZ], )
}
I'm not the best at PAWN, but I attempted it for you.
Tell me if it works
Re: Position saving with MySQL -
Stanford - 09.07.2014
Do not forget to add the "`".
for example:
Re: Position saving with MySQL -
Sturra - 09.07.2014
Is this all i need to add?
Re: Position saving with MySQL -
AMouldyLemon - 09.07.2014
Should be, you can add an Angle with Float

Angle and add "pAngle" to the UPDATE `pAngle` = %f then Player[playerid][pAngle] etc.
Re: Position saving with MySQL -
Sturra - 09.07.2014
Where i need to add this?
`PosX` = '%f"
Re: Position saving with MySQL -
AMouldyLemon - 09.07.2014
Just replace my PosX, Y and Z with the `name` etc.. It's not that hard to figure out