diff --git a/src/features/anti_aim.c b/src/features/anti_aim.c index 47f852d..6d09375 100644 --- a/src/features/anti_aim.c +++ b/src/features/anti_aim.c @@ -8,6 +8,25 @@ #include "../include/sdk.h" #include "../include/settings.h" #include "../include/util.h" +#include "../include/globals.h" + +#define AA_PITCH_NONE 0 +#define AA_PITCH_DOWN 1 +#define AA_PITCH_UP 2 +#define AA_PITCH_ZERO 3 +#define AA_PITCH_JITTER 4 +#define AA_PITCH_CUSTOM 5 + +#define AA_YAW_NONE 0 +#define AA_YAW_BACKWARD 1 +#define AA_YAW_SPIN 2 +#define AA_YAW_JITTER 3 +#define AA_YAW_SIDEWAYS 4 +#define AA_YAW_CUSTOM 5 + +static float spin_angle = 0.0f; +static float last_update_time = 0.0f; +static float jitter_next_update = 0.0f; float random_float(float min, float max) { return (max - min) * ((float)rand() / (float)RAND_MAX) + min; @@ -28,17 +47,160 @@ bool isSpacebarPressed() { return pressed; } -void anti_aim(usercmd_t* cmd) { - if (cmd->buttons & IN_ATTACK || cmd->buttons & IN_USE) { - if (cmd->buttons & IN_ATTACK) { - i_engine->pfnClientCmd("echo \"Attack detected. Spinbot stopped.\""); - } else if (cmd->buttons & IN_USE) { - i_engine->pfnClientCmd("echo \"Use key detected. Spinbot stopped.\""); - } - return; +bool is_key_pressed(int key_code) { + if (key_code <= 0) { + return false; + } + + Display* display = XOpenDisplay(NULL); + if (!display) { + return false; } - if (!g_settings.antiaim) { + char keys_return[32]; + XQueryKeymap(display, keys_return); + + KeyCode kc; + if (key_code >= 'A' && key_code <= 'Z') { + kc = XKeysymToKeycode(display, XK_a + (key_code - 'A')); + } else if (key_code >= 'a' && key_code <= 'z') { + kc = XKeysymToKeycode(display, XK_a + (key_code - 'a')); + } else { + switch (key_code) { + case K_SPACE: kc = XKeysymToKeycode(display, XK_space); break; + case K_CTRL: kc = XKeysymToKeycode(display, XK_Control_L); break; + case K_SHIFT: kc = XKeysymToKeycode(display, XK_Shift_L); break; + case K_ALT: kc = XKeysymToKeycode(display, XK_Alt_L); break; + case K_TAB: kc = XKeysymToKeycode(display, XK_Tab); break; + default: kc = XKeysymToKeycode(display, key_code); + } + } + + bool pressed = (keys_return[kc >> 3] & (1 << (kc & 7))) != 0; + XCloseDisplay(display); + return pressed; +} + +void apply_pitch_anti_aim(vec3_t* view_angles, int pitch_mode, float custom_pitch) { + switch (pitch_mode) { + case AA_PITCH_DOWN: + view_angles->x = 89.0f; + break; + case AA_PITCH_UP: + view_angles->x = -89.0f; + break; + case AA_PITCH_ZERO: + view_angles->x = 0.0f; + break; + case AA_PITCH_JITTER: { + static bool flip_pitch = false; + if (flip_pitch) { + view_angles->x = 89.0f; + } else { + view_angles->x = -89.0f; + } + + if (g_flCurrentTime > jitter_next_update) { + flip_pitch = !flip_pitch; + jitter_next_update = g_flCurrentTime + random_float(0.1f, 0.3f); + } + break; + } + case AA_PITCH_CUSTOM: + view_angles->x = CLAMP(custom_pitch, -89.0f, 89.0f); + break; + default: + break; + } +} + +void apply_yaw_anti_aim(vec3_t* view_angles, int yaw_mode, float custom_yaw, float speed, float jitter_range) { + float time_now; + float time_delta; + static bool is_left = true; + + switch (yaw_mode) { + case AA_YAW_BACKWARD: + view_angles->y += 180.0f; + break; + case AA_YAW_SPIN: + time_now = g_flCurrentTime; + time_delta = time_now - last_update_time; + + spin_angle += time_delta * speed; + + if (spin_angle > 360.0f) { + spin_angle -= 360.0f; + } + + view_angles->y = spin_angle; + + last_update_time = time_now; + break; + case AA_YAW_JITTER: + if (g_flCurrentTime > jitter_next_update) { + view_angles->y += random_float(-jitter_range, jitter_range); + jitter_next_update = g_flCurrentTime + random_float(0.1f, 0.3f); + } + break; + case AA_YAW_SIDEWAYS: + if (g_flCurrentTime > jitter_next_update) { + is_left = !is_left; + jitter_next_update = g_flCurrentTime + random_float(0.5f, 1.5f); + } + + if (is_left) { + view_angles->y += 90.0f; + } else { + view_angles->y -= 90.0f; + } + break; + case AA_YAW_CUSTOM: + view_angles->y = custom_yaw; + break; + default: + break; + } +} + +void apply_lby_breaker(vec3_t* view_angles, bool enable_breaker) { + if (!enable_breaker) + return; + + static bool lby_update = false; + static float next_lby_update = 0.0f; + + if (g_flCurrentTime > next_lby_update) { + lby_update = !lby_update; + next_lby_update = g_flCurrentTime + 1.1f; + + if (lby_update) { + view_angles->y += 120.0f; + } + } +} + +void apply_fake_duck(usercmd_t* cmd, bool enable_duck) { + if (!enable_duck) + return; + + static int duck_state = 0; + static float next_duck_time = 0.0f; + + if (g_flCurrentTime > next_duck_time) { + duck_state = (duck_state + 1) % 4; + next_duck_time = g_flCurrentTime + 0.05f; + } + + if (duck_state < 2) { + cmd->buttons |= IN_DUCK; + } else { + cmd->buttons &= ~IN_DUCK; + } +} + +void anti_aim(usercmd_t* cmd) { + if (!g_settings.antiaim_enabled) { return; } @@ -46,54 +208,102 @@ void anti_aim(usercmd_t* cmd) { return; } + if ((cmd->buttons & IN_ATTACK) && !g_settings.antiaim_on_attack) { + return; + } + + if (cmd->buttons & IN_USE) { + return; + } + vec3_t view_angles; i_engine->GetViewAngles(view_angles); - static bool lbyBreak = false; - if (lbyBreak) { - view_angles.y += 120.0f; - } - lbyBreak = !lbyBreak; - - static bool flipPitch = false; - if (flipPitch) { - view_angles.x = 89.0f; - } else { - view_angles.x = -89.0f; - } - flipPitch = !flipPitch; - - view_angles.y += 30.0f; - - bool isBunnyHopping = cmd->buttons & IN_JUMP; - bool isStationary = (cmd->forwardmove == 0.0f && cmd->sidemove == 0.0f); - - if (g_settings.fakeduck && (isStationary || isBunnyHopping || isSpacebarPressed())) { - static int duckCounter = 0; - if (duckCounter < 2) { - cmd->buttons |= IN_DUCK; - } else if (duckCounter < 4) { - cmd->buttons &= ~IN_DUCK; + if (g_settings.antiaim_pitch_enabled) { + if (g_settings.antiaim_pitch_mode == 0) { + view_angles.x = g_settings.antiaim_pitch; + + view_angles.x = CLAMP(view_angles.x, -89.0f, 89.0f); } else { - duckCounter = 0; + apply_pitch_anti_aim(&view_angles, g_settings.antiaim_pitch_mode, g_settings.antiaim_custom_pitch); + } + + static float last_debug_time = 0.0f; + if (g_flCurrentTime > last_debug_time + 5.0f) { + i_engine->Con_Printf("Anti-Aim: Applied pitch angle %.1f (mode %d)\n", + view_angles.x, g_settings.antiaim_pitch_mode); + last_debug_time = g_flCurrentTime; + } + } + + if (g_settings.antiaim_yaw_enabled) { + if (g_settings.antiaim_yaw_mode == 0) { + if (g_settings.antiaim_legit) { + float legit_yaw_max = 35.0f; + view_angles.y += CLAMP(g_settings.antiaim_yaw, -legit_yaw_max, legit_yaw_max); + } else { + view_angles.y += g_settings.antiaim_yaw; + } + } else { + apply_yaw_anti_aim(&view_angles, g_settings.antiaim_yaw_mode, g_settings.antiaim_custom_yaw, + g_settings.antiaim_spin_speed, g_settings.antiaim_jitter_range); + } + + if (view_angles.y > 180.0f) view_angles.y -= 360.0f; + if (view_angles.y < -180.0f) view_angles.y += 360.0f; + } + + apply_lby_breaker(&view_angles, g_settings.antiaim_lby_breaker); + + if (g_settings.antiaim_desync) { + static bool switch_side = false; + static float next_switch = 0.0f; + + if (g_flCurrentTime > next_switch) { + switch_side = !switch_side; + next_switch = g_flCurrentTime + random_float(0.4f, 0.8f); + } + + float desync_amount = switch_side ? 58.0f : -58.0f; + + static vec3_t real_angles; + vec_copy(real_angles, view_angles); + + view_angles.y += desync_amount; + + if (view_angles.y > 180.0f) view_angles.y -= 360.0f; + if (view_angles.y < -180.0f) view_angles.y += 360.0f; + + if (!g_settings.antiaim_view) { + vec_copy(cmd->viewangles, view_angles); + i_engine->SetViewAngles(real_angles); + return; } - duckCounter++; } - if (view_angles.y > 180.0f) view_angles.y -= 360.0f; - if (view_angles.y < -180.0f) view_angles.y += 360.0f; + bool should_fake_duck = false; + + if (g_settings.antiaim_fakeduck_key > 0) { + should_fake_duck = g_settings.antiaim_fakeduck && is_key_pressed(g_settings.antiaim_fakeduck_key); + } else { + should_fake_duck = g_settings.antiaim_fakeduck; + } + + if (should_fake_duck) { + apply_fake_duck(cmd, true); + } if (g_settings.antiaim_view) { i_engine->SetViewAngles(view_angles); - i_engine->pfnClientCmd("echo \"Set view angles directly using movement_antiaim_view.\""); } else { vec_copy(cmd->viewangles, view_angles); - i_engine->pfnClientCmd("echo \"Set view angles silently.\""); } - + static float last_log_time = 0.0f; - if (cmd->msec - last_log_time >= 5000.0f) { - i_engine->pfnClientCmd("echo \"Advanced Anti-Aim has adjusted view angles.\""); - last_log_time = cmd->msec; + if (g_flCurrentTime > last_log_time + 5.0f) { + i_engine->Con_Printf("Anti-Aim active: Pitch=%.1f, Yaw=%.1f, Mode=%d/%d\n", + view_angles.x, view_angles.y, + g_settings.antiaim_pitch_mode, g_settings.antiaim_yaw_mode); + last_log_time = g_flCurrentTime; } } \ No newline at end of file diff --git a/src/globals.c b/src/globals.c index 7615920..94e901c 100644 --- a/src/globals.c +++ b/src/globals.c @@ -1,4 +1,3 @@ - #include <stdio.h> #include <string.h> #include <dlfcn.h> @@ -13,6 +12,7 @@ vec3_t g_punchAngles = { 0, 0, 0 }; float g_flNextAttack = 0.f, g_flNextPrimaryAttack = 0.f; int g_iClip = 0; +int g_currentWeaponID = -1; double g_flCurrentTime = 0.0; diff --git a/src/hooks.c b/src/hooks.c index bb26814..e57d60e 100644 --- a/src/hooks.c +++ b/src/hooks.c @@ -320,6 +320,15 @@ void h_HUD_PostRunCmd(struct local_state_s* from, struct local_state_s* to, g_flNextPrimaryAttack = to->weapondata[to->client.m_iId].m_flNextPrimaryAttack; g_iClip = to->weapondata[to->client.m_iId].m_iClip; + + // Track current weapon ID + int weaponId = to->client.m_iId; + + // Update global weapon ID if it changed + if (g_currentWeaponID != weaponId) { + g_currentWeaponID = weaponId; + i_engine->Con_Printf("Weapon changed: ID=%d\n", g_currentWeaponID); + } } } diff --git a/src/include/globals.h b/src/include/globals.h index d661427..0ef17c3 100644 --- a/src/include/globals.h +++ b/src/include/globals.h @@ -1,4 +1,3 @@ - #ifndef GLOBALS_H_ #define GLOBALS_H_ @@ -39,6 +38,7 @@ extern vec3_t g_punchAngles; extern float g_flNextAttack, g_flNextPrimaryAttack; extern float* scr_fov_value; extern int g_iClip; +extern int g_currentWeaponID; extern double g_flCurrentTime; extern void* hw; diff --git a/src/include/mathutil.h b/src/include/mathutil.h index 1a260e5..d7baf0d 100644 --- a/src/include/mathutil.h +++ b/src/include/mathutil.h @@ -1,8 +1,8 @@ - #ifndef MATHUTIL_H_ #define MATHUTIL_H_ 1 #include "sdk.h" +#include "util.h" /* Vector 2 for 2d points */ typedef float vec2_t[2]; @@ -11,8 +11,6 @@ typedef float vec2_t[2]; #define DEG2RAD(n) ((n)*M_PI / 180.0f) #define RAD2DEG(n) ((n)*180.0f / M_PI) -#define CLAMP(val, min, max) \ - (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val))) /* Use indexes so it works for float[] as well as vec3_t */ #define vec_copy(dst, src) \ diff --git a/src/include/settings.h b/src/include/settings.h index 5dad88d..ee90ae3 100644 --- a/src/include/settings.h +++ b/src/include/settings.h @@ -44,6 +44,37 @@ typedef struct { bool fakeduck; bool clmove; + int aa_pitch_mode; + int aa_yaw_mode; + float aa_custom_pitch; + float aa_custom_yaw; + float aa_spin_speed; + float aa_jitter_range; + bool aa_lby_breaker; + bool aa_desync; + bool aa_on_attack; + bool aa_first_person; + bool fake_duck; + + bool antiaim_enabled; + bool antiaim_pitch_enabled; + bool antiaim_yaw_enabled; + float antiaim_pitch; + float antiaim_yaw; + bool antiaim_fakeduck; + int antiaim_fakeduck_key; + bool antiaim_desync; + bool antiaim_legit; + + int antiaim_pitch_mode; + int antiaim_yaw_mode; + float antiaim_custom_pitch; + float antiaim_custom_yaw; + float antiaim_spin_speed; + float antiaim_jitter_range; + bool antiaim_lby_breaker; + bool antiaim_on_attack; + bool namechanger; float namechanger_speed; bool menu_allow_movement; @@ -51,6 +82,8 @@ typedef struct { bool thirdperson; int thirdperson_key; float thirdperson_dist; + + bool blinker; } cheat_settings_t; extern cheat_settings_t g_settings; @@ -80,7 +113,43 @@ inline void init_default_settings(void) { g_settings.thirdperson_dist = 300.0f; g_settings.thirdperson_key = 'C'; + // Initialize anti-aim defaults + g_settings.aa_pitch_mode = 0; // None + g_settings.aa_yaw_mode = 0; // None + g_settings.aa_custom_pitch = 0.0f; + g_settings.aa_custom_yaw = 0.0f; + g_settings.aa_spin_speed = 360.0f; // One rotation per second + g_settings.aa_jitter_range = 45.0f; // ±45 degrees jitter + g_settings.aa_lby_breaker = false; + g_settings.aa_desync = false; + g_settings.aa_on_attack = false; + g_settings.aa_first_person = false; + g_settings.fake_duck = false; + + // Initialize new anti-aim settings + g_settings.antiaim_enabled = false; + g_settings.antiaim_pitch_enabled = false; + g_settings.antiaim_yaw_enabled = false; + g_settings.antiaim_pitch = 89.0f; // Default to look down + g_settings.antiaim_yaw = 180.0f; // Default to backward + g_settings.antiaim_fakeduck = false; + g_settings.antiaim_fakeduck_key = 0; // No key binding + g_settings.antiaim_desync = false; + g_settings.antiaim_legit = false; + g_settings.antiaim_view = false; // Don't show anti-aim in first person by default + + // Initialize advanced anti-aim settings + g_settings.antiaim_pitch_mode = 1; // Down (89°) + g_settings.antiaim_yaw_mode = 1; // Backward (180°) + g_settings.antiaim_custom_pitch = 0.0f; + g_settings.antiaim_custom_yaw = 0.0f; + g_settings.antiaim_spin_speed = 360.0f; // One rotation per second + g_settings.antiaim_jitter_range = 45.0f; // ±45 degrees jitter + g_settings.antiaim_lby_breaker = false; + g_settings.antiaim_on_attack = false; + g_settings.menu_allow_movement = true; + g_settings.blinker = false; } #ifdef __cplusplus diff --git a/src/include/util.h b/src/include/util.h index 11776a7..ba5af80 100644 --- a/src/include/util.h +++ b/src/include/util.h @@ -23,8 +23,8 @@ typedef struct { #define DEG2RAD(n) ((n)*M_PI / 180.0f) #define RAD2DEG(n) ((n)*180.0f / M_PI) -#define CLAMP(val, min, max) \ - (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val))) + +#define CLAMP(x, min, max) ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x))) #define gl_drawline_points(p0, p1, w, col) \ gl_drawline(p0[0], p0[1], p1[0], p1[1], w, col); diff --git a/src/menu.c b/src/menu.c index 64ab4df..b208cb3 100644 --- a/src/menu.c +++ b/src/menu.c @@ -9,6 +9,7 @@ #include "include/globals.h" #include "include/settings.h" #include "include/hooks.h" +#include "include/util.h" #include <GL/gl.h> #include "include/sdk/public/keydefs.h" @@ -183,18 +184,28 @@ extern "C" void menu_render(void) { if (ImGui::BeginTabBar("##Tabs", ImGuiTabBarFlags_None)) { if (ImGui::BeginTabItem("Aimbot")) { + // Main aimbot settings section + ImGui::Text("Aimbot Settings"); + ImGui::Separator(); + if (ImGui::Checkbox("Enable Aimbot", &g_settings.aimbot_enabled)) { } if (g_settings.aimbot_enabled) { - if (ImGui::SliderFloat("FOV", &g_settings.aimbot_fov, 0.1f, 360.0f, "%.1f")) { + // Target selection section + ImGui::Text("Target Selection:"); + + if (ImGui::SliderFloat("FOV", &g_settings.aimbot_fov, 0.1f, 180.0f, "%.1f")) { + // Ensure value stays within limits + g_settings.aimbot_fov = CLAMP(g_settings.aimbot_fov, 0.1f, 180.0f); } - ImGui::Checkbox("Enable Smoothing", &g_settings.aimbot_smoothing_enabled); - - if (g_settings.aimbot_smoothing_enabled) { - if (ImGui::SliderFloat("Smoothing", &g_settings.aimbot_smooth, 1.0f, 100.0f, "%.1f")) { - } + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Field of view for target selection.\nSmaller values = more precise targeting"); + ImGui::EndTooltip(); } const char* hitbox_items[] = { "Head", "Chest", "Stomach", "Pelvis", "Nearest" }; @@ -202,6 +213,66 @@ extern "C" void menu_render(void) { current_hitbox = g_settings.aimbot_hitbox; } + ImGui::Checkbox("Shoot Teammates", &g_settings.aimbot_team_attack); + + // Aiming behavior section + ImGui::Separator(); + ImGui::Text("Aiming Behavior:"); + + ImGui::Checkbox("Enable Smoothing", &g_settings.aimbot_smoothing_enabled); + + if (g_settings.aimbot_smoothing_enabled) { + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Makes aim movement look more natural"); + ImGui::EndTooltip(); + } + + if (ImGui::SliderFloat("Smoothing", &g_settings.aimbot_smooth, 1.0f, 100.0f, "%.1f")) { + // Ensure value stays within limits + g_settings.aimbot_smooth = CLAMP(g_settings.aimbot_smooth, 1.0f, 100.0f); + } + + ImGui::Text("Lower = Faster | Higher = Smoother"); + } + + ImGui::Checkbox("Silent Aim", &g_settings.aimbot_silent); + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Aim is only visible server-side, not in your view"); + ImGui::EndTooltip(); + } + + // Recoil control section + ImGui::Separator(); + ImGui::Text("Recoil Control:"); + + ImGui::Checkbox("No Recoil", &g_settings.aimbot_norecoil); + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Completely removes recoil effect"); + ImGui::EndTooltip(); + } + + ImGui::Checkbox("Recoil Compensation", &g_settings.aimbot_recoil_comp); + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Dynamic recoil correction for weapons like AK-47\nAdjusts aim based on spray pattern"); + ImGui::EndTooltip(); + } + + // Auto shoot section + ImGui::Separator(); + ImGui::Text("Auto Functions:"); + ImGui::Checkbox("Auto Shoot", &g_settings.aimbot_autoshoot); if (g_settings.aimbot_autoshoot) { @@ -223,10 +294,13 @@ extern "C" void menu_render(void) { ImGui::Unindent(20); } - ImGui::Checkbox("Silent Aim", &g_settings.aimbot_silent); - ImGui::Checkbox("No Recoil", &g_settings.aimbot_norecoil); - ImGui::Checkbox("Recoil Compensation", &g_settings.aimbot_recoil_comp); - ImGui::Checkbox("Shoot Teammates", &g_settings.aimbot_team_attack); + // Weapon info section + ImGui::Separator(); + ImGui::Text("Current Weapon: %s (ID: %d)", + g_currentWeaponID == 7 ? "AK-47" : + g_currentWeaponID == 16 ? "M4A1" : + g_currentWeaponID == 1 ? "Desert Eagle" : "Unknown", + g_currentWeaponID); } ImGui::EndTabItem(); @@ -271,6 +345,233 @@ extern "C" void menu_render(void) { ImGui::EndTabItem(); } + if (ImGui::BeginTabItem("Anti-Aim")) { + ImGui::Text("Anti-Aim Settings"); + ImGui::Separator(); + + if (ImGui::Checkbox("Enable Anti-Aim", &g_settings.antiaim_enabled)) { + if (g_settings.antiaim_enabled) { + i_engine->Con_Printf("Anti-Aim enabled\n"); + } else { + i_engine->Con_Printf("Anti-Aim disabled\n"); + } + } + + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Master switch for all anti-aim features"); + ImGui::EndTooltip(); + } + + if (g_settings.antiaim_enabled) { + ImGui::Separator(); + ImGui::Text("Pitch Control:"); + + if (ImGui::Checkbox("Enable Pitch Anti-Aim", &g_settings.antiaim_pitch_enabled)) { + if (g_settings.antiaim_pitch_enabled) { + i_engine->Con_Printf("Pitch Anti-Aim enabled\n"); + } else { + i_engine->Con_Printf("Pitch Anti-Aim disabled\n"); + } + } + + if (g_settings.antiaim_pitch_enabled) { + const char* pitch_items[] = {"Fixed", "Down (89°)", "Up (-89°)", "Zero (0°)", "Jitter", "Custom"}; + if (ImGui::Combo("Pitch Mode", &g_settings.antiaim_pitch_mode, pitch_items, 6)) { + // Reset custom pitch if mode changed + if (g_settings.antiaim_pitch_mode != 5) { // Not custom + g_settings.antiaim_custom_pitch = 0.0f; + } + } + + // Show settings based on mode + if (g_settings.antiaim_pitch_mode == 0) { // Fixed + ImGui::SliderFloat("Pitch Angle", &g_settings.antiaim_pitch, -89.0f, 89.0f, "%.1f°"); + } + else if (g_settings.antiaim_pitch_mode == 5) { // Custom + ImGui::SliderFloat("Custom Pitch", &g_settings.antiaim_custom_pitch, -89.0f, 89.0f, "%.1f°"); + } + } + + ImGui::Separator(); + ImGui::Text("Yaw Control:"); + + if (ImGui::Checkbox("Enable Yaw Anti-Aim", &g_settings.antiaim_yaw_enabled)) { + if (g_settings.antiaim_yaw_enabled) { + i_engine->Con_Printf("Yaw Anti-Aim enabled\n"); + } else { + i_engine->Con_Printf("Yaw Anti-Aim disabled\n"); + } + } + + if (g_settings.antiaim_yaw_enabled) { + const char* yaw_items[] = {"Fixed", "Backward (180°)", "Spin", "Jitter", "Sideways", "Custom"}; + if (ImGui::Combo("Yaw Mode", &g_settings.antiaim_yaw_mode, yaw_items, 6)) { + // Reset custom yaw if mode changed + if (g_settings.antiaim_yaw_mode != 5) { // Not custom + g_settings.antiaim_custom_yaw = 0.0f; + } + } + + // Show settings based on mode + if (g_settings.antiaim_yaw_mode == 0) { // Fixed + ImGui::SliderFloat("Yaw Angle", &g_settings.antiaim_yaw, -180.0f, 180.0f, "%.1f°"); + } + else if (g_settings.antiaim_yaw_mode == 2) { // Spin + ImGui::SliderFloat("Spin Speed", &g_settings.antiaim_spin_speed, 10.0f, 1000.0f, "%.1f°/s"); + + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Controls how fast the spin rotates (degrees per second)"); + ImGui::EndTooltip(); + } + } + else if (g_settings.antiaim_yaw_mode == 3) { // Jitter + ImGui::SliderFloat("Jitter Range", &g_settings.antiaim_jitter_range, 5.0f, 180.0f, "%.1f°"); + + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Controls the maximum angle of random jitter (±degrees)"); + ImGui::EndTooltip(); + } + } + else if (g_settings.antiaim_yaw_mode == 5) { // Custom + ImGui::SliderFloat("Custom Yaw", &g_settings.antiaim_custom_yaw, -180.0f, 180.0f, "%.1f°"); + } + } + + ImGui::Separator(); + ImGui::Text("Additional Options:"); + + ImGui::Checkbox("Anti-Aim When Shooting", &g_settings.antiaim_on_attack); + + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Continue anti-aim even when attacking (may affect accuracy)"); + ImGui::EndTooltip(); + } + + ImGui::Checkbox("LBY Breaker", &g_settings.antiaim_lby_breaker); + + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Breaks lower body yaw for more effective anti-aim"); + ImGui::EndTooltip(); + } + + ImGui::Checkbox("Desync", &g_settings.antiaim_desync); + + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Creates a desync between client and server angles.\nMakes you harder to hit but may cause visual glitches."); + ImGui::EndTooltip(); + } + + ImGui::Checkbox("Legit Anti-Aim", &g_settings.antiaim_legit); + + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Less obvious anti-aim that's harder to detect visually.\nLess effective than rage anti-aim but less noticeable."); + ImGui::EndTooltip(); + } + + ImGui::Checkbox("Show in First Person", &g_settings.antiaim_view); + + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("When enabled, you'll see your anti-aim from first person.\nWhen disabled, only others see your anti-aim."); + ImGui::EndTooltip(); + } + + ImGui::Checkbox("Fake Duck", &g_settings.antiaim_fakeduck); + + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Rapidly switches between duck and stand positions.\nMakes you harder to hit while appearing ducked to others."); + ImGui::EndTooltip(); + } + + if (g_settings.antiaim_fakeduck) { + const char* key_name = "None"; + if (g_settings.antiaim_fakeduck_key > 0) { + // Convert key code to name + switch(g_settings.antiaim_fakeduck_key) { + case 'F': key_name = "F"; break; + case 'V': key_name = "V"; break; + case 'T': key_name = "T"; break; + case 'P': key_name = "P"; break; + case 'C': key_name = "C"; break; + case K_F1: key_name = "F1"; break; + case K_F2: key_name = "F2"; break; + case K_F3: key_name = "F3"; break; + case K_F4: key_name = "F4"; break; + case K_F5: key_name = "F5"; break; + case K_TAB: key_name = "Tab"; break; + case K_SPACE: key_name = "Space"; break; + case K_CTRL: key_name = "Ctrl"; break; + case K_SHIFT: key_name = "Shift"; break; + case K_ALT: key_name = "Alt"; break; + case K_MOUSE1: key_name = "Mouse1"; break; + case K_MOUSE2: key_name = "Mouse2"; break; + case K_MOUSE3: key_name = "Mouse3"; break; + default: { + if (g_settings.antiaim_fakeduck_key >= 32 && g_settings.antiaim_fakeduck_key <= 126) { + static char chr[2] = {0}; + chr[0] = (char)g_settings.antiaim_fakeduck_key; + key_name = chr; + } else { + static char code[32] = {0}; + snprintf(code, sizeof(code), "Key %d", g_settings.antiaim_fakeduck_key); + key_name = code; + } + } + } + } + + ImGui::Text("Fake Duck Key: %s", key_name); + + if (g_waiting_for_key_bind && g_current_key_binding_action && strcmp(g_current_key_binding_action, "fakeduck") == 0) { + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.1f, 0.1f, 1.0f)); + ImGui::Button("Press any key...", ImVec2(150, 25)); + ImGui::PopStyleColor(); + } else { + if (ImGui::Button("Bind Fake Duck Key", ImVec2(150, 25))) { + g_waiting_for_key_bind = true; + g_current_key_binding_action = "fakeduck"; + i_engine->Con_Printf("Press any key to bind for fake duck\n"); + } + } + + ImGui::SameLine(); + + if (ImGui::Button("Clear##FakeDuckKey", ImVec2(80, 25))) { + g_settings.antiaim_fakeduck_key = 0; + i_engine->Con_Printf("Fake duck key binding cleared\n"); + } + } + } + + ImGui::EndTabItem(); + } + if (ImGui::BeginTabItem("Misc")) { ImGui::Checkbox("Name Changer", &g_settings.namechanger); @@ -291,6 +592,21 @@ extern "C" void menu_render(void) { ImGui::Separator(); + if (ImGui::Button("Reset Settings", ImVec2(150, 30))) { + settings_reset(); + i_engine->pfnClientCmd("echo \"All settings have been reset to defaults.\""); + } + + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 0.1f, 1.0f), "?"); + if (ImGui::IsItemHovered()) { + ImGui::BeginTooltip(); + ImGui::Text("Reset all settings to default values"); + ImGui::EndTooltip(); + } + + ImGui::Separator(); + if (ImGui::Button("Uninject Cheat", ImVec2(150, 30))) { i_engine->pfnClientCmd("dz_uninject"); g_menu_open = false; diff --git a/src/settings.c b/src/settings.c index e2e4087..6c07c29 100644 --- a/src/settings.c +++ b/src/settings.c @@ -162,6 +162,27 @@ void settings_reset(void) { g_settings.fakeduck = false; g_settings.clmove = false; + // Reset anti-aim settings + g_settings.antiaim_enabled = false; + g_settings.antiaim_pitch_enabled = false; + g_settings.antiaim_yaw_enabled = false; + g_settings.antiaim_pitch = 89.0f; + g_settings.antiaim_yaw = 180.0f; + g_settings.antiaim_fakeduck = false; + g_settings.antiaim_fakeduck_key = 0; + g_settings.antiaim_desync = false; + g_settings.antiaim_legit = false; + + // Reset advanced anti-aim settings + g_settings.antiaim_pitch_mode = 1; // Down (89°) + g_settings.antiaim_yaw_mode = 1; // Backward (180°) + g_settings.antiaim_custom_pitch = 0.0f; + g_settings.antiaim_custom_yaw = 0.0f; + g_settings.antiaim_spin_speed = 360.0f; // One rotation per second + g_settings.antiaim_jitter_range = 45.0f; // ±45 degrees jitter + g_settings.antiaim_lby_breaker = false; + g_settings.antiaim_on_attack = false; + g_settings.namechanger = false; g_settings.fov = 90.0f;