preventing players from reseting velocity midair
This commit is contained in:
parent
d6c563a717
commit
92d540b1c8
@ -21,6 +21,7 @@ public Plugin myinfo =
|
|||||||
|
|
||||||
bool bhop_restricted_nosteamer[MAXPLAYERS + 1];
|
bool bhop_restricted_nosteamer[MAXPLAYERS + 1];
|
||||||
int buttons_old[MAXPLAYERS + 1];
|
int buttons_old[MAXPLAYERS + 1];
|
||||||
|
int flags_old[MAXPLAYERS + 1];
|
||||||
|
|
||||||
public void OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
@ -42,6 +43,7 @@ public void OnClientDisconnect(int client)
|
|||||||
{
|
{
|
||||||
bhop_restricted_nosteamer[client] = false;
|
bhop_restricted_nosteamer[client] = false;
|
||||||
buttons_old[client] = 0;
|
buttons_old[client] = 0;
|
||||||
|
flags_old[client] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClientPostAdminCheck(int client)
|
public void OnClientPostAdminCheck(int client)
|
||||||
@ -49,7 +51,8 @@ public void OnClientPostAdminCheck(int client)
|
|||||||
if (!IsFakeClient(client) && !IsClientSourceTV(client) && !PM_IsPlayerSteam(client))
|
if (!IsFakeClient(client) && !IsClientSourceTV(client) && !PM_IsPlayerSteam(client))
|
||||||
{
|
{
|
||||||
bhop_restricted_nosteamer[client] = true;
|
bhop_restricted_nosteamer[client] = true;
|
||||||
buttons_old[0] = 0;
|
buttons_old[client] = 0;
|
||||||
|
flags_old[client] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +61,10 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
|
|||||||
{
|
{
|
||||||
if (!IsValidClient(client) || !IsPlayerAlive(client) || !bhop_restricted_nosteamer[client]) return;
|
if (!IsValidClient(client) || !IsPlayerAlive(client) || !bhop_restricted_nosteamer[client]) return;
|
||||||
if (!(buttons_old[client] & IN_JUMP) && (!(buttons & IN_JUMP)))
|
if (!(buttons_old[client] & IN_JUMP) && (!(buttons & IN_JUMP)))
|
||||||
|
{
|
||||||
|
flags_old[client] = GetEntityFlags(client);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (buttons_old[client] & IN_JUMP)
|
if (buttons_old[client] & IN_JUMP)
|
||||||
{
|
{
|
||||||
if (!(buttons & IN_JUMP))
|
if (!(buttons & IN_JUMP))
|
||||||
@ -66,6 +72,8 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
|
|||||||
buttons_old[client] = buttons;
|
buttons_old[client] = buttons;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!(flags_old[client] & FL_ONGROUND))
|
||||||
|
return;
|
||||||
float vVel[3];
|
float vVel[3];
|
||||||
GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel);
|
GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel);
|
||||||
float fVelocity = SquareRoot(Pow(vVel[0], 2.0) + Pow(vVel[1], 2.0));
|
float fVelocity = SquareRoot(Pow(vVel[0], 2.0) + Pow(vVel[1], 2.0));
|
||||||
|
Loading…
Reference in New Issue
Block a user