SA-MP Forums Archive
Check keys. - 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: Check keys. (/showthread.php?tid=389219)



Check keys. - budelis - 01.11.2012

Hi,

I want to check if player is holding left mouse button and pressed right mouse button.

It's exist mouse buttons in car?


Re: Check keys. - Glint - 01.11.2012

You can use this Macro
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
The Macro was not made by me i got it from the XtremePlanet GM


Re: Check keys. - budelis - 01.11.2012

I have this, but what key is mouse?


Re: Check keys. - Glint - 01.11.2012

Under OnPlayerKeyStateChange Monitor for key changes now let's say you want,
to check the player's submission key, mouse key, we do like the following,
pawn Код:
if(PRESSED(KEY_FIRE))
{
    // Do Something You Like Here
    return 1;
}



Re: Check keys. - budelis - 01.11.2012

KEY_FIRE is left mouse click? and what is right mouse click?


Re: Check keys. - Glint - 01.11.2012

Check this https://sampwiki.blast.hk/wiki/GetPlayerKeys,
and this https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange