SA-MP Forums Archive
[Help] Enterance - 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)
+--- Thread: [Help] Enterance (/showthread.php?tid=516803)



[Help] Enterance - Swager98 - 01.06.2014

So in my script I can enter and exit from houses,business and all that using /enter and /exit,can anyone explain me how to set it that you can enter and exit using the key "F",I need it really bad,thanks.


Re: [Help] Enterance - PaulDinam - 01.06.2014

OnPlayerKeyStateChange
enough said


Re: [Help] Enterance - AndySedeyn - 01.06.2014

Quote:
Originally Posted by PaulDinam
Посмотреть сообщение
OnPlayerKeyStateChange
enough said
*Claps*
Don't bother helping if that's your way of helping. I bet you won't appreciate it yourself if people did that with you.

I will continue with what he stated.
You will need to check if the player presses the F button when he's in range of any business/house entrance.

That check is triggered with "OnPlayerKeyStateChange".
I recommend you to browse through the Sa-MP wiki and see how the callback is used.

Here's an example code:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_ACTION) // I think this is the "F" key (by default)
    {
        //do something here
    }
    return 1;
}
Here are the links to the SA-MP wiki:

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
https://sampwiki.blast.hk/wiki/Keys