Having some key problems
#1

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
}
Reply
#2

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
}
Reply
#3

That didn't actually work, Still when i pressed another button whilist pressing the JUMP button it still detects me as a BHer.
Reply
#4

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.
Reply
#5

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?
Reply
#6

The bunny hop i was referring to was the on-foot bunny-hop for RP servers @ Threshold.
Reply
#7

*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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)