Having some key problems -
JaKe Elite - 27.10.2014
I have just scripted an Anti-Bunny Hop System.
It is working really great, Except that it sometimes detects wrong.
For example, I pressed shift and right click (Shield Blocking), the Anti-Cheat will detect me for bunny hopping.
Is there anyway to fix this?
Code for detecting the bunny-hop
pawn Код:
if ((newkeys & KEY_JUMP) && !(oldkeys & KEY_JUMP))
{
//Codes here - Not gonna share it with you since it has nothing to do with the problem
}
Re: Having some key problems -
Crayder - 27.10.2014
Try using this pressed define instead.
Quote:
#define PRESSED(%0) (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
#define HOLDING(%0) (((newkeys & (%0)) == (%0)))// && ((oldkeys & (%0)) == (%0)))
|
pawn Код:
if (PRESSED(KEY_JUMP))
{
//Codes here - Not gonna share it with you since it has nothing to do with the problem
}
Re: Having some key problems -
JaKe Elite - 28.10.2014
That didn't actually work, Still when i pressed another button whilist pressing the JUMP button it still detects me as a BHer.
Re: Having some key problems -
Vince - 28.10.2014
This is one of those cases where it might actually be useful to use == instead of & for comparison, because you want to know if they press a single key. e.g.:
pawn Код:
if ((newkeys == KEY_JUMP) && !(oldkeys & KEY_JUMP))
Unsure if it works, but worth a try.
Re: Having some key problems -
Threshold - 28.10.2014
Shouldn't you just add checks to make sure they're on a bike? I mean you can't 'shield block' on a bike, right?
Re: Having some key problems -
JaKe Elite - 28.10.2014
The bunny hop i was referring to was the on-foot bunny-hop for RP servers @ Threshold.
Re: Having some key problems -
Threshold - 28.10.2014
*facepalm* right...
pawn Код:
if((newkeys & KEY_JUMP) && !(newkeys & KEY_HANDBRAKE) && !(oldkeys & KEY_JUMP))
Perhaps this? This means if they're not holding KEY_JUMP and KEY_HANDBRAKE at the same time, and KEY_JUMP wasn't the last key pressed/held, continue.
Just a proposal, but it seems like it should work.