From 4357a9dc269a2fb7297acaf9ba5ad1bb2a48c6dd Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 26 Oct 2026 16:41:54 +0100 Subject: Aimbot: push smoothed angles to engine view + diagnostics --- src/esp.cpp | 35 ++++++++++++++++++++++++++++++++++- src/hl2h.cpp | 5 +++++ 2 files changed, 39 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/esp.cpp b/src/esp.cpp index 1cb8b70..bd3fbdb 100644 --- a/src/esp.cpp +++ b/src/esp.cpp @@ -397,8 +397,24 @@ bool aimbot_apply(CUserCmd *cmd) { best_head = approx; } - if (best_idx < 0) + if (best_idx < 0) { + static double last_none = 0.0; + double now = esp_now(); + if (now - last_none >= 2.0) { + last_none = now; + logf("aimbot: no hostile target within %.0f deg", MAX_FOV); + } return false; + } + + static int sel_logs = 0; + if (sel_logs < 5) { + sel_logs++; + logf("aimbot: target idx=%d fov=%.2f eye=(%.1f %.1f %.1f) " + "approx_head=(%.1f %.1f %.1f)", + best_idx, best_fov, g_cam_eye.x, g_cam_eye.y, g_cam_eye.z, + best_head.x, best_head.y, best_head.z); + } // Refine to the actual head hitbox/bone for the chosen target only. void *best_ent = entitylist_get(best_idx); @@ -422,6 +438,8 @@ bool aimbot_apply(CUserCmd *cmd) { return false; float scale = (maxd > MAX_STEP) ? (MAX_STEP / maxd) : 1.0f; + float old_pitch = cmd->viewangles[0]; + float old_yaw = cmd->viewangles[1]; float np = cmd->viewangles[0] + dp * scale; float ny = cmd->viewangles[1] + dy * scale; if (np > 89.0f) np = 89.0f; @@ -430,6 +448,21 @@ bool aimbot_apply(CUserCmd *cmd) { while (ny < -180.0f) ny += 360.0f; cmd->viewangles[0] = np; cmd->viewangles[1] = ny; + + // cmd->viewangles drives usercmd/prediction, but the rendered camera can + // stay on the pre-hook angles. Also push the smoothed angles into the + // engine's view (IVEngineClient013 slot 20 = SetViewAngles). + if (g_iface.engine) { + QAngle out{np, ny, 0.0f}; + using SetViewFn = void (*)(void *, QAngle *); + vfunc(g_iface.engine, 20)(g_iface.engine, &out); + } + + static int mod_logs = 0; + if (mod_logs < 10) { + mod_logs++; + logf("aimbot: view %.2f/%.2f -> %.2f/%.2f", old_pitch, old_yaw, np, ny); + } return true; } diff --git a/src/hl2h.cpp b/src/hl2h.cpp index 21fa7ae..de5d194 100644 --- a/src/hl2h.cpp +++ b/src/hl2h.cpp @@ -243,6 +243,11 @@ static void do_move(int seq) { } if (feature_active(FEAT_AIMBOT)) { + static bool aim_feature_logged = false; + if (!aim_feature_logged) { + aim_feature_logged = true; + logf("aimbot: feature active (bind held)"); + } if (aimbot_apply(cmd)) { const float *vel = (const float *)(e + g_net.velocity); note_modified(cmd, flags, vel); -- cgit v1.2.3