2020-10-22 19:17:15 +02:00
|
|
|
#include <PlayerManager>
|
|
|
|
#pragma semicolon 1
|
|
|
|
|
|
|
|
#define DEBUG
|
|
|
|
|
|
|
|
#define PLUGIN_AUTHOR "jenz"
|
|
|
|
#define PLUGIN_VERSION "1.0"
|
|
|
|
#define generic_length 256
|
|
|
|
|
|
|
|
#include <sourcemod>
|
|
|
|
#include <sdktools>
|
|
|
|
|
|
|
|
public Plugin myinfo =
|
|
|
|
{
|
|
|
|
name = "nosteam bhop blocker",
|
|
|
|
author = PLUGIN_AUTHOR,
|
|
|
|
description = "no more bhop for meatbags ",
|
|
|
|
version = PLUGIN_VERSION,
|
|
|
|
url = ""
|
|
|
|
};
|
|
|
|
|
|
|
|
bool bhop_restricted_nosteamer[MAXPLAYERS + 1];
|
2020-10-24 23:08:56 +02:00
|
|
|
int buttons_old[MAXPLAYERS + 1];
|
2020-10-25 14:13:19 +01:00
|
|
|
int flags_old[MAXPLAYERS + 1];
|
2020-10-22 19:17:15 +02:00
|
|
|
|
|
|
|
public void OnPluginStart()
|
|
|
|
{
|
|
|
|
for (int i = 1; i <= MAXPLAYERS; i++)
|
|
|
|
{
|
|
|
|
if (IsValidClient(i))
|
|
|
|
OnClientPostAdminCheck(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stock bool IsValidClient(int client)
|
|
|
|
{
|
|
|
|
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void OnClientDisconnect(int client)
|
|
|
|
{
|
|
|
|
bhop_restricted_nosteamer[client] = false;
|
2020-10-24 23:08:56 +02:00
|
|
|
buttons_old[client] = 0;
|
2020-10-25 14:13:19 +01:00
|
|
|
flags_old[client] = 0;
|
2020-10-22 19:17:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void OnClientPostAdminCheck(int client)
|
|
|
|
{
|
|
|
|
if (!IsFakeClient(client) && !IsClientSourceTV(client) && !PM_IsPlayerSteam(client))
|
|
|
|
{
|
|
|
|
bhop_restricted_nosteamer[client] = true;
|
2020-10-25 14:13:19 +01:00
|
|
|
buttons_old[client] = 0;
|
|
|
|
flags_old[client] = 0;
|
2020-10-22 19:17:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float vel[3], const float angles[3], int weapon, int subtype,
|
|
|
|
int cmdnum, int tickcount, int seed, const int mouse[2])
|
|
|
|
{
|
|
|
|
if (!IsValidClient(client) || !IsPlayerAlive(client) || !bhop_restricted_nosteamer[client]) return;
|
2020-10-24 23:08:56 +02:00
|
|
|
if (!(buttons_old[client] & IN_JUMP) && (!(buttons & IN_JUMP)))
|
2020-10-25 14:13:19 +01:00
|
|
|
{
|
|
|
|
flags_old[client] = GetEntityFlags(client);
|
2020-10-24 23:08:56 +02:00
|
|
|
return;
|
2020-10-25 14:13:19 +01:00
|
|
|
}
|
2020-10-24 23:08:56 +02:00
|
|
|
if (buttons_old[client] & IN_JUMP)
|
2020-10-22 19:17:15 +02:00
|
|
|
{
|
2020-10-24 23:08:56 +02:00
|
|
|
if (!(buttons & IN_JUMP))
|
|
|
|
if (GetEntityFlags(client) & FL_ONGROUND)
|
|
|
|
buttons_old[client] = buttons;
|
|
|
|
return;
|
2020-10-22 19:17:15 +02:00
|
|
|
}
|
2020-10-25 14:13:19 +01:00
|
|
|
if (!(flags_old[client] & FL_ONGROUND))
|
|
|
|
return;
|
2020-10-24 23:08:56 +02:00
|
|
|
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;
|
2020-10-22 19:17:15 +02:00
|
|
|
}
|
|
|
|
|