View Full Version : Saving Last Position

06/06/2014, 07:10 PM
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?

06/06/2014, 07:33 PM
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(...));