SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 23/01/2014, 04:33 PM   #1
Mauzen
Godfather
 
Mauzen's Avatar
 
Join Date: Jun 2007
Location: Western Germany
Posts: 5,098
Reputation: 1522
Default Automatic Anti-CBug / CBug Detector Include

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:
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!

Last edited by Mauzen; 23/01/2014 at 09:20 PM.
Mauzen is offline   Reply With Quote
Old 23/01/2014, 04:44 PM   #2
Patrick
Guest
 
Posts: n/a
Default Re: Automatic Anti-CBug / CBug Detector Include

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.

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 With Quote
Old 23/01/2014, 04:44 PM   #3
Jeroen52
Gangsta
 
Jeroen52's Avatar
 
Join Date: Oct 2008
Location: The Netherlands
Posts: 776
Reputation: 51
Default Re: Automatic Anti-CBug / CBug Detector Include

Thanks Mauzen, quite interesting.
My server would probably use this in 0.3z
__________________
Jeroen52 is offline   Reply With Quote
Old 23/01/2014, 04:45 PM   #4
Mauzen
Godfather
 
Mauzen's Avatar
 
Join Date: Jun 2007
Location: Western Germany
Posts: 5,098
Reputation: 1522
Default Re: Automatic Anti-CBug / CBug Detector Include

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.
Mauzen is offline   Reply With Quote
Old 23/01/2014, 05:12 PM   #5
Ada32
Huge Clucker
 
Ada32's Avatar
 
Join Date: Apr 2013
Posts: 278
Reputation: 61
Default Re: Automatic Anti-CBug / CBug Detector Include

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..
Ada32 is offline   Reply With Quote
Old 23/01/2014, 09:05 PM   #6
Mauzen
Godfather
 
Mauzen's Avatar
 
Join Date: Jun 2007
Location: Western Germany
Posts: 5,098
Reputation: 1522
Default Re: Automatic Anti-CBug / CBug Detector Include

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
Mauzen is offline   Reply With Quote
Old 23/01/2014, 09:34 PM   #7
Patrick
Guest
 
Posts: n/a
Default Re: Automatic Anti-CBug / CBug Detector Include

No problem!, nice to see you updated it to its newest! might be using this in the future! lets eat some cookies ++rep
  Reply With Quote
Old 25/01/2014, 03:46 PM   #8
TheBosss
Big Clucker
 
Join Date: Jan 2014
Location: Skaro
Posts: 83
Reputation: 2
Default Re: Automatic Anti-CBug / CBug Detector Include

Really nice include,i will use it!
__________________
TheBosss is offline   Reply With Quote
Old 25/01/2014, 07:59 PM   #9
Whitetiger
Huge Clucker
 
Whitetiger's Avatar
 
Join Date: Nov 2007
Location: Greenville, NC, USA
Posts: 460
Reputation: 130
Default Re: Automatic Anti-CBug / CBug Detector Include

This Really doesn't detect cbug But rapid Fire cbug only
__________________
GitHub

Author of SA-MP AC

Whitetiger is offline   Reply With Quote
Old 22/02/2014, 01:48 AM   #10
JR_Junior
Big Clucker
 
JR_Junior's Avatar
 
Join Date: Nov 2011
Location: Brazil
Posts: 145
Reputation: 39
Default Re: Automatic Anti-CBug / CBug Detector Include

Bug: When shoot with combat shotgun gets c-bug warning!
__________________


[Multi Game Modes | Multi-Languages | The best server]
IP: play.lionstarserver.com:7777 | Visit: www.lionstarserver.com
__________________________________________________
JR_Junior is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CBug Timer hbzi Screenshots and Videos 16 27/06/2013 10:30 AM
Anti-Cbug system slaps player ID 0 captainjohn Scripting Help 2 14/04/2012 09:06 PM
help with a no-cbug feature sasuga Scripting Help 0 07/11/2011 04:26 PM


All times are GMT. The time now is 06:08 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.