Entering Interiors with buttons rather /enter -
DrTeDDyBeAr - 24.08.2012
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
Re: Entering Interiors with buttons rather /enter -
Shetch - 24.08.2012
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.
Re: Entering Interiors with buttons rather /enter -
Calabresi - 24.08.2012
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.
Re: Entering Interiors with buttons rather /enter -
Memoryz - 24.08.2012
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.
Re: Entering Interiors with buttons rather /enter -
DrTeDDyBeAr - 24.08.2012
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
Re: Entering Interiors with buttons rather /enter -
botak - 25.12.2013
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 ?