diff --git a/BlockNosteamBhop/scripting/bhop_limit_nosteamers.sp b/BlockNosteamBhop/scripting/bhop_limit_nosteamers.sp index 4f7502c0..90df5fea 100644 --- a/BlockNosteamBhop/scripting/bhop_limit_nosteamers.sp +++ b/BlockNosteamBhop/scripting/bhop_limit_nosteamers.sp @@ -20,7 +20,7 @@ public Plugin myinfo = }; bool bhop_restricted_nosteamer[MAXPLAYERS + 1]; -int client_check_count[MAXPLAYERS + 1]; +int buttons_old[MAXPLAYERS + 1]; public void OnPluginStart() { @@ -41,7 +41,7 @@ stock bool IsValidClient(int client) public void OnClientDisconnect(int client) { bhop_restricted_nosteamer[client] = false; - client_check_count[client] = 0; + buttons_old[client] = 0; } public void OnClientPostAdminCheck(int client) @@ -49,7 +49,7 @@ public void OnClientPostAdminCheck(int client) if (!IsFakeClient(client) && !IsClientSourceTV(client) && !PM_IsPlayerSteam(client)) { bhop_restricted_nosteamer[client] = true; - client_check_count[client] = 0; + buttons_old[0] = 0; } } @@ -57,20 +57,27 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float int cmdnum, int tickcount, int seed, const int mouse[2]) { if (!IsValidClient(client) || !IsPlayerAlive(client) || !bhop_restricted_nosteamer[client]) return; - client_check_count[client]++; - int generic_cap = 50; - if (client_check_count[client] > generic_cap) + if (!(buttons_old[client] & IN_JUMP) && (!(buttons & IN_JUMP))) + return; + if (buttons_old[client] & IN_JUMP) { - client_check_count[client] = 0; - float vVel[3]; - GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel); - float fVelocity = SquareRoot(Pow(vVel[0], 2.0) + Pow(vVel[1], 2.0)); - float velocity_block[3]; - velocity_block[0] = 0.0; - velocity_block[1] = 0.0; - velocity_block[2] = 0.0; - if (fVelocity > 320.0) - TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity_block); + if (!(buttons & IN_JUMP)) + if (GetEntityFlags(client) & FL_ONGROUND) + buttons_old[client] = buttons; + return; } + float vVel[3]; + GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel); + float fVelocity = SquareRoot(Pow(vVel[0], 2.0) + Pow(vVel[1], 2.0)); + float velocity_block[3]; + velocity_block[0] = vel[0]; + velocity_block[1] = vel[1]; + velocity_block[2] = vel[2]; + velocity_block[1] = 0.0; + if (fVelocity > 320.0) + { + TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity_block); + } + buttons_old[client] = buttons; }