From ccdcd4ad0483b98c9c20bd1304ad062ef8af3a4b Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 26 Oct 2026 16:39:11 +0100 Subject: Aimbot: head-only nearest-to-crosshair with bounded smoothing - select the hostile NPC whose (approximate) head is closest in angle to the crosshair, then refine to its actual head hitbox/bone - aimbot menu feature (Active + Bind, default Mouse5, rebindable via the existing bind chooser); config [aimbot] active/bind - never snap: move at most 5 degrees per tick toward the target, shortest-path yaw, pitch clamped to +/-89, 0.05 degree deadzone; no overshoot/oscillation - fixes the usercmd CRC after modifying viewangles - skip when dead; ignores friendly/neutral entities (crows, citizens, ...) --- src/menu.cpp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src/menu.cpp') diff --git a/src/menu.cpp b/src/menu.cpp index 6474d69..269174d 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -56,6 +56,7 @@ static bool g_bhop_autostrafe = true; static FeatureState g_abh{true, 0}; static FeatureState g_esp{true, 0}; +static FeatureState g_aimbot{true, 604}; // default Mouse5, rebindable in menu // ESP sub-options (menu "ESP" children). Defaults match the pre-option // behaviour: everything on. @@ -77,6 +78,9 @@ static MenuNode g_esp_opt_nodes[ESP_OPT_COUNT] = { {NODE_TOGGLE, "Show name", false, 0, {}, &g_esp_opt[ESP_OPT_SHOW_NAME], nullptr, nullptr}, {NODE_TOGGLE, "Show skeleton", false, 0, {}, &g_esp_opt[ESP_OPT_SHOW_SKELETON], nullptr, nullptr}, }; +static MenuNode g_aimbot_feat{NODE_FEATURE, "Aimbot", false, 1, {}, nullptr, nullptr, nullptr}; +static MenuNode g_aimbot_active{NODE_TOGGLE, "Active", false, 0, {}, &g_aimbot.active, nullptr, nullptr}; +static MenuNode g_aimbot_bind{NODE_BIND, "Bind", false, 0, {}, nullptr, &g_aimbot.bind, nullptr}; static MenuNode *g_visible[32]; // flattened visible nodes for arrow navigation static int g_visible_count = 0; @@ -90,13 +94,17 @@ static void build_tree() { g_bhop_feat.child_count = 2; g_abh_feat.children[0] = &g_abh_active; g_esp_feat.children[0] = &g_esp_active; + g_aimbot_feat.children[0] = &g_aimbot_active; + g_aimbot_feat.children[1] = &g_aimbot_bind; + g_aimbot_feat.child_count = 2; for (int i = 0; i < ESP_OPT_COUNT; i++) g_esp_feat.children[i + 1] = &g_esp_opt_nodes[i]; g_esp_feat.child_count = ESP_OPT_COUNT + 1; g_root.children[0] = &g_bhop_feat; g_root.children[1] = &g_abh_feat; g_root.children[2] = &g_esp_feat; - g_root.child_count = 3; + g_root.children[3] = &g_aimbot_feat; + g_root.child_count = 4; } static int g_depth[32]; // depth of each visible row (for indentation) @@ -159,6 +167,8 @@ static void config_save() { fprintf(f, "[bhop]\nactive=%d\nbind=%d\nautostrafe=%d\n", g_bhop.active, g_bhop.bind, g_bhop_autostrafe); fprintf(f, "[abh]\nactive=%d\nbind=%d\n", g_abh.active, g_abh.bind); + fprintf(f, "[aimbot]\nactive=%d\nbind=%d\n", g_aimbot.active, + g_aimbot.bind); fprintf(f, "[esp]\nactive=%d\nbind=%d\nneutral=%d\nhealthbar=%d\n" "healthnum=%d\nname=%d\nskeleton=%d\n", g_esp.active, g_esp.bind, g_esp_opt[ESP_OPT_SHOW_NEUTRAL], @@ -184,6 +194,8 @@ static void config_load() { cur = &g_abh; else if (strstr(line, "[esp]")) cur = &g_esp; + else if (strstr(line, "[aimbot]")) + cur = &g_aimbot; else cur = nullptr; in_esp = (cur == &g_esp); @@ -319,8 +331,8 @@ static bool key_pressed(int sc) { // feature gate queried from hl2h.cpp do_move(): feature must be Active AND // its bind key held (always-on when unbound). bool feature_active(int feature) { - static FeatureState *feats[3] = {&g_bhop, &g_abh, &g_esp}; - if (feature < 0 || feature > 2) + static FeatureState *feats[4] = {&g_bhop, &g_abh, &g_esp, &g_aimbot}; + if (feature < 0 || feature > 3) return false; FeatureState *f = feats[feature]; if (!f->active) @@ -376,7 +388,7 @@ static void menu_handle_input() { MenuNode *n = g_visible[g_selected]; if (n->bind_ptr) { // clear same bind from other features - FeatureState *features[] = {&g_bhop, &g_abh}; + FeatureState *features[] = {&g_bhop, &g_abh, &g_aimbot}; for (auto *f : features) if (&f->bind != n->bind_ptr && f->bind == i) f->bind = 0; @@ -578,10 +590,10 @@ void outer_draw() { draw_text(270, 10 + i * 20, "[press key]"); else { /* stable name for current bind */ - static char bn[2][32]; - static FeatureState *feats[] = {&g_bhop, &g_abh}; + static char bn[3][32]; + static FeatureState *feats[] = {&g_bhop, &g_abh, &g_aimbot}; int fi = 0; - for (int k = 0; k < 2; k++) + for (int k = 0; k < 3; k++) if (n->bind_ptr == &feats[k]->bind) fi = k; snprintf(bn[fi], 32, "[%s]", scancode_name(*n->bind_ptr)); -- cgit v1.2.3