SA-MP Forums Archive
press space to enter a house? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: press space to enter a house? (/showthread.php?tid=435272)



press space to enter a house? - johnruud4 - 06.05.2013

I've been searching all over the internett and can't find out how i can script it. I doesn't want the /enter /exit when i enter or exit the house. I want to press space when i enter the house. Can someone help me :/


AW: press space to enter a house? - HurtLocker - 06.05.2013

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange


Re: press space to enter a house? - Abhishek. - 06.05.2013

when player presses space check
wheather he is in any house check point if he is then make him enter that house simple


Re: press space to enter a house? - Cameltoe - 06.05.2013

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;
                }
            }
        }