AntiBhopCheat: never notify hacker, keep logging him
auto unrestrict hyperscrollers make sm_stats more useful only do stats after streak ended (aka on next jump) totally untested lmao
This commit is contained in:
		
							parent
							
								
									62b93f1a16
								
							
						
					
					
						commit
						7ed153a6f7
					
				@ -8,7 +8,7 @@
 | 
				
			|||||||
#include "CStreak.inc"
 | 
					#include "CStreak.inc"
 | 
				
			||||||
#include "CPlayer.inc"
 | 
					#include "CPlayer.inc"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAX_STREAKS 10
 | 
					#define MAX_STREAKS 5
 | 
				
			||||||
#define VALID_MIN_JUMPS 3
 | 
					#define VALID_MIN_JUMPS 3
 | 
				
			||||||
#define VALID_MAX_TICKS 5
 | 
					#define VALID_MAX_TICKS 5
 | 
				
			||||||
#define VALID_MIN_VELOCITY 250
 | 
					#define VALID_MIN_VELOCITY 250
 | 
				
			||||||
@ -203,9 +203,10 @@ void OnPressJump(CPlayer Player, int iTick, float fVelocity, bool bLeaveGround)
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
				if(CurStreak.bValid)
 | 
									if(CurStreak.bValid)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					CurStreak.iEndTick = iTick;
 | 
										CurStreak.iEndTick = hJump.iEndTick;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					DoStats(Player, CurStreak, hJump);
 | 
										DoStats(Player, CurStreak, hJump);
 | 
				
			||||||
 | 
										CheckStats(Player, CurStreak);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
					CurStreak.Dispose();
 | 
										CurStreak.Dispose();
 | 
				
			||||||
@ -249,7 +250,6 @@ void OnReleaseJump(CPlayer Player, int iTick, float fVelocity)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void DoStats(CPlayer Player, CStreak CurStreak, CJump hJump)
 | 
					void DoStats(CPlayer Player, CStreak CurStreak, CJump hJump)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int client = Player.iClient;
 | 
					 | 
				
			||||||
	int aJumps[3] = {0, 0, 0};
 | 
						int aJumps[3] = {0, 0, 0};
 | 
				
			||||||
	int iPresses = 0;
 | 
						int iPresses = 0;
 | 
				
			||||||
	int iTicks = 0;
 | 
						int iTicks = 0;
 | 
				
			||||||
@ -303,54 +303,63 @@ void DoStats(CPlayer Player, CStreak CurStreak, CJump hJump)
 | 
				
			|||||||
	aStreakJumps[1] += aJumps[1];
 | 
						aStreakJumps[1] += aJumps[1];
 | 
				
			||||||
	aStreakJumps[2] += aJumps[2];
 | 
						aStreakJumps[2] += aJumps[2];
 | 
				
			||||||
	CurStreak.SetJumps(aStreakJumps);
 | 
						CurStreak.SetJumps(aStreakJumps);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int iStreakJumps = CurStreak.iJumps;
 | 
					void CheckStats(CPlayer Player, CStreak Streak)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int client = Player.iClient;
 | 
				
			||||||
 | 
						int iStreakJumps = Streak.iJumps;
 | 
				
			||||||
	if(iStreakJumps >= 6)
 | 
						if(iStreakJumps >= 6)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		float HackRatio = CurStreak.iHackJumps / float(iStreakJumps);
 | 
							float HackRatio = Streak.iHackJumps / float(iStreakJumps);
 | 
				
			||||||
		if(HackRatio >= 0.85 && !Player.bFlagged)
 | 
							if(HackRatio >= 0.85)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Player.bFlagged = true;
 | 
								Player.iHackFlagged += 1;
 | 
				
			||||||
			NotifyAdmins(client, "bhop hack streak");
 | 
								char sBuffer[32];
 | 
				
			||||||
