[Include] Automatic Anti-CBug / CBug Detector Include
#1

Again a quick release in response to a recent discussion.
Note that this include requires a 0.3z server with 0.3z includes.

This script will check the intervals between certain weapon's shots. If a player is shooting too fast, hes obviously cbugging.
Depending on the settings, the include then calls the OnPlayerCBug callback, and/or automatically removes the extra bullets bullets from the game. The CBugging player still loses the ammo, but the bullets wont be synced for other players. (you can use the callback to give back the cbug bullets if you like). Note that even when cbugging, some shots will be allowed, so a cbugging player will reach the firerate of a normal player.
The include is ready-to-use, you might just need to adjust the default settings:

Variables you can change:
removeCBugs = 1/0 (default value=1)
if 1, cbug bullets will be removed automatically. Other players will feel just like he wouldnt cbug at all, but shoot with normal speed.
(OnPlayerWeaponShot also wont be called in other scripts then)

alertCBugs = 1/0 (default value=1)
if 1, OnPlayerCBug will be called whenever a player fires too fast

Callbacks:
OnPlayerCBug(playerid, weaponid, interval)
playerid - the cbugging player
weaponid - the used weapon
interval - time [ms] since his last valid shot

Example:
pawn Code:
public OnPlayerCBug(playerid, weaponid, interval) {
    new txt[64];
    format(txt, 64, "Player %d was caught cbugging with weaponid %d. Bug him!", playerid, weaponid);
    SendClientMessageToAll(-1, txt);
}
Changelog:
V1.1:
  • Added support for all "cbug-able" weapons
  • Added "weaponid"-parameter to OnPlayerCBug
  • Switched to another, faster hooking method
  • Special thanks to pds2k12
Downloads:
Pastebin V1.0
Pastebin V1.1


Thats it. Have fun!
Reply
#2

Nice, I was thinking of creating this but too lazy, anyways you can c-bug with 4-5 weapons, not only deagle. I love c-bugging with Shotgun, Sniper and Deagle.

pawn Code:
static stock bool:HasCBugWeapons(playerid)
{
    new
        WeaponID = GetPlayerWeapon(playerid);
   
    switch(WeaponID)
    {
        //Deagle | Shotgun | Combat Shotgun || Country Rifle || Sniper Rifle
        case 24, 25, 27, 33, 34: return true;
    }  
    return false;
}
Reply
#3

Thanks Mauzen, quite interesting.
My server would probably use this in 0.3z
Reply
#4

Quote:
Originally Posted by pds2k12
View Post
Nice, I was thinking of creating this but too lazy, anyways you can c-bug with 4-5 weapons, not only deagle. I love c-bugging with Shotgun, Sniper and Deagle.
Ah thanks, forgot that, havent played for too long. Luckily I already collected all weapon speeds a while ago, so I could add that.
Reply
#5

cool.

you should do

Code:
#if !defined removeCbugs
	#define removeCbugs true
#endif

#if !defined alertCbugs
	#define alertCbugs true
#endif


public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{      
		#if removeCBugs || alertCBugs
			if (!IsPlayerInAnyVehicle(playerid))
			{
				//blah
		#endif
so people don't need to make any changes in to include to toggle cbugging. just #define blah true/false in their mode.

but then again the whole concept of toggling it is useless..you don't want it? don't use it..
Reply
#6

Updated to V1.1
Couldnt test them all in detail because i suck so hard at cbugging, but their intervals should be fine


Quote:
Originally Posted by Ada32
View Post
you should do

[code]

so people don't need to make any changes in to include to toggle cbugging. just #define blah true/false in their mode.

but then again the whole concept of toggling it is useless..you don't want it? don't use it..
I thought about using defines instead at first, but decided for the variables. Defines would be a little bit faster, and as you said easier to handle, but the speed difference probably cant ever be noticed. In the gamemode you can also set the variables at any time, without touching the include. I also like the idea to change it during the server runtime, so you can have e.g. cbug shooting events on DM servers without restarting the gamemode
Reply
#7

No problem!, nice to see you updated it to its newest! might be using this in the future! lets eat some cookies ++rep
Reply
#8

Really nice include,i will use it!
Reply
#9

This Really doesn't detect cbug But rapid Fire cbug only
Reply
#10

Bug: When shoot with combat shotgun gets c-bug warning!
Reply
#11

I'm not sure how well this will work, some of the testing I've done shows that intervals are pretty inconsistent when ping is factored in so it's probably a good idea to add up infractions before doing any kind of action.
Reply
#12

Awesome. I thought about trying to do this with the OnPlayerWeaponShot callback, but I've been out of the PAWN scripting for awhile so I likely would of been better off shooting myself in the foot than attempting to do this right now.

Anyways, thanks for the include, it'll be useful!
Reply
#13

fatal error 111: user error: "The Anti-CBug include requires at least SA-MP 0.3z RC3"

How can i fix that?
Reply
#14

Quote:
Originally Posted by IDarkness
Посмотреть сообщение
fatal error 111: user error: "The Anti-CBug include requires at least SA-MP 0.3z RC3"

How can i fix that?
I really dont know. Maybe use SA-MP server on at least version 0.3z RC3 and the corresponding includes?
Reply
#15

Wow great job !
Reply
#16

Nice system bro, I like it
Reply
#17

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
I really dont know. Maybe use SA-MP server on at least version 0.3z RC3 and the corresponding includes?
Remove It
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)