From 4ccc490c837911731fff13249f444e7a0164aa0f Mon Sep 17 00:00:00 2001 From: vicinity-gush8 <88168049+vicinity-gush8@users.noreply.github.com> Date: Sat, 18 Dec 2021 13:31:48 +0100 Subject: [PATCH] Fix some issues --- data/menu/nullifiedcat/visuals/uicolors.xml | 2 + src/hacks/Aimbot.cpp | 63 +++++---------------- src/hacks/AutoBackstab.cpp | 13 +++-- src/hacks/AutoHeal.cpp | 49 +++++++++++----- src/hacks/MiscAimbot.cpp | 56 ++++-------------- src/nospread.cpp | 22 +++---- 6 files changed, 81 insertions(+), 124 deletions(-) diff --git a/data/menu/nullifiedcat/visuals/uicolors.xml b/data/menu/nullifiedcat/visuals/uicolors.xml index 0a21c965..baa11b6a 100755 --- a/data/menu/nullifiedcat/visuals/uicolors.xml +++ b/data/menu/nullifiedcat/visuals/uicolors.xml @@ -29,6 +29,8 @@ + + diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 01eb3d7f..8cb6a723 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -1502,68 +1502,33 @@ bool VischeckPredictedEntity(CachedEntity *entity) return cd.visible; } -static float slow_change_dist_p = 0; -static float slow_change_dist_y = 0; - // A helper function to find a user angle that isnt directly on the target // angle, effectively slowing the aiming process void DoSlowAim(Vector &input_angle) { - auto viewangles = current_user_cmd->viewangles; + auto viewangles = current_user_cmd->viewangles; + Vector slow_delta = { 0, 0, 0 }; - // Yaw - if (viewangles.y != input_angle.y) + // Don't bother if we're already on target + if (viewangles != input_angle) { + slow_delta = input_angle - viewangles; - // Check if input angle and user angle are on opposing sides of yaw so - // we can correct for that - bool slow_opposing = false; - if ((input_angle.y < -90 && viewangles.y > 90) || (input_angle.y > 90 && viewangles.y < -90)) - slow_opposing = true; + if (slow_delta.y > 180) + slow_delta.y -= 360; + if (slow_delta.y < -180) + slow_delta.y += 360; - // Direction - bool slow_dir = false; - if (slow_opposing) - { - if (input_angle.y > 90 && viewangles.y < -90) - slow_dir = true; - } - else if (viewangles.y > input_angle.y) - slow_dir = true; + slow_delta /= slow_aim; + input_angle = viewangles + slow_delta; - // Speed, check if opposing. We dont get a new distance due to the - // opposing sides making the distance spike, so just cheap out and reuse - // our last one. - if (!slow_opposing) - slow_change_dist_y = std::abs(viewangles.y - input_angle.y) / (int) slow_aim; - - // Move in the direction of the input angle - if (slow_dir) - input_angle.y = viewangles.y - slow_change_dist_y; - else - input_angle.y = viewangles.y + slow_change_dist_y; + // Clamp as we changed angles + fClampAngle(input_angle); } - - // Pitch - if (viewangles.x != input_angle.x) - { - // Get speed - slow_change_dist_p = std::abs(viewangles.x - input_angle.x) / (int) slow_aim; - - // Move in the direction of the input angle - if (viewangles.x > input_angle.x) - input_angle.x = viewangles.x - slow_change_dist_p; - else - input_angle.x = viewangles.x + slow_change_dist_p; - } - // 0.17 is a good amount in general slow_can_shoot = false; - if (slow_change_dist_y < 0.17 && slow_change_dist_p < 0.17) + if (std::abs(slow_delta.y) < 0.17 && std::abs(slow_delta.x) < 0.17) slow_can_shoot = true; - - // Clamp as we changed angles - fClampAngle(input_angle); } // A function that determins whether aimkey allows aiming diff --git a/src/hacks/AutoBackstab.cpp b/src/hacks/AutoBackstab.cpp index ab2294ce..c36a48a6 100644 --- a/src/hacks/AutoBackstab.cpp +++ b/src/hacks/AutoBackstab.cpp @@ -280,6 +280,9 @@ static bool doRageBackstab() continue; if (doSwingTraceAngle(angle, trace)) { + // Make sure trace hit the enemy + if ((IClientEntity *) trace.m_pEnt != g_IEntityList->GetClientEntity(ent->m_IDX)) + return false; current_user_cmd->buttons |= IN_ATTACK; g_pLocalPlayer->bUseSilentAngles = true; current_user_cmd->viewangles = angle; @@ -444,8 +447,10 @@ void CreateMove() } } -static InitRoutine EC([]() { - EC::Register(EC::CreateMove, CreateMove, "autobackstab", EC::average); - EC::Register(EC::CreateMoveWarp, CreateMove, "autobackstab_w", EC::average); -}); +static InitRoutine EC( + []() + { + EC::Register(EC::CreateMove, CreateMove, "autobackstab", EC::average); + EC::Register(EC::CreateMoveWarp, CreateMove, "autobackstab_w", EC::average); + }); } // namespace hacks::tf2::autobackstab diff --git a/src/hacks/AutoHeal.cpp b/src/hacks/AutoHeal.cpp index 868b34bd..ca7ca518 100644 --- a/src/hacks/AutoHeal.cpp +++ b/src/hacks/AutoHeal.cpp @@ -672,28 +672,37 @@ void CreateMove() if (!CurrentHealingTargetIDX) return; - CachedEntity *target = ENTITY(CurrentHealingTargetIDX); + CachedEntity *target = ENTITY(CurrentHealingTargetIDX); + bool target_is_healing_target = HandleToIDX(CE_INT(LOCAL_W, netvar.m_hHealingTarget)) == CurrentHealingTargetIDX; - - if (!target_is_healing_target || look_at_target) + auto out = target->hitboxes.GetHitbox(spine_2); + if (out) { - auto out = target->hitboxes.GetHitbox(spine_2); - if (out) + if (silent) + g_pLocalPlayer->bUseSilentAngles = true; + + // Follow the target using slowaim + if (target_is_healing_target && look_at_target) { - if (silent) - g_pLocalPlayer->bUseSilentAngles = true; - auto angles = GetAimAtAngles(g_pLocalPlayer->v_Eye, out->center); - - // If we are already healing our target, then follow the target using slowaim - if (target_is_healing_target) - hacks::tf2::misc_aimbot::DoSlowAim(angles); - + Vector angles = GetAimAtAngles(g_pLocalPlayer->v_Eye, out->center); + hacks::tf2::misc_aimbot::DoSlowAim(angles); current_user_cmd->viewangles = angles; - if (!target_is_healing_target && (g_GlobalVars->tickcount % 2) == 0) - current_user_cmd->buttons |= IN_ATTACK; } + + // Set angles to new target + if (!target_is_healing_target) + current_user_cmd->viewangles = GetAimAtAngles(g_pLocalPlayer->v_Eye, out->center); } + int autoheal_mode = g_ICvar->FindVar("tf_medigun_autoheal")->GetInt(); + // Hold down if we are currently healing our target or not healing anyone + if (autoheal_mode == 0 && (target_is_healing_target || CE_INT(LOCAL_W, netvar.m_hHealingTarget) == -1)) + current_user_cmd->buttons |= IN_ATTACK; + + // Press once if we are not healing our target + else if (autoheal_mode == 1 && !target_is_healing_target) + current_user_cmd->buttons |= IN_ATTACK; + if (IsVaccinator() && CE_GOOD(target) && auto_vacc) { int opt = OptimalResistance(target, &pop); @@ -703,6 +712,16 @@ void CreateMove() { current_user_cmd->buttons |= IN_ATTACK2; } + // Uber on "CHARGE ME DOCTOR!" + if (pop_uber_voice) + { + auto uber_array = std::move(called_medic); + for (auto i : uber_array) + if (i == CurrentHealingTargetIDX) + { + current_user_cmd->buttons |= IN_ATTACK2; + } + } } else { diff --git a/src/hacks/MiscAimbot.cpp b/src/hacks/MiscAimbot.cpp index b134d39c..cf22f007 100644 --- a/src/hacks/MiscAimbot.cpp +++ b/src/hacks/MiscAimbot.cpp @@ -208,56 +208,22 @@ void DoSlowAim(Vector &input_angle, int speed) { auto viewangles = current_user_cmd->viewangles; - // Yaw - if (viewangles.y != input_angle.y) + // Don't bother if we're already on target + if (viewangles != input_angle) { - float flChargeYawCap = re::CTFPlayerShared::CalculateChargeCap(re::CTFPlayerShared::GetPlayerShared(RAW_ENT(LOCAL_E))); - flChargeYawCap *= 2.5f; + Vector slow_delta = input_angle - viewangles; - // Check if input angle and user angle are on opposing sides of yaw so - // we can correct for that - bool slow_opposing = false; - if ((input_angle.y < -90 && viewangles.y > 90) || (input_angle.y > 90 && viewangles.y < -90)) - slow_opposing = true; + if (slow_delta.y > 180) + slow_delta.y -= 360; + if (slow_delta.y < -180) + slow_delta.y += 360; - // Direction - bool slow_dir = false; - if (slow_opposing) - { - if (input_angle.y > 90 && viewangles.y < -90) - slow_dir = true; - } - else if (viewangles.y > input_angle.y) - slow_dir = true; + slow_delta /= speed; + input_angle = viewangles + slow_delta; - // Speed, check if opposing. We dont get a new distance due to the - // opposing sides making the distance spike, so just cheap out and reuse - // our last one. - if (!slow_opposing) - slow_change_dist_y = std::abs(viewangles.y - input_angle.y) / (int) speed; - - // Move in the direction of the input angle - if (slow_dir) - input_angle.y = viewangles.y - slow_change_dist_y; - else - input_angle.y = viewangles.y + slow_change_dist_y; + // Clamp as we changed angles + fClampAngle(input_angle); } - - // Pitch - if (viewangles.x != input_angle.x) - { - // Get speed - slow_change_dist_p = std::abs(viewangles.x - input_angle.x) / speed; - - // Move in the direction of the input angle - if (viewangles.x > input_angle.x) - input_angle.x = viewangles.x - slow_change_dist_p; - else - input_angle.x = viewangles.x + slow_change_dist_p; - } - - // Clamp as we changed angles - fClampAngle(input_angle); } static void SandwichAim() diff --git a/src/nospread.cpp b/src/nospread.cpp index ea86ef42..f855e1e8 100644 --- a/src/nospread.cpp +++ b/src/nospread.cpp @@ -47,8 +47,7 @@ settings::Boolean draw_mantissa{ "nospread.draw-info.mantissa", "false" }; settings::Boolean correct_ping{ "nospread.correct-ping", "true" }; settings::Boolean use_avg_latency{ "nospread.use-average-latency", "false" }; settings::Boolean extreme_accuracy{ "nospread.use-extreme-accuracy", "false" }; -static bool should_nospread = false; -bool is_syncing = false; +bool is_syncing = false; bool shouldNoSpread(bool _projectile) { @@ -95,24 +94,25 @@ void CreateMove() // Beggars check if (CE_INT(LOCAL_W, netvar.iItemDefinitionIndex) == 730) { - // Check if we released the barrage by releasing m1, also lock bool so people don't just release m1 and tap it again - if (!should_nospread) - should_nospread = !(current_late_user_cmd->buttons & IN_ATTACK) && g_pLocalPlayer->bAttackLastTick; + bool should_nospread = !(current_late_user_cmd->buttons & IN_ATTACK); + // Check if player is charging rockets if (!CE_INT(LOCAL_W, netvar.m_iClip1) && CE_INT(LOCAL_W, netvar.iReloadMode) == 0) - { - // Reset should_nospread = false; - return; - } - // Cancel + if (!should_nospread) return; } // Huntsman check else if (LOCAL_W->m_iClassID() == CL_CLASS(CTFCompoundBow)) { - if (!g_pLocalPlayer->bAttackLastTick || (current_late_user_cmd->buttons & IN_ATTACK)) + bool should_nospread = !(current_late_user_cmd->buttons & IN_ATTACK); + + // Check if player is charging an arrow + if (CE_FLOAT(LOCAL_W, netvar.flChargeBeginTime) == 0) + should_nospread = false; + + if (!should_nospread) return; } // Rest of weapons