Entering Interiors with buttons rather /enter
#1

How would I pull off such a thing? I have heard from many friends that typing /enter and /exit is a pain in the ass. I have to agree, it gets annoying. And no I'm not going to waste two keys so I can macro them. I would like to know how I would make it so when you walk up to a door in which you would type /enter and /exit, you will be TP'd outside when you press a certain button. I think the button would have to be everyone's sprint button. I think that's fair enough.


Could I get some help? Please don't talk too technical with me about PWN, I don't know much, only basics, so if I can get some help that'll be great.


-DrTeddybear
Reply
#2

Well, you have to use the callback OnPlayerKeyStateChange.
I'd suggest that you see some tutorials for that.

And show us your /enter and /exit command please.
Reply
#3

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_SPRINT) && !(oldkeys & KEY_SPRINT))
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, DoorposX, DoorposY, DoorposZ) // Door exterior position here.
        {
            SetPlayerPos(playerid, CoordX, CoordY, CoordZ); // Teleport coordinates here.
            SetPlayerInterior(playerid, Interior); // Interior ID.
            SetPlayerVirtualWorld(playerid, VirtualWorld); // Virtual World.
            return 1;
        }
    }
}
Basically, that's it. You gotta write door coordinates and the coordinates you want to teleport people to and it's ready.
Reply
#4

What I ended up doing a long time ago was when the player pressed enter/F, I called "OnPlayerCommandReceived" to /enter, then shortly after, I checked their position, if it didn't change, then I called /exit.
Reply
#5

I can do either way, I believe I'm familiar with Calabresi's way, but thank you both.

@Calabresi, I'll give it a try thanks
Reply
#6

Quote:
Originally Posted by Calabresi
Посмотреть сообщение
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_SPRINT) && !(oldkeys & KEY_SPRINT))
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, DoorposX, DoorposY, DoorposZ) // Door exterior position here.
        {
            SetPlayerPos(playerid, CoordX, CoordY, CoordZ); // Teleport coordinates here.
            SetPlayerInterior(playerid, Interior); // Interior ID.
            SetPlayerVirtualWorld(playerid, VirtualWorld); // Virtual World.
            return 1;
        }
    }
}
Basically, that's it. You gotta write door coordinates and the coordinates you want to teleport people to and it's ready.
When i use that code, are automatically using SPACE or not ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)