SA-MP Forums Archive
[FilterScript] Anti CrouchBug (C-Bug) + Video - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Anti CrouchBug (C-Bug) + Video (/showthread.php?tid=524859)



Anti CrouchBug (C-Bug) + Video - greentarch - 08.07.2014

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.


Re: Anti CrouchBug (C-Bug) + Video - NoahF - 08.07.2014

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


Re: Anti CrouchBug (C-Bug) + Video - AviPeker - 09.07.2014

Looks good


Re: Anti CrouchBug (C-Bug) + Video - player94 - 09.07.2014

Looks good but need to try yet, very nice


Re: Anti CrouchBug (C-Bug) + Video - alanhutch - 09.07.2014

Cool!


Re: Anti CrouchBug (C-Bug) + Video - Caio_Freeze - 16.07.2014

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


Re: Anti CrouchBug (C-Bug) + Video - greentarch - 16.07.2014

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.


Re: Anti CrouchBug (C-Bug) + Video - Caio_Freeze - 16.07.2014

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