Saving and loading the players pos?
#1

How i save the position of a player when he logs off and then load it when he logs back in and spawns,

I tought of some floats like

new Float,
Float:y,
Float:z;

Or something like it and putting them to get the xyz pos of him and saving it in a file , but i don't know how to exactly do it and i totaly suck at saving variables i don't even know how to save it to a file it's fcreate or something?

If someone can help me it'll be apreciated , thanks in advance.
Reply
#2

pawn Код:
enum _PINFO
{      Float:pLastX,
    Float:pLastY,
    Float:pLastZ
   
}
new PVar[MAX_PLAYERS][_PINFO];
Under OnPlayerDisconnect add
pawn Код:
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
plastX = x;
plastY = y;
plastZ = z;
and save them to the players file.


under OnPlayerSpawn
pawn Код:
//some sort of check if the player has been on the server before

SetPlayerPos(playerid,plastX,plastY,plastZ);
hope that helped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)