[Tutorial] Save, load and set player position - using y_ini
#21

i have this working but when i restart the server the coords do not load it spawns me at 0,0,0
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    if(IsPlayerLoggedIn[playerid] == 1)
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        INI_SetTag(iFile,"data");
        GetPlayerPos(playerid, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ]);
        GetPlayerFacingAngle( playerid, PlayerInfo[playerid][pAngle]);
        INI_SetTag(iFile, "position");
        INI_WriteFloat(iFile,"PositionX",PlayerInfo[playerid][pPosX]);
        INI_WriteFloat(iFile,"PositionY",PlayerInfo[playerid][pPosY]);
        INI_WriteFloat(iFile,"PositionZ",PlayerInfo[playerid][pPosZ]);
        INI_WriteFloat(iFile,"Angle",PlayerInfo[playerid][pAngle]);
        INI_WriteInt(iFile,"Interior",GetPlayerInterior(playerid));
        INI_WriteInt(iFile,"VirtualWorld",GetPlayerVirtualWorld(playerid));
        INI_Close(iFile);
    }
    return 1;
}

public UserDataLoad_data(playerid,name[],value[]) {
    INI_Int("Pass",PlayerInfo[playerid][pPass]);
    #if defined AUTOLOGIN
        INI_String("IP",pIP[playerid],16);
    #endif
    INI_Float("PositionX",PlayerInfo[playerid][pPosX]);
    INI_Float("PositionY",PlayerInfo[playerid][pPosY]);
    INI_Float("PositionZ",PlayerInfo[playerid][pPosZ]);
    INI_Float("Angle",PlayerInfo[playerid][pAngle]);
    INI_Int("Interior",PlayerInfo[playerid][pInterior]);
    INI_Int("VirtualWorld",PlayerInfo[playerid][pVirtualWorld]);
   
    return 1;
}

public SkipSpawn(playerid)
{
    if(PlayerInfo[playerid][pReg] == 1)
    {
        SetSpawnInfo( playerid, 0, 0, PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ],PlayerInfo[playerid][pAngle], 0, 0, 0, 0, 0, 0 );
        SetPlayerInterior( playerid, PlayerInfo[playerid][pInterior]);
        SetPlayerVirtualWorld( playerid, PlayerInfo[playerid][pVirtualWorld]);
        SpawnPlayer(playerid);
        SendClientMessage( playerid, -1, "welcome to your last position" );
    }
    else if(PlayerInfo[playerid][pReg] == 0)
    {
        SetSpawnInfo( playerid, 0, 0, -2764.9766,375.4572,6.3430,271.0806, 0, 0, 0, 0, 0, 0 );
        SpawnPlayer(playerid);
    }
    return 1;
}
Reply


Messages In This Thread
Save, load and set player position - using y_ini - by SmiT - 27.11.2011, 12:18
Re: Save, load and set player position - using y_ini - by SantarioLeone - 27.11.2011, 18:10
Re: Save, load and set player position - using y_ini - by wups - 27.11.2011, 19:13
Re: Save, load and set player position - using y_ini - by RepzThat - 27.11.2011, 20:05
Re: Save, load and set player position - using y_ini - by SmiT - 28.11.2011, 12:52
Re: Save, load and set player position - using y_ini - by SantarioLeone - 29.11.2011, 17:20
Re: Save, load and set player position - using y_ini - by dmng825 - 31.12.2011, 16:08
Re: Save, load and set player position - using y_ini - by Zom3ie - 31.12.2011, 20:41
Re: Save, load and set player position - using y_ini - by dmng825 - 02.01.2012, 12:16
Re: Save, load and set player position - using y_ini - by maxmax1 - 17.02.2012, 15:22
Re: Save, load and set player position - using y_ini - by Joe Vagos - 15.07.2012, 16:54
Re: Save, load and set player position - using y_ini - by Michael_Cuellar - 02.08.2012, 19:13
Re: Save, load and set player position - using y_ini - by rokasma - 07.11.2012, 14:15
Re: Save, load and set player position - using y_ini - by x96664 - 14.11.2012, 19:04
Re: Save, load and set player position - using y_ini - by Jesseding - 14.11.2012, 20:59
Re: Save, load and set player position - using y_ini - by jstowe96 - 24.11.2012, 01:16
Re: Save, load and set player position - using y_ini - by Crypt - 24.11.2012, 06:04
Re: Save, load and set player position - using y_ini - by jstowe96 - 24.11.2012, 11:38
Re: Save, load and set player position - using y_ini - by Blademaster680 - 15.07.2013, 21:45
Re : Save, load and set player position - using y_ini - by mirou123 - 23.08.2013, 19:29
Re: Save, load and set player position - using y_ini - by Ramms - 07.02.2014, 16:42
Re: Save, load and set player position - using y_ini - by xPirate - 05.04.2014, 12:13
Re: Save, load and set player position - using y_ini - by biker122 - 05.04.2014, 13:18
Re: Save, load and set player position - using y_ini - by xPirate - 05.04.2014, 14:26
Re: Save, load and set player position - using y_ini - by GrandTA - 20.06.2017, 15:39
Re: Save, load and set player position - using y_ini - by 2xRichard - 16.07.2017, 15:46
Re: Save, load and set player position - using y_ini - by beastmaster - 19.07.2018, 07:57
Re: Save, load and set player position - using y_ini - by CodeStyle175 - 19.07.2018, 08:51
Re: Save, load and set player position - using y_ini - by WilliamVN - 21.07.2018, 04:02
Re: Save, load and set player position - using y_ini - by DerickClark - 21.07.2018, 04:19
Re: Save, load and set player position - using y_ini - by beastmaster - 25.07.2018, 08:59
Re: Save, load and set player position - using y_ini - by DerickClark - 26.07.2018, 06:56
Re: Save, load and set player position - using y_ini - by beastmaster - 26.07.2018, 11:38

Forum Jump:


Users browsing this thread: 4 Guest(s)