Making savepos/loadpos (save when disconnect)
#2

Make a folder "Positions" inside the your_server/scriptfiles/
Of course without the ""
How to save them by using Dini.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new pName[24], PlayerFile[50];
    new Float:PX, Float:PY, Float:PZ;
   
    GetPlayerName(playerid, pName, sizeof(pName));
    format(PlayerFile, sizeof(PlayerFile), "Positions/%s.ini", pName);
   
    GetPlayerPos(playerid, PX, PY, PZ);
   
    PlayerInfo[playerid][PlayerX] = PX;
    PlayerInfo[playerid][PlayerY] = PY;
    PlayerInfo[playerid][PlayerZ] = PZ;
   
    dini_FloatSet(PlayerFile, "PlayerX", PlayerInfo[playerid][PlayerX]);
    dini_FloatSet(PlayerFile, "PlayerY", PlayerInfo[playerid][PlayerY]);
    dini_FloatSet(PlayerFile, "PlayerZ", PlayerInfo[playerid][PlayerZ]);
    dini_IntSet(PlayerFile, "Spawn", 2);
   
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)