press space to enter a house?
#1

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 :/
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Reply
#3

when player presses space check
wheather he is in any house check point if he is then make him enter that house simple
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)