alter bhop functionality

This commit is contained in:
rei-2
2026-05-18 13:15:56 -04:00
parent d7171d57e9
commit 8411a58c5b
3 changed files with 13 additions and 17 deletions
@@ -104,15 +104,15 @@ void CAntiCheatCompatibility::RespondCvarValue(INetMessage& msg)
SDK::Output("Convar spoof", std::format("{}: {} ({})", pMsg->m_szCvarName, pMsg->m_szCvarValue, msg.ToString()).c_str(), Vars::Menu::Theme::Accent.Value, Vars::Debug::Logging.Value);
}
void CAntiCheatCompatibility::BunnyHop(CUserCmd* pCmd, bool bCurGrounded, bool bLastGrounded)
void CAntiCheatCompatibility::BunnyHop(CUserCmd* pCmd, bool bCurrValid, bool bLastValid)
{
if (!Active())
return;
// prevent more than 9 bhops occurring. if a server has this under that threshold they're retarded anyways
if (bCurGrounded)
if (bCurrValid)
{
if (!bLastGrounded && pCmd->buttons & IN_JUMP)
if (!bLastValid && pCmd->buttons & IN_JUMP && !(G::LastUserCmd->buttons & IN_JUMP))
m_iJumps++;
else
m_iJumps = 0;
@@ -24,7 +24,7 @@ private:
public:
void CreateMove(CUserCmd* pCmd, bool* pSendPacket);
void BunnyHop(CUserCmd* pCmd, bool bCurGrounded, bool bLastGrounded);
void BunnyHop(CUserCmd* pCmd, bool bCurrValid, bool bLastValid);
void RespondCvarValue(INetMessage& msg);
inline bool Active() { return Vars::Misc::Game::AntiCheatCompatibility.Value; }
+9 -13
View File
@@ -57,20 +57,16 @@ void CMisc::AutoJump(CTFPlayer* pLocal, CUserCmd* pCmd)
if (auto pWeapon = H::Entities.GetWeapon(); pWeapon && pWeapon->GetWeaponID() == TF_WEAPON_GRAPPLINGHOOK && pWeapon->As<CTFGrapplingHook>()->m_hProjectile())
return;
static bool bStaticJump = false, bStaticGrounded = false, bLastAttempted = false;
const bool bLastJump = bStaticJump, bLastGrounded = bStaticGrounded;
const bool bCurJump = bStaticJump = pCmd->buttons & IN_JUMP, bCurGrounded = bStaticGrounded = pLocal->m_hGroundEntity();
static bool bStaticAttempted = false, bStaticValid = false;
const bool bLastAttempted = bStaticAttempted, bLastValid = bStaticValid;
const bool bCurrAttempted = bStaticAttempted = G::OriginalCmd.buttons & IN_JUMP, bCurrValid = bStaticValid = pLocal->m_hGroundEntity() && !pLocal->IsDucking();
const bool bManual = !(SDK::AttribHookValue(0, "parachute_attribute", pLocal) && !pLocal->InCond(TF_COND_PARACHUTE_ACTIVE) && !(G::OriginalCmd.buttons & IN_DUCK)); // evil we don't want to manual
if (bCurJump && bLastJump && (bCurGrounded ? !pLocal->IsDucking() : true))
{
if (!(bCurGrounded && !bLastGrounded))
pCmd->buttons &= ~IN_JUMP;
if (!(pCmd->buttons & IN_JUMP) && bCurGrounded && !bLastAttempted)
pCmd->buttons |= IN_JUMP;
}
F::AntiCheatCompatibility.BunnyHop(pCmd, bCurGrounded, bLastGrounded);
bLastAttempted = pCmd->buttons & IN_JUMP;
if (!bCurrValid || bCurrValid && G::LastUserCmd->buttons & IN_JUMP)
pCmd->buttons &= ~IN_JUMP;
if (bCurrAttempted && !bLastAttempted && bManual)
pCmd->buttons |= IN_JUMP;
F::AntiCheatCompatibility.BunnyHop(pCmd, bCurrValid, bLastValid);
}
void CMisc::AutoJumpbug(CTFPlayer* pLocal, CUserCmd* pCmd)