Cannot /exit interior when relogging -
ryansheilds - 17.01.2012
When I relog, I cannot /exit an interior if I logged inside of one.
Here is the /exit command
pawn Код:
CMD:exit(playerid, params[])
{
for(new index = 0; index < sizeof(DoorInfo); index++)
{
if(IsPlayerInRangeOfPoint(playerid,3.0,DoorInfo[index][ddInteriorX],DoorInfo[index][ddInteriorY],DoorInfo[index][ddInteriorZ]) && GetPlayerVirtualWorld(playerid) == DoorInfo[index][ddIntVW] && GetPlayerInterior(playerid) == DoorInfo[index][ddInt])
{
SetPlayerInterior(playerid,DoorInfo[index][ddExtInt]);
SetPlayerVirtualWorld(playerid,DoorInfo[index][ddExtVw]);
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && DoorInfo[index][ddVehicleAble] > 0)
{
new vid = GetPlayerVehicleID(playerid);
SetVehiclePos(vid,DoorInfo[index][ddExteriorX],DoorInfo[index][ddExteriorY],DoorInfo[index][ddExteriorZ]);
SetVehicleZAngle(vid,DoorInfo[index][ddExteriorA]);
SetVehicleVirtualWorld(vid,DoorInfo[index][ddExtVw]);
LinkVehicleToInterior(vid,DoorInfo[index][ddExtInt]);
return 1;
}else{
SetPlayerPos(playerid,DoorInfo[index][ddExteriorX],DoorInfo[index][ddExteriorY],DoorInfo[index][ddExteriorZ]);
SetPlayerFacingAngle(playerid,DoorInfo[index][ddExteriorA]);
}
}
}
return 1;
}
Please help.
Re: Cannot /exit interior when relogging -
Dokins - 17.01.2012
You need to set the player virtual world to the same as the interior otherwise they are in different virtual worlds; i.e OnPlayerSpawn
VirtualWorld[playerid] = GetPlayerVirtualWorld(playerid);
Try that.
Re: Cannot /exit interior when relogging -
Gerira Gaijin - 17.01.2012
When a player logs out save his current virtual world, and on login set his virtual world to the saved (last) one. It's simple to achieve.
Re: Cannot /exit interior when relogging -
ryansheilds - 17.01.2012
I have the saving and loading and this code, But I still and /exit. onplayerspawn:
pawn Код:
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
SetPlayerInterior(playerid, PlayerInfo[playerid][pINT]);
Re: Cannot /exit interior when relogging -
Gerira Gaijin - 17.01.2012
Have you checked if the virtual world and interior save correctly on log out?
Re: Cannot /exit interior when relogging -
ryansheilds - 17.01.2012
Hmm, could someone give me the code for OnPlayerDisconnect, for saving VW and Int?
Re: Cannot /exit interior when relogging -
Gerira Gaijin - 17.01.2012
Just use GetPlayerInterior and GetPlayerVirtualWorld and save the result like you save other variables.
Re: Cannot /exit interior when relogging -
ryansheilds - 18.01.2012
Thanks for your help! I fixed the problem, it was to do with the saving of Interior and Virtual World.