Position saving with MySQL
#1

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
Reply
#2

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
Reply
#3

Do not forget to add the "`".

for example:

pawn Код:
`PosX` = '%f"
Reply
#4

Is this all i need to add?
Reply
#5

Should be, you can add an Angle with FloatAngle and add "pAngle" to the UPDATE `pAngle` = %f then Player[playerid][pAngle] etc.
Reply
#6

Where i need to add this?

`PosX` = '%f"
Reply
#7

Just replace my PosX, Y and Z with the `name` etc.. It's not that hard to figure out
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)