Cannot /exit interior when relogging
#1

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.
Reply
#2

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.
Reply
#3

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.
Reply
#4

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]);
Reply
#5

Have you checked if the virtual world and interior save correctly on log out?
Reply
#6

Hmm, could someone give me the code for OnPlayerDisconnect, for saving VW and Int?
Reply
#7

Just use GetPlayerInterior and GetPlayerVirtualWorld and save the result like you save other variables.
Reply
#8

Thanks for your help! I fixed the problem, it was to do with the saving of Interior and Virtual World.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)