From 3414d131f4397e34be2380eec0fd7262259e54eb Mon Sep 17 00:00:00 2001 From: 8dcc <8dcc.git@gmail.com> Date: Mon, 31 Jul 2023 18:03:26 +0200 Subject: [PATCH] Add autoshoot If this cvar is enabled (1), and the aimbot is enabled (fov>0), it will stop attacking if there is no visible target. --- src/cvars.c | 2 ++ src/features/aim.c | 3 +++ src/include/cvars.h | 1 + 3 files changed, 6 insertions(+) diff --git a/src/cvars.c b/src/cvars.c index 40a8cd1..4dc2bb0 100644 --- a/src/cvars.c +++ b/src/cvars.c @@ -6,6 +6,7 @@ DECL_CVAR(bhop); DECL_CVAR(autostrafe); DECL_CVAR(aimbot); +DECL_CVAR(autoshoot); DECL_CVAR(esp); DECL_CVAR(chams); DECL_CVAR(crosshair); @@ -16,6 +17,7 @@ bool cvars_init(void) { REGISTER_CVAR(bhop, 1); REGISTER_CVAR(autostrafe, 0); REGISTER_CVAR(aimbot, 0); + REGISTER_CVAR(autoshoot, 0); /* Only works with aimbot enabled */ REGISTER_CVAR(esp, 3); REGISTER_CVAR(chams, 1); REGISTER_CVAR(crosshair, 0); diff --git a/src/features/aim.c b/src/features/aim.c index c4036e9..263af0f 100644 --- a/src/features/aim.c +++ b/src/features/aim.c @@ -94,6 +94,9 @@ void aimbot(usercmd_t* cmd) { engine_viewangles.x += best_delta.x; engine_viewangles.y += best_delta.y; engine_viewangles.z += best_delta.z; + } else if (CVAR_ON(autoshoot)) { + /* No valid target and we have autoshoot, don't shoot */ + cmd->buttons &= ~IN_ATTACK; } vec_copy(cmd->viewangles, engine_viewangles); diff --git a/src/include/cvars.h b/src/include/cvars.h index 8323171..640022e 100644 --- a/src/include/cvars.h +++ b/src/include/cvars.h @@ -33,6 +33,7 @@ DECL_CVAR_EXTERN(bhop); DECL_CVAR_EXTERN(autostrafe); DECL_CVAR_EXTERN(aimbot); +DECL_CVAR_EXTERN(autoshoot); DECL_CVAR_EXTERN(esp); DECL_CVAR_EXTERN(chams); DECL_CVAR_EXTERN(crosshair);