Entry Key - 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: Entry Key (
/showthread.php?tid=257705)
Entry Key -
Skidmarks - 27.05.2011
http://pastebin.com/X8wpPnt1
iv got this code, and it works fine. but the issue is, when i go inside, im landing right on the interiorpickup and it puts me outside again... LOL <
And i would prefer it if i can go inside via hitting enter key and exiting the same way to prevent it just pinging me around like a ping pong ball... lol
Im just not sure how to make the New Keys old keys etc and i have read the OnKeyStateChange... would be Greatfull if you could give me a little help :P
Re: Entry Key -
gamer931215 - 27.05.2011
About the "ping-ponging" effect, you have to know two new coordinates, per side (in/out) one for the pickup and one for the teleport positioning.
For the keyboard you can use this as example:
pawn Код:
#include <a_samp> //default include
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) //define pressed keys
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_SECONDARY_ATTACK)) //if you pressed enter (according to the SA-MP wiki this is KEY_SECONDARY_ATTACK)
{
if(IsPlayerInRangeOfPoint(playerid,5,x,y,z)) //playerid,range (5 for a small area),x,y,z position OF PICKUP!
{
//teleport the player here
} else if (IsPlayerInRangeOfPoint(playerid,5,x,y,z))
{
//another teleport
} //etc
}
return 0;
}
I hope this was usefull to you ^^