From 29eb55de5d6d119233f6bc6d2b43edc22ae29ca2 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Wed, 19 Apr 2017 19:41:46 +0300 Subject: [PATCH] cat_autoheal_heal_steamid --- src/hacks/AutoHeal.cpp | 32 +++++++++++++++++++++++++++++++- src/hacks/ESP.cpp | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/hacks/AutoHeal.cpp b/src/hacks/AutoHeal.cpp index 4c9f0fc6..b4b3bb8c 100644 --- a/src/hacks/AutoHeal.cpp +++ b/src/hacks/AutoHeal.cpp @@ -23,6 +23,25 @@ static CatVar pop_uber_auto(CV_SWITCH, "autoheal_uber", "1", "AutoUber"); static CatVar pop_uber_percent(CV_FLOAT, "autoheal_uber_health", "30", "Pop uber if health% <"); static CatVar share_uber(CV_SWITCH, "autoheal_share_uber", "1", "Share ubercharge"); +int force_healing_target { 0 }; + +static CatCommand heal_steamid("autoheal_heal_steamid", "Heals a player with SteamID (ONCE. Use for easy airstuck med setup)", [](const CCommand& args) { + if (args.ArgC() < 2) { + logging::Info("Invalid call!"); + return; + } + for (int i = 1; i <= 32 && i < HIGHEST_ENTITY; i++) { + CachedEntity* ent = ENTITY(i); + if (CE_BAD(ent)) continue; + if (ent->m_Type != ENTITY_PLAYER) continue; + if (!ent->m_pPlayerInfo) continue; + if (ent->m_pPlayerInfo->friendsID == strtol(args.Arg(1), nullptr, 10)) { + force_healing_target = i; + return; + } + } +}); + bool IsPopped() { CachedEntity* weapon = g_pLocalPlayer->weapon(); if (CE_BAD(weapon) || weapon->m_iClassID != g_pClassID->CWeaponMedigun) return false; @@ -55,8 +74,19 @@ bool ShouldPop() { } void CreateMove() { - if (!enabled) return; + if (!enabled && !force_healing_target) return; if (GetWeaponMode(g_pLocalPlayer->entity) != weapon_medigun) return; + if (force_healing_target) { + CachedEntity* target = ENTITY(force_healing_target); + if (CE_GOOD(target)) { + Vector out; + GetHitbox(target, 7, out); + AimAt(g_pLocalPlayer->v_Eye, out, g_pUserCmd); + g_pUserCmd->buttons |= IN_ATTACK; + force_healing_target = 0; + } + } + if (!enabled) return; UpdateData(); int old_target = m_iCurrentHealingTarget; m_iCurrentHealingTarget = BestTarget(); diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 4ab3eff4..4591221c 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -293,7 +293,7 @@ void DrawBox(CachedEntity* ent, int clr, float widthFactor, float addHeight, boo if (healthbar) { int hp = colors::Transparent(colors::Health(health, healthmax), trf); - int hbh = (height) * min((float)health / (float)healthmax, 1.0f); + int hbh = (max_y - min_y) * min((float)health / (float)healthmax, 1.0f); draw::OutlineRect(min_x - 6, min_y, 7, max_y - min_y, border); draw::DrawRect(min_x - 5, max_y - hbh - 1, 5, hbh, hp); }