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



OnPlayerKeyStateChange Problem - MJ! - 22.12.2010

Ok guys, if i do:
pawn Код:
if(newkeys & 132) // KEY_FIRE | KEY_AIM => KEY_AIMFIRE
It works, but actually works if I press: DUCK(crouch) + KEY_AIM

Why ?


Re: OnPlayerKeyStateChange Problem - Nero_3D - 22.12.2010

If you know what Bitwise operation are than you should know why this happens

If you dont than I need to tell you that this always works if someone press KEY_FIRE or KEY_AIM

To solve this just do

pawn Код:
if((newkeys & 132) == 132)



Re: OnPlayerKeyStateChange Problem - MJ! - 22.12.2010

thx ()