SA-MP Forums Archive
How to enter building using ALT? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to enter building using ALT? (/showthread.php?tid=251698)



How to enter building using ALT? - Sensitive - 28.04.2011

You can read everything in title.
But i want to use it on GTA:RP, becouse if you walk into icon, than you will enter building. I hate that. Please help!


Re: How to enter building using ALT? - Lorenc_ - 28.04.2011

'KEY_WALK'

pawn Код:
if(Keys & KEY_WALK)
{
//code? setplayerpos..
}



Re: How to enter building using ALT? - Sensitive - 28.04.2011

Uhm. Explain please. Im not so advanced in that ..


Re: How to enter building using ALT? - [DDC]Delight - 28.04.2011

Quote:
Originally Posted by Sensitive
Посмотреть сообщение
You can read everything in title.
But i want to use it on GTA:RP, becouse if you walk into icon, than you will enter building. I hate that. Please help!
I guess you mean 'icon' that's pickups right?
In that case..

Try this:

pawn Код:
//On top of the script
#define KEY_WALK   1024 // This might not be necessary
 
new HasEntered[MAX_PLAYERS];
new KillThatThing;
 
//Under OnPlayerConnect
HasEntered[playerid] = 0;
 
//Under OnPlayerDisconnect
HasEntered[playerid] = 0;
 
//Under OnPlayerPickupPickup
//Place this under the desired pickup
HasEntered[playerid] = 1;
KillThatThing = SetTimer("KillEntering", 10000, 0);
 
 
OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if(HasEntered[playerid] == 1)
  {
     if(newkeys == 1024)
     {
     //Do the setplayerpos here
     HasEntered[playerid] = 0;
     KillTimer(KillThatThing);
     }
  }
  return 1;
}
 
 
forward KillEntering(playerid);
public KillEntering(playerid)
{
  HasEntered[playerid] = 0;
}

NOTE: This ain't tested cuz im at work, have it a go tell me if there's anything wrong


Re: How to enter building using ALT? - Sensitive - 28.04.2011

Can you say me, how do i remove that, if i walk into icon im entering the building to. So i can replace it with this. Im using GTA:RP.


Re: How to enter building using ALT? - Sascha - 28.04.2011

get the position on where you want to press the ALT key..
and then:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  if ((oldkeys & KEY_WALK) && !(newkeys & KEY_WALK))
  {
    if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z)) //replace with the position where to press the alt button
    {
      SetPlayerInterior(playerid, interiorid);
      SetPlayerPos(playerid, x, y, z);
    }
  }
  return 1;
}
if you have further questions to this code.. send me a PM :8


Re: How to enter building using ALT? - Aldi96 - 28.04.2011

howwwww to use? hahha is LIKe ............


Re: How to enter building using ALT? - Sascha - 28.04.2011

you should stop posting senseless stuff mr. ban evader...
reported you to sa-mp team....