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



OnPlayerKeyStateChange - Azazelo - 24.05.2012

I have trouble using
Код:
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
In this code
Код:
if (PRESSED( KEY_FIRE ))
       {
       SendClientMessage(playerid, 0xFFFFFFFF, "You fire a big cow at you enemy.");
       }
Problem:
When player press and hold or crouch or holding any other key this message will not be call,
I interested how to ignore all other key ?


Re: OnPlayerKeyStateChange - Jonny5 - 24.05.2012

try removing the space as your using a marco
and sometimes this matters, Im not sure if this is the case

Код:
if (PRESSED(KEY_FIRE))
or dont use the marco at all and use

pawn Код:
if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))