Crit hack is now a CV_KEY, not a CV_SWITCH.

This commit is contained in:
nullifiedcat 2017-05-01 16:23:15 +03:00
parent d7c86c6ae9
commit aaff2a3d8c
3 changed files with 10 additions and 5 deletions

View File

@ -15,15 +15,19 @@ std::unordered_map<int, int> command_number_mod {};
int* g_PredictionRandomSeed = nullptr; int* g_PredictionRandomSeed = nullptr;
bool CritKeyDown() {
return g_IInputSystem->IsButtonDown(static_cast<ButtonCode_t>((int)hacks::shared::misc::crit_hack));
}
bool AllowAttacking() { 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); bool crit = IsAttackACrit(g_pUserCmd);
LoadSavedState(); 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)) { if (crit && !IsPlayerCritBoosted(LOCAL_E)) {
return false; 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; if (!crit) return false;
} }
return true; return true;

View File

@ -24,6 +24,7 @@ struct crithack_saved_state {
void Load(IClientEntity* entity); void Load(IClientEntity* entity);
}; };
bool CritKeyDown();
bool AllowAttacking(); bool AllowAttacking();
bool RandomCrits(); bool RandomCrits();
bool WeaponCanCrit(); bool WeaponCanCrit();

View File

@ -219,7 +219,7 @@ void CreateMove() {
void Draw() { void Draw() {
if (crit_info && CE_GOOD(LOCAL_W)) { if (crit_info && CE_GOOD(LOCAL_W)) {
if (crit_hack) { if (CritKeyDown()) {
AddCenterString("FORCED CRITS!", colors::red); AddCenterString("FORCED CRITS!", colors::red);
} }
if (TF2) { 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 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 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_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_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 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"); CatVar anti_afk(CV_SWITCH, "anti_afk", "0", "Anti-AFK", "Sends random commands to prevent being kicked from server");