From c7e84ac2cb0e6d4339f64519667221311abdf541 Mon Sep 17 00:00:00 2001 From: BotoX Date: Tue, 5 Nov 2019 16:57:30 +0100 Subject: [PATCH] AntiBhopCheat: remove useless stats and add autism --- AntiBhopCheat/scripting/AntiBhopCheat.sp | 25 +++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/AntiBhopCheat/scripting/AntiBhopCheat.sp b/AntiBhopCheat/scripting/AntiBhopCheat.sp index 9ca534e4..4b2f3d61 100644 --- a/AntiBhopCheat/scripting/AntiBhopCheat.sp +++ b/AntiBhopCheat/scripting/AntiBhopCheat.sp @@ -26,7 +26,7 @@ Handle g_hOnClientDetected; public Plugin myinfo = { name = "AntiBhopCheat", - author = "BotoX", + author = "BotoX", description = "Detect all kinds of bhop cheats", version = "0.0", url = "" @@ -45,8 +45,8 @@ public void OnPluginStart() { if(IsClientConnected(client)) { - if(IsClientInGame(client)) - OnClientPutInServer(client); + if(IsClientConnected(client)) + OnClientConnected(client); } } @@ -54,8 +54,14 @@ public void OnPluginStart() g_hOnClientDetected = CreateGlobalForward("AntiBhopCheat_OnClientDetected", ET_Ignore, Param_Cell, Param_String, Param_String); } -public void OnClientPutInServer(int client) +public void OnClientConnected(int client) { + if(g_aPlayers[client]) + { + g_aPlayers[client].Dispose(); + g_aPlayers[client] = null; + } + g_aPlayers[client] = new CPlayer(client); } @@ -533,8 +539,8 @@ int FormatStreak(int client, int iTarget, int iStreak, char[] sBuf=0, int len=0) (aStreakJumps[1] / float(iStreakJumps)) * 100.0, (aStreakJumps[2] / float(iStreakJumps)) * 100.0); - iBuf += ConsoleFormat(client, sBuf[iBuf], len-iBuf, "#%2s %5s %7s %7s %5s %5s %8s %4s %6s %s\n", - "id", " diff", " invel", " outvel", " gain", " comb", " avgdist", " num", " avg+-", "pattern"); + iBuf += ConsoleFormat(client, sBuf[iBuf], len-iBuf, "#%2s %7s %5s %8s %4s %6s %s\n", + "id", " outvel", " gain", " avgdist", " num", " avg+-", "pattern"); ArrayList hJumps = hStreak.hJumps; float fPrevVel = 0.0; @@ -549,7 +555,7 @@ int FormatStreak(int client, int iTarget, int iStreak, char[] sBuf=0, int len=0) float fOutVel = hJump.fEndVel; int iEndTick = hJump.iEndTick; - static char sPattern[256]; + static char sPattern[512]; int iPatternLen = 0; int iPrevTick = -1; int iTicks; @@ -605,12 +611,9 @@ int FormatStreak(int client, int iTarget, int iStreak, char[] sBuf=0, int len=0) if(fPrevVel == 0.0) fPrevVel = fInVel; - iBuf += ConsoleFormat(client, sBuf[iBuf], len-iBuf, "#%2d %4d%% %7.1f %7.1f %4d%% %4d%% %8.2f %4d %6.2f %s\n", + iBuf += ConsoleFormat(client, sBuf[iBuf], len-iBuf, "#%2d %7.1f %4d%% %8.2f %4d %6.2f %s\n", i, - fPrevVel == 0.0 ? 100 : RoundFloat((fInVel / fPrevVel) * 100.0 - 100.0), - fInVel, fOutVel, - fInVel == 0.0 ? 100 : RoundFloat((fOutVel / fInVel) * 100.0 - 100.0), fPrevVel == 0.0 ? 100 : RoundFloat((fOutVel / fPrevVel) * 100.0 - 100.0), fAvgDist, iPresses,