From 87208744e1303ebefd251b05774ff89c019fcb26 Mon Sep 17 00:00:00 2001 From: Wizzard <25581244+Wizzard@users.noreply.toomuchslop.com> Date: Wed, 20 Sep 2023 23:10:57 -0400 Subject: [PATCH] Anti aim fixed --- src/features/anti_aim.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/features/anti_aim.c b/src/features/anti_aim.c index fb6cc9a..ed5ebf4 100644 --- a/src/features/anti_aim.c +++ b/src/features/anti_aim.c @@ -12,24 +12,36 @@ float random_float(float min, float max) { } void anti_aim(usercmd_t* cmd) { - if (!CVAR_ON(movement_antiaim) || !is_alive(localplayer)) { + if (!CVAR_ON(movement_antiaim)) { + return; + } + + if (!is_alive(localplayer)) { return; } vec3_t random_angles; + i_engine->GetViewAngles(random_angles); + random_angles.x = random_float(-89.0f, 89.0f); random_angles.y = random_float(-180.0f, 180.0f); random_angles.z = 0.0f; + char logMsg[128]; + snprintf(logMsg, sizeof(logMsg), "echo \"Generated random angles: [%f, %f, %f]\"", random_angles.x, random_angles.y, random_angles.z); + i_engine->pfnClientCmd(logMsg); if (CVAR_ON(movement_antiaim_view)) { - i_engine->SetViewAngles(random_angles); + i_engine->SetViewAngles(random_angles); + i_engine->pfnClientCmd("echo \"Set view angles directly using movement_antiaim_view.\""); + } else { + vec_copy(cmd->viewangles, random_angles); + i_engine->pfnClientCmd("echo \"Set view angles silently.\""); } - vec_copy(random_angles, cmd->viewangles); - static float last_log_time = 0.0f; if (cmd->msec - last_log_time >= 5000.0f) { i_engine->pfnClientCmd("echo \"Anti-Aim has adjusted view angles.\""); last_log_time = cmd->msec; } } +