mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 02:18:26 +00:00
tf2: fix jump counter & shavit_core_blockprejump
This commit is contained in:
parent
91f05dfbf9
commit
fefb0ffe6f
@ -1572,17 +1572,6 @@ void ChangeClientStyle(int client, int style, bool manual)
|
||||
SetClientCookie(client, gH_StyleCookie, sStyle);
|
||||
}
|
||||
|
||||
// used as an alternative for games where player_jump isn't a thing, such as TF2
|
||||
public void Shavit_Bhopstats_OnLeaveGround(int client, bool jumped, bool ladder)
|
||||
{
|
||||
if(gB_HookedJump || !jumped || ladder)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DoJump(client);
|
||||
}
|
||||
|
||||
public void Player_Jump(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||
@ -3444,21 +3433,36 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
|
||||
}
|
||||
|
||||
bool bInWater = (GetEntProp(client, Prop_Send, "m_nWaterLevel") >= 2);
|
||||
int iOldButtons = GetEntProp(client, Prop_Data, "m_nOldButtons");
|
||||
|
||||
if (GetStyleSettingBool(gA_Timers[client].bsStyle, "autobhop") && gB_Auto[client] && (buttons & IN_JUMP) > 0 && mtMoveType == MOVETYPE_WALK && !bInWater)
|
||||
{
|
||||
SetEntProp(client, Prop_Data, "m_nOldButtons", (iOldButtons &= ~IN_JUMP));
|
||||
}
|
||||
|
||||
int blockprejump = GetStyleSettingInt(gA_Timers[client].bsStyle, "blockprejump");
|
||||
|
||||
if (blockprejump < 0)
|
||||
{
|
||||
blockprejump = gCV_BlockPreJump.BoolValue;
|
||||
}
|
||||
|
||||
if (bInStart && blockprejump && GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 0 && (vel[2] > 0 || (buttons & IN_JUMP) > 0))
|
||||
{
|
||||
vel[2] = 0.0;
|
||||
buttons &= ~IN_JUMP;
|
||||
}
|
||||
|
||||
// enable duck-jumping/bhop in tf2
|
||||
if (gEV_Type == Engine_TF2 && GetStyleSettingBool(gA_Timers[client].bsStyle, "bunnyhopping") && (buttons & IN_JUMP) > 0 && iGroundEntity != -1)
|
||||
if (gEV_Type == Engine_TF2 && GetStyleSettingBool(gA_Timers[client].bsStyle, "bunnyhopping") && (buttons & IN_JUMP) > 0 && !(iOldButtons & IN_JUMP) && iGroundEntity != -1)
|
||||
{
|
||||
float fSpeed[3];
|
||||
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
|
||||
|
||||
fSpeed[2] = 289.0;
|
||||
SetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
|
||||
}
|
||||
|
||||
if (GetStyleSettingBool(gA_Timers[client].bsStyle, "autobhop") && gB_Auto[client] && (buttons & IN_JUMP) > 0 && mtMoveType == MOVETYPE_WALK && !bInWater)
|
||||
{
|
||||
int iOldButtons = GetEntProp(client, Prop_Data, "m_nOldButtons");
|
||||
SetEntProp(client, Prop_Data, "m_nOldButtons", (iOldButtons & ~IN_JUMP));
|
||||
DoJump(client);
|
||||
}
|
||||
|
||||
// perf jump measuring
|
||||
@ -3491,19 +3495,6 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
|
||||
}
|
||||
}
|
||||
|
||||
int blockprejump = GetStyleSettingInt(gA_Timers[client].bsStyle, "blockprejump");
|
||||
|
||||
if (blockprejump < 0)
|
||||
{
|
||||
blockprejump = gCV_BlockPreJump.BoolValue;
|
||||
}
|
||||
|
||||
if (bInStart && blockprejump && GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 0 && (vel[2] > 0 || (buttons & IN_JUMP) > 0))
|
||||
{
|
||||
vel[2] = 0.0;
|
||||
buttons &= ~IN_JUMP;
|
||||
}
|
||||
|
||||
// This can be bypassed by spamming +duck on CSS which causes `iGroundEntity` to be `-1` here...
|
||||
// (e.g. an autobhop + velocity_limit style...)
|
||||
// m_hGroundEntity changes from 0 -> -1 same tick which causes problems and I'm not sure what the best way / place to handle that is...
|
||||
|
||||
Loading…
Reference in New Issue
Block a user