How Do You save Player Postion With Y_INI?
#4

Top of your script:
pawn Код:
new
    Float: PosX[MAX_PLAYERS],
    Float: PosY[MAX_PLAYERS],
    Float: PosZ[MAX_PLAYERS],
    Float: Angle[MAX_PLAYERS]
Under OnPlayerDisconnect:
pawn Код:
GetPlayerPos(playerid,PosX[playerid],PosY[playerid],PosZ[playerid]);
    GetPlayerFacingAngle(playerid,Angle[playerid]);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteFloat(File,"PositionX",PosX[playerid]);
    INI_WriteFloat(File,"PositionY",PosY[playerid]);
    INI_WriteFloat(File,"PositionZ",PosZ[playerid]);
    INI_WriteFloat(File,"Angle",Angle[playerid]);
    INI_Close(File);
Under OnPlayerSpawn:
pawn Код:
if(PosX[playerid] !=0 && PosY[playerid] !=0 && PosZ[playerid] !=0 && Angle[playerid] != 0)
    {
        SetPlayerPos(playerid,PosX[playerid],PosY[playerid],PosZ[playerid]);
        SetPlayerFacingAngle(playerid,Angle[playerid]);
    }
Under your Login System:
pawn Код:
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],PosX[playerid],PosY[playerid],PosZ[playerid],Angle[playerid], 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);
Under your load function:
pawn Код:
INI_Float("PositionX",PosX[playerid]);
    INI_Float("PositionY",PosY[playerid]);
    INI_Float("PositionZ",PosZ[playerid]);
    INI_Float("Angle",Angle[playerid]);
This is how it works for me.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)