Entry Key
#1

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

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 ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)