press space to enter a house?
#4

This is from one of my old gamemodes, but it should do the trick. Remember that you have the change the variables to match your current gamemode, otherwise it wouldnt work.

pawn Код:
if(GetPlayerVirtualWorld(playerid) == 0)
        {
            for(new i; i < MAX_HOUSES; i++)
            {
                if(IsPlayerInRange(playerid, 3, 3, HouseInfo[i][POS][0], HouseInfo[i][POS][1], HouseInfo[i][POS][2]))
                {
                    SetPlayerVirtualWorld(playerid, HouseInfo[i][World]);
                    SetPlayerInterior(playerid, HouseInfo[i][Int]);
                    SetPlayerPos(playerid, HouseInfo[i][iPOS][0], HouseInfo[i][iPOS][1], HouseInfo[i][iPOS][2]);
                    break;
                }
            }
        }
        if(GetPlayerVirtualWorld(playerid) != 0)
        {
            for(new i; i < MAX_HOUSES; i++)
            {
                if(IsPlayerInRange(playerid, 3, 3, HouseInfo[i][iPOS][0], HouseInfo[i][iPOS][1], HouseInfo[i][iPOS][2]) && GetPlayerVirtualWorld(playerid) == HouseInfo[i][World])
                {
                    SetPlayerVirtualWorld(playerid, 0);
                    SetPlayerInterior(playerid, 0);
                    SetPlayerPos(playerid, HouseInfo[i][POS][0], HouseInfo[i][POS][1], HouseInfo[i][POS][2]);
                    break;
                }
            }
        }
Reply


Messages In This Thread
press space to enter a house? - by johnruud4 - 06.05.2013, 09:44
AW: press space to enter a house? - by HurtLocker - 06.05.2013, 09:46
Re: press space to enter a house? - by Abhishek. - 06.05.2013, 09:47
Re: press space to enter a house? - by Cameltoe - 06.05.2013, 10:16

Forum Jump:


Users browsing this thread: 3 Guest(s)