//			KickClient(client, "Turn off your hack!");
 | 
								Format(sBuffer, sizeof(sBuffer), "bhop hack streak %d\n", Player.iHackFlagged);
 | 
				
			||||||
			LimitBhop(client, true);
 | 
								NotifyAdmins(client, sBuffer);
 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		float HyperRatio = CurStreak.iHyperJumps / float(iStreakJumps);
 | 
							float HyperRatio = Streak.iHyperJumps / float(iStreakJumps);
 | 
				
			||||||
		if(HyperRatio >= 0.85 && !Player.bFlagged)
 | 
							if(HyperRatio >= 0.85)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Player.bFlagged = true;
 | 
								Player.iHyperFlagged += 1;
 | 
				
			||||||
			NotifyAdmins(client, "hyperscroll streak");
 | 
					 | 
				
			||||||
			CPrintToChat(client, "{green}[SM]{default} Turn off your bhop macro/script or hyperscroll!");
 | 
								CPrintToChat(client, "{green}[SM]{default} Turn off your bhop macro/script or hyperscroll!");
 | 
				
			||||||
			CPrintToChat(client, "{green}[SM]{default} Your bhop has been {red}turned off{default} until the end of the map.");
 | 
								CPrintToChat(client, "{green}[SM]{default} Your bhop is {red}turned off{default} until you bhop legit again.");
 | 
				
			||||||
			LimitBhop(client, true);
 | 
								LimitBhop(client, true);
 | 
				
			||||||
			return;
 | 
							}
 | 
				
			||||||
 | 
							else if(IsBhopLimited(client))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								LimitBhop(client, false);
 | 
				
			||||||
 | 
								CPrintToChat(client, "{green}[SM]{default} Your bhop is {green}turned on{default} again.");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int iGlobalJumps = Player.iJumps;
 | 
						int iGlobalJumps = Player.iJumps;
 | 
				
			||||||
	if(iGlobalJumps >= 25)
 | 
						if(iGlobalJumps >= 35)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		float HackRatio = Player.iHackJumps / float(iGlobalJumps);
 | 
							float HackRatio = Player.iHackJumps / float(iGlobalJumps);
 | 
				
			||||||
		if(HackRatio >= 0.65 && !Player.bFlagged)
 | 
							if(HackRatio >= 0.60 && !Player.bHackGlobal)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Player.bFlagged = true;
 | 
								Player.bHackGlobal = true;
 | 
				
			||||||
			NotifyAdmins(client, "bhop hack global");
 | 
								NotifyAdmins(client, "bhop hack global");
 | 
				
			||||||
			//KickClient(client, "Turn off your hack!");
 | 
					 | 
				
			||||||
			LimitBhop(client, true);
 | 
					 | 
				
			||||||
			return;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		float HyperRatio = Player.iHyperJumps / float(iGlobalJumps);
 | 
							float HyperRatio = Player.iHyperJumps / float(iGlobalJumps);
 | 
				
			||||||
		if(HyperRatio >= 0.50 && !Player.bFlagged)
 | 
							if(HyperRatio >= 0.50)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Player.bFlagged = true;
 | 
								if(!Player.bHyperGlobal)
 | 
				
			||||||
			NotifyAdmins(client, "hyperscroll global");
 | 
								{
 | 
				
			||||||
 | 
									Player.bHyperGlobal = true;
 | 
				
			||||||
				CPrintToChat(client, "{green}[SM]{default} Turn off your bhop macro/script or hyperscroll!");
 | 
									CPrintToChat(client, "{green}[SM]{default} Turn off your bhop macro/script or hyperscroll!");
 | 
				
			||||||
			CPrintToChat(client, "{green}[SM]{default} Your bhop has been {red}turned off{default} until the end of the map.");
 | 
									CPrintToChat(client, "{green}[SM]{default} Your bhop is {red}turned off{default} until you bhop legit again.");
 | 
				
			||||||
				LimitBhop(client, true);
 | 
									LimitBhop(client, true);
 | 
				
			||||||
			return;
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else if(Player.bHyperGlobal && IsBhopLimited(client))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								LimitBhop(client, false);
 | 
				
			||||||
 | 
								CPrintToChat(client, "{green}[SM]{default} Your bhop is {green}turned on{default} again.");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -423,6 +432,8 @@ void PrintStats(int client, int iTarget)
 | 
				
			|||||||
	PrintToConsole(client, "Global jumps: %d | Hyper?: %.1f%% | Hack?: %.1f%%",
 | 
						PrintToConsole(client, "Global jumps: %d | Hyper?: %.1f%% | Hack?: %.1f%%",
 | 
				
			||||||
		iGlobalJumps, HyperRatio * 100.0, HackRatio * 100.0);
 | 
							iGlobalJumps, HyperRatio * 100.0, HackRatio * 100.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PrintToConsole(client, "bHackGlobal: %d | bHyperGlobal: %d | iHackFlagged: %d | iHyperFlagged: %d",
 | 
				
			||||||
 | 
							Player.bHackGlobal, Player.bHyperGlobal, Player.iHackFlagged, Player.iHyperFlagged);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int aGlobalJumps[3];
 | 
						int aGlobalJumps[3];
 | 
				
			||||||
	Player.GetJumps(aGlobalJumps);
 | 
						Player.GetJumps(aGlobalJumps);
 | 
				
			||||||
@ -432,8 +443,9 @@ void PrintStats(int client, int iTarget)
 | 
				
			|||||||
		(aGlobalJumps[1] / float(iGlobalJumps)) * 100.0,
 | 
							(aGlobalJumps[1] / float(iGlobalJumps)) * 100.0,
 | 
				
			||||||
		(aGlobalJumps[2] / float(iGlobalJumps)) * 100.0);
 | 
							(aGlobalJumps[2] / float(iGlobalJumps)) * 100.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PrintStreak(client, iTarget, 0);
 | 
				
			||||||
	PrintToConsole(client, "more to come...");
 | 
						PrintStreak(client, iTarget, 1);
 | 
				
			||||||
 | 
						PrintStreak(client, iTarget, 2);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public Action Command_Streak(int client, int argc)
 | 
					public Action Command_Streak(int client, int argc)
 | 
				
			||||||
 | 
				
			|||||||
@ -10,13 +10,17 @@ methodmap CPlayer < Basic
 | 
				
			|||||||
		Basic myclass = new Basic();
 | 
							Basic myclass = new Basic();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		myclass.SetInt("iClient", client);
 | 
							myclass.SetInt("iClient", client);
 | 
				
			||||||
		myclass.SetBool("bFlagged", false);
 | 
							myclass.SetBool("bHackGlobal", false);
 | 
				
			||||||
 | 
							myclass.SetBool("bHyperGlobal", false);
 | 
				
			||||||
 | 
							myclass.SetInt("iHackFlagged", 0);
 | 
				
			||||||
 | 
							myclass.SetInt("iHyperFlagged", 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		myclass.SetInt("iJumps", 0);
 | 
							myclass.SetInt("iJumps", 0);
 | 
				
			||||||
		myclass.SetInt("iHyperJumps", 0);
 | 
							myclass.SetInt("iHyperJumps", 0);
 | 
				
			||||||
		myclass.SetInt("iHackJumps", 0);
 | 
							myclass.SetInt("iHackJumps", 0);
 | 
				
			||||||
		myclass.SetArray("aJumps", {0, 0, 0}, 3);
 | 
							myclass.SetArray("aJumps", {0, 0, 0}, 3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							myclass.SetInt("iLastStreakTick", -1);
 | 
				
			||||||
		myclass.SetHandle("hStreak", new CStreak());
 | 
							myclass.SetHandle("hStreak", new CStreak());
 | 
				
			||||||
		myclass.SetHandle("hStreaks", new ArrayList(1));
 | 
							myclass.SetHandle("hStreaks", new ArrayList(1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -35,15 +39,51 @@ methodmap CPlayer < Basic
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	property bool bFlagged
 | 
						property bool bHackGlobal
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		public get()
 | 
							public get()
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return this.GetBool("bFlagged");
 | 
								return this.GetBool("bHackGlobal");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		public set(bool value)
 | 
							public set(bool value)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			this.SetBool("bFlagged", value);
 | 
								this.SetBool("bHackGlobal", value);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						property bool bHyperGlobal
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public get()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return this.GetBool("bHyperGlobal");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							public set(bool value)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								this.SetBool("bHyperGlobal", value);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						property int iHackFlagged
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public get()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return this.GetInt("iHackFlagged");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							public set(int value)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								this.SetInt("iHackFlagged", value);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						property int iHyperFlagged
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public get()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return this.GetInt("iHyperFlagged");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							public set(int value)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								this.SetInt("iHyperFlagged", value);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -83,6 +123,18 @@ methodmap CPlayer < Basic
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						property int iLastStreakTick
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public get()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return this.GetInt("iLastStreakTick");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							public set(int value)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								this.SetInt("iLastStreakTick", value);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public void GetJumps(int value[3])
 | 
						public void GetJumps(int value[3])
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		this.GetArray("aJumps", value, sizeof(value));
 | 
							this.GetArray("aJumps", value, sizeof(value));
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user