diff --git a/AntiBhopCheat/scripting/AntiBhopCheat.sp b/AntiBhopCheat/scripting/AntiBhopCheat.sp index 386b1d6c..15578d4f 100644 --- a/AntiBhopCheat/scripting/AntiBhopCheat.sp +++ b/AntiBhopCheat/scripting/AntiBhopCheat.sp @@ -8,7 +8,7 @@ #include "CStreak.inc" #include "CPlayer.inc" -#define MAX_STREAKS 10 +#define MAX_STREAKS 5 #define VALID_MIN_JUMPS 3 #define VALID_MAX_TICKS 5 #define VALID_MIN_VELOCITY 250 @@ -203,9 +203,10 @@ void OnPressJump(CPlayer Player, int iTick, float fVelocity, bool bLeaveGround) { if(CurStreak.bValid) { - CurStreak.iEndTick = iTick; + CurStreak.iEndTick = hJump.iEndTick; DoStats(Player, CurStreak, hJump); + CheckStats(Player, CurStreak); } else CurStreak.Dispose(); @@ -249,7 +250,6 @@ void OnReleaseJump(CPlayer Player, int iTick, float fVelocity) void DoStats(CPlayer Player, CStreak CurStreak, CJump hJump) { - int client = Player.iClient; int aJumps[3] = {0, 0, 0}; int iPresses = 0; int iTicks = 0; @@ -303,54 +303,63 @@ void DoStats(CPlayer Player, CStreak CurStreak, CJump hJump) aStreakJumps[1] += aJumps[1]; aStreakJumps[2] += aJumps[2]; CurStreak.SetJumps(aStreakJumps); +} - int iStreakJumps = CurStreak.iJumps; +void CheckStats(CPlayer Player, CStreak Streak) +{ + int client = Player.iClient; + int iStreakJumps = Streak.iJumps; if(iStreakJumps >= 6) { - float HackRatio = CurStreak.iHackJumps / float(iStreakJumps); - if(HackRatio >= 0.85 && !Player.bFlagged) + float HackRatio = Streak.iHackJumps / float(iStreakJumps); + if(HackRatio >= 0.85) { - Player.bFlagged = true; - NotifyAdmins(client, "bhop hack streak"); -// KickClient(client, "Turn off your hack!"); - LimitBhop(client, true); - return; + Player.iHackFlagged += 1; + char sBuffer[32]; + Format(sBuffer, sizeof(sBuffer), "bhop hack streak %d\n", Player.iHackFlagged); + NotifyAdmins(client, sBuffer); } - float HyperRatio = CurStreak.iHyperJumps / float(iStreakJumps); - if(HyperRatio >= 0.85 && !Player.bFlagged) + float HyperRatio = Streak.iHyperJumps / float(iStreakJumps); + if(HyperRatio >= 0.85) { - Player.bFlagged = true; - NotifyAdmins(client, "hyperscroll streak"); + Player.iHyperFlagged += 1; 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); - 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; - if(iGlobalJumps >= 25) + if(iGlobalJumps >= 35) { 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"); - //KickClient(client, "Turn off your hack!"); - LimitBhop(client, true); - return; } float HyperRatio = Player.iHyperJumps / float(iGlobalJumps); - if(HyperRatio >= 0.50 && !Player.bFlagged) + if(HyperRatio >= 0.50) { - Player.bFlagged = true; - NotifyAdmins(client, "hyperscroll global"); - 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."); - LimitBhop(client, true); - return; + if(!Player.bHyperGlobal) + { + Player.bHyperGlobal = true; + CPrintToChat(client, "{green}[SM]{default} Turn off your bhop macro/script or hyperscroll!"); + CPrintToChat(client, "{green}[SM]{default} Your bhop is {red}turned off{default} until you bhop legit again."); + LimitBhop(client, true); + } + } + 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%%", 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]; Player.GetJumps(aGlobalJumps); @@ -432,8 +443,9 @@ void PrintStats(int client, int iTarget) (aGlobalJumps[1] / float(iGlobalJumps)) * 100.0, (aGlobalJumps[2] / float(iGlobalJumps)) * 100.0); - - PrintToConsole(client, "more to come..."); + PrintStreak(client, iTarget, 0); + PrintStreak(client, iTarget, 1); + PrintStreak(client, iTarget, 2); } public Action Command_Streak(int client, int argc) diff --git a/AntiBhopCheat/scripting/CPlayer.inc b/AntiBhopCheat/scripting/CPlayer.inc index 1aa08379..58a35eea 100644 --- a/AntiBhopCheat/scripting/CPlayer.inc +++ b/AntiBhopCheat/scripting/CPlayer.inc @@ -10,13 +10,17 @@ methodmap CPlayer < Basic Basic myclass = new Basic(); 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("iHyperJumps", 0); myclass.SetInt("iHackJumps", 0); myclass.SetArray("aJumps", {0, 0, 0}, 3); + myclass.SetInt("iLastStreakTick", -1); myclass.SetHandle("hStreak", new CStreak()); myclass.SetHandle("hStreaks", new ArrayList(1)); @@ -35,15 +39,51 @@ methodmap CPlayer < Basic } } - property bool bFlagged + property bool bHackGlobal { public get() { - return this.GetBool("bFlagged"); + return this.GetBool("bHackGlobal"); } 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]) { this.GetArray("aJumps", value, sizeof(value));