07.02.2014, 16:42
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;
}