From 9a109b3882bc53df2e02106a6b9a3782dc028cce Mon Sep 17 00:00:00 2001 From: Wizzard <25581244+Wizzard@users.noreply.toomuchslop.com> Date: Wed, 20 Sep 2023 20:34:38 -0400 Subject: [PATCH] Updated silent aim --- src/features/aim.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/features/aim.c b/src/features/aim.c index a98ac8a..5a9e1ee 100644 --- a/src/features/aim.c +++ b/src/features/aim.c @@ -90,12 +90,15 @@ static vec3_t get_closest_delta(vec3_t viewangles) { } void aimbot(usercmd_t* cmd) { - if (!CVAR_ON(aim_aimbot) || !(cmd->buttons & IN_ATTACK) || !can_shoot()) + static bool shouldShootNextFrame = false; + + if (!CVAR_ON(aim_aimbot) || !can_shoot()) return; vec3_t engine_viewangles; i_engine->GetViewAngles(engine_viewangles); vec3_t best_delta = get_closest_delta(engine_viewangles); + if (!vec_is_zero(best_delta)) { engine_viewangles.x += best_delta.x; engine_viewangles.y += best_delta.y; @@ -103,10 +106,24 @@ void aimbot(usercmd_t* cmd) { if (CVAR_ON(aim_aimbot_silent)) { vec_copy(cmd->viewangles, engine_viewangles); + if (cmd->buttons & IN_ATTACK) { + if (shouldShootNextFrame) { + cmd->buttons |= IN_ATTACK; + shouldShootNextFrame = false; + } else { + cmd->buttons &= ~IN_ATTACK; + shouldShootNextFrame = true; + } + } } else { - i_engine->SetViewAngles(engine_viewangles); + if (cmd->buttons & IN_ATTACK) { // Ensure left click is pressed before adjusting aim for non-silent + i_engine->SetViewAngles(engine_viewangles); + } } - } else if (CVAR_ON(aim_autoshoot)) { + + } else if (CVAR_ON(aim_autoshoot) && (cmd->buttons & IN_ATTACK)) { cmd->buttons &= ~IN_ATTACK; + } else { + shouldShootNextFrame = false; // Reset } -} \ No newline at end of file +}