SA-MP Forums Archive
Saving Last Position - 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: Saving Last Position (/showthread.php?tid=517792)



Saving Last Position - Jigsaw123 - 06.06.2014

I need someone to tell me how to make someone spawn at their last position after they've relogged. For example, If they register, spawn at airport, then go to San Fierro, and log off, when they log back on they spawn at San Fierro not back at Airport?

Also i need a /veh [ID] system?


Re: Saving Last Position - ball - 06.06.2014

You have to save player position when he have relogged (for example in OnPlayerDisconnect) - use GetPlayerPos function and save it (i don't know what are you use for saving - i give example for files)

Код:
new Float:p[3];
GetPlayerPos(playerid, p[0], p[1], p[2]);

dini_FloatSet(file, "pos_x", p[0]);
dini_FloatSet(file, "pos_y", p[1]);
dini_FloatSet(file, "pos_z", p[2]);

//When player first spawn
SetPlayerPos(playerid, dini_FloatGet(...), dini_FloatGet(...), dini_FloatGet(...));