[FilterScript] Anti CrouchBug (C-Bug) + Video
#1

I challenged myself to make an anti c-bug system, and I came up with this script.

It detects these C-Bug method(s):
<> Aim, shoot, release aim + crouch [popular method]
<> While holding JUMP+SPRINT, you shoot and press C [never saw this before]

Doesn't detect this method (a slow one):
<> Crouch, aim, shoot, crouch, aim, shoot, repeat. [newbie cbuggers use this, this is not much a problem because it still shoots slow]

What weapon it detects?
>> Whatever you can CBug with, because I myself, tend to c-bug after using done shooting with any weapon I use.

Any false positives, yet?
>> By my experience, I haven't had any yet.

Not like other scripts, this one only have 66 lines.
I don't know if this is better than others, I am just trying another method I came up with.

pawn Code:
/*
    anti crouch bug
        by greentarch
*/


#include < a_samp >

new
    gLastShot[ MAX_PLAYERS ];
   
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))
   
public OnPlayerConnect( playerid )
    return gLastShot[ playerid ] = -1;
   
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )  
{
    if ( ( tickcount( ) - gLastShot[ playerid ] ) < 750 )
    {
        if ( HOLDING( KEY_JUMP | KEY_SPRINT | KEY_CROUCH ) )
        {
            new
                Float: pPos[ 3 ];
            GetPlayerPos( playerid, pPos[ 0 ], pPos[ 1 ], pPos[ 2 ] );
            SetPlayerPos( playerid, pPos[ 0 ], pPos[ 1 ], pPos[ 2 ] + 10.0 );
       
            GameTextForPlayer( playerid, "~r~Stop crouch bugging!", 1000, 3 );
       
            gLastShot[ playerid ] = -1;
           
            return 1;
        }
        if ( newkeys & KEY_CROUCH )
        {
            SetTimerEx( "__check", 200, false, "i", playerid );
        }
    }
   
    return 1;
}

forward __check( playerid );
public __check( playerid )
{
    if ( GetPlayerSpecialAction( playerid ) == SPECIAL_ACTION_DUCK )
        return 1;
       
    new
        Float: pPos[ 3 ];
    GetPlayerPos( playerid, pPos[ 0 ], pPos[ 1 ], pPos[ 2 ] );
    SetPlayerPos( playerid, pPos[ 0 ], pPos[ 1 ], pPos[ 2 ] + 10.0 );
   
    GameTextForPlayer( playerid, "~r~Stop crouch bugging!", 1000, 3 );
   
    gLastShot[ playerid ] = -1;

    return 1;
}

public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float: fY, Float: fZ )
{  
    gLastShot[ playerid ] = tickcount( );
   
    return 1;
}
Slaps you high in the air if you C-Bug as a punishment, you can change it to whatever you like.
http://www.youtube.com/watch?v=wuT2Q...ature=*********

If you find a bug/mistakes, please reply and tell me.
I will try my best to repair/fix it.
Reply
#2

Nice job, haven't been able to test but looks good!
Reply
#3

Looks good
Reply
#4

Looks good but need to try yet, very nice
Reply
#5

Cool!
Reply
#6

In case you use this other method you said, how do I detect it?

Code:
Doesn't detect this method (a slow one):
<> Crouch, aim, shoot, crouch, aim, shoot, repeat. [newbie cbuggers use this, this is not much a problem because it still shoots slow]
Sorry my bad english
Reply
#7

Quote:
Originally Posted by Caio_Freeze
View Post
In case you use this other method you said, how do I detect it?

Code:
Doesn't detect this method (a slow one):
<> Crouch, aim, shoot, crouch, aim, shoot, repeat. [newbie cbuggers use this, this is not much a problem because it still shoots slow]
Sorry my bad english
I've tried my best, yes, it is detected, but gives some false-detectives.
I will try again.
Reply
#8

Quote:
Originally Posted by greentarch
View Post
I've tried my best, yes, it is detected, but gives some false-detectives.
I will try again.
Ok, I'll be waiting thank you sorry for my bad english
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)