From aaff2a3d8c99194d71125b4458d365b346facd1f Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Mon, 1 May 2017 16:23:15 +0300 Subject: [PATCH] Crit hack is now a CV_KEY, not a CV_SWITCH. --- src/crits.cpp | 10 +++++++--- src/crits.h | 1 + src/hacks/Misc.cpp | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/crits.cpp b/src/crits.cpp index ce0cc8a6..bceedcba 100644 --- a/src/crits.cpp +++ b/src/crits.cpp @@ -15,15 +15,19 @@ std::unordered_map command_number_mod {}; int* g_PredictionRandomSeed = nullptr; +bool CritKeyDown() { + return g_IInputSystem->IsButtonDown(static_cast((int)hacks::shared::misc::crit_hack)); +} + bool AllowAttacking() { - if (!(hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && !hacks::shared::misc::crit_suppress) return true; + if (!(CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && !hacks::shared::misc::crit_suppress) return true; bool crit = IsAttackACrit(g_pUserCmd); LoadSavedState(); - if (hacks::shared::misc::crit_suppress && !(hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee))) { + if (hacks::shared::misc::crit_suppress && !(CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee))) { if (crit && !IsPlayerCritBoosted(LOCAL_E)) { return false; } - } else if ((hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && RandomCrits() && WeaponCanCrit() && (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFKnife)) { + } else if ((CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && RandomCrits() && WeaponCanCrit() && (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFKnife)) { if (!crit) return false; } return true; diff --git a/src/crits.h b/src/crits.h index 84a9986f..e783478c 100644 --- a/src/crits.h +++ b/src/crits.h @@ -24,6 +24,7 @@ struct crithack_saved_state { void Load(IClientEntity* entity); }; +bool CritKeyDown(); bool AllowAttacking(); bool RandomCrits(); bool WeaponCanCrit(); diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index 0caaa235..d2b25c0f 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -219,7 +219,7 @@ void CreateMove() { void Draw() { if (crit_info && CE_GOOD(LOCAL_W)) { - if (crit_hack) { + if (CritKeyDown()) { AddCenterString("FORCED CRITS!", colors::red); } if (TF2) { @@ -319,7 +319,7 @@ void Schema_Reload() { CatVar debug_info(CV_SWITCH, "debug_info", "0", "Debug info", "Shows some debug info in-game"); CatVar flashlight_spam(CV_SWITCH, "flashlight", "0", "Flashlight spam", "HL2DM flashlight spam"); CatVar crit_info(CV_SWITCH, "crit_info", "0", "Show crit info"); // TODO separate -CatVar crit_hack(CV_SWITCH, "crit_hack", "0", "Crithack"); +CatVar crit_hack(CV_KEY, "crit_hack", "0", "Crit Key"); CatVar crit_melee(CV_SWITCH, "crit_melee", "0", "Melee crits"); CatVar crit_suppress(CV_SWITCH, "crit_suppress", "0", "Disable random crits", "Can help saving crit bucket for forced crits"); CatVar anti_afk(CV_SWITCH, "anti_afk", "0", "Anti-AFK", "Sends random commands to prevent being kicked from server");