You don't have a position coordinates saving system at all, do you? Anyways, a simple one with dini
pawn Код:
enum pinfo // Anywhere, not in function or callback and such as.
{
Float: X, Float: Y, Float: X, Float: FA
}
new PlayerInfo[MAX_PLAYERS][pinfo];
stock SavePlayerLocation(playerid) // OnPlayerDisconnect.
{
new savefile[100], Name[MAX_PLAYER_NAME];
GetPlayerPos(PlayerInfo[playerid][X], PlayerInfo[playerid][Y], PlayerInfo[playerid][Z]);
GetPlayerFacingAngle(PlayerInfo[playerid][FA]);
GetPlayerName(playerid, Name, sizeof(Name));
format(savefile, sizeof(savefile),"%s's file.ini", Name);
if(!dini_Exists(savefile)) return dini_Create(savefile);
dini_FloatSet(savefile,"X", PlayerInfo[target][X]);
dini_FloatSet(savefile,"Y", PlayerInfo[target][Y]);
dini_FloatSet(savefile,"Z", PlayerInfo[target][Z]);
dini_FloatSet(savefile,"Facing Angle", PlayerInfo[target][FA]);
return 1;
}
stock LoadPlayerLocation(playerid) // OnPlayerConnect or wherever you load the stats from.
{
new loadfile[100], Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
format(loadfile, sizeof(loadfile),"%s's file.ini", Name);
if(dini_Exists(loadfile))
{
PlayerInfo[playerid][X] = dini_Float(loadfile,"X");
PlayerInfo[playerid][Y] = dini_Float(loadfile,"Y");
PlayerInfo[playerid][Z] = dini_Float(loadfile,"Z");
PlayerInfo[playerid][FA] = dini_Float(loadfile,"Facing Angle");
SetPlayerPos(playerid, PlayerInfo[playerid][X], PlayerInfo[playerid][Y], PlayerInfo[playerid][Z]);
SetPlayerFacingAngle(playerid, PlayerInfo[playerid][FA]);
}
else SavePlayerLocation(playerid);
return 1;
}