[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


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)