Added anti-aim 'dz_movement_antiaim' and 'dz_movement_antiaim_view'
This commit is contained in:
		
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @@ -5,7 +5,7 @@ INCLUDES=-Isrc/include/sdk/common -Isrc/include/sdk/public -Isrc/include/sdk/pm_ | |||||||
| CFLAGS=-Wall -Wextra -Wno-write-strings -m32 -fPIC $(INCLUDES) | CFLAGS=-Wall -Wextra -Wno-write-strings -m32 -fPIC $(INCLUDES) | ||||||
| LDFLAGS=-lm | LDFLAGS=-lm | ||||||
|  |  | ||||||
| OBJS=obj/main.c.o obj/globals.c.o obj/cvars.c.o obj/hooks.c.o obj/detour.c.o obj/util.c.o obj/features/movement.c.o obj/features/esp.c.o obj/features/chams.c.o obj/features/aim.c.o obj/features/misc.c.o obj/game_detection.c.o | OBJS=obj/main.c.o obj/globals.c.o obj/cvars.c.o obj/hooks.c.o obj/detour.c.o obj/util.c.o obj/features/movement.c.o obj/features/anti_aim.c.o obj/features/esp.c.o obj/features/chams.c.o obj/features/aim.c.o obj/features/misc.c.o obj/game_detection.c.o | ||||||
| BIN=libhlcheat.so | BIN=libhlcheat.so | ||||||
|  |  | ||||||
| .PHONY: clean all inject | .PHONY: clean all inject | ||||||
|   | |||||||
| @@ -17,6 +17,8 @@ DECL_CVAR(watermark); | |||||||
| DECL_CVAR(watermark_rainbow); | DECL_CVAR(watermark_rainbow); | ||||||
| DECL_CVAR(aim_aimbot_silent); | DECL_CVAR(aim_aimbot_silent); | ||||||
| DECL_CVAR(visuals_friendly); | DECL_CVAR(visuals_friendly); | ||||||
|  | DECL_CVAR(movement_antiaim) | ||||||
|  | DECL_CVAR(movement_antiaim_view) | ||||||
|  |  | ||||||
|  |  | ||||||
| bool cvars_init(void) { | bool cvars_init(void) { | ||||||
| @@ -32,6 +34,8 @@ bool cvars_init(void) { | |||||||
|     REGISTER_CVAR(watermark_rainbow, 1); |     REGISTER_CVAR(watermark_rainbow, 1); | ||||||
|     REGISTER_CVAR(aim_aimbot_silent, 1); |     REGISTER_CVAR(aim_aimbot_silent, 1); | ||||||
|     REGISTER_CVAR(visuals_friendly, 0); |     REGISTER_CVAR(visuals_friendly, 0); | ||||||
|  |     REGISTER_CVAR(movement_antiaim, 0); | ||||||
|  |     REGISTER_CVAR(movement_antiaim_view, 0); | ||||||
|     if (IsCS16()) { |     if (IsCS16()) { | ||||||
|     REGISTER_CVAR(visuals_tracers, 0); |     REGISTER_CVAR(visuals_tracers, 0); | ||||||
|     } else { |     } else { | ||||||
|   | |||||||
| @@ -53,7 +53,7 @@ static vec3_t get_closest_delta(vec3_t viewangles) { | |||||||
|         if (ent->curstate.usehull != 1) {  // Not crouched |         if (ent->curstate.usehull != 1) {  // Not crouched | ||||||
|             if (IsCS16()) { |             if (IsCS16()) { | ||||||
|                 head_pos.z += CS16_HEAD_OFFSET; |                 head_pos.z += CS16_HEAD_OFFSET; | ||||||
|                 head_pos.x += CS16_HORIZONTAL_OFFSET;  // Adjust based on observation; might be negative. |                 head_pos.x += CS16_HORIZONTAL_OFFSET; | ||||||
|             } else { |             } else { | ||||||
|                 head_pos.z += HL1_HEAD_OFFSET; |                 head_pos.z += HL1_HEAD_OFFSET; | ||||||
|             } |             } | ||||||
|   | |||||||
							
								
								
									
										35
									
								
								src/features/anti_aim.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								src/features/anti_aim.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | |||||||
|  | #include <math.h> | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include <time.h> | ||||||
|  |  | ||||||
|  | #include "features.h" | ||||||
|  | #include "../include/sdk.h" | ||||||
|  | #include "../include/cvars.h" | ||||||
|  | #include "../include/util.h" | ||||||
|  |  | ||||||
|  | float random_float(float min, float max) { | ||||||
|  |     return (max - min) * ((float)rand() / (float)RAND_MAX) + min; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void anti_aim(usercmd_t* cmd) { | ||||||
|  |     if (!CVAR_ON(movement_antiaim) || !is_alive(localplayer)) { | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     vec3_t 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; | ||||||
|  |  | ||||||
|  |     if (CVAR_ON(movement_antiaim_view)) { | ||||||
|  |         i_engine->SetViewAngles(random_angles);  | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     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; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -33,4 +33,7 @@ void aimbot(usercmd_t* cmd); | |||||||
| void custom_crosshair(void); | void custom_crosshair(void); | ||||||
| void bullet_tracers(usercmd_t* cmd); | void bullet_tracers(usercmd_t* cmd); | ||||||
|  |  | ||||||
| #endif /* FEATURES_H_ */ | /* src/features/anti_aim.c */ | ||||||
|  | void anti_aim(usercmd_t* cmd); | ||||||
|  |  | ||||||
|  | #endif /* FEATURES_H_ */ | ||||||
| @@ -64,6 +64,7 @@ void h_CL_CreateMove(float frametime, usercmd_t* cmd, int active) { | |||||||
|     bhop(cmd); |     bhop(cmd); | ||||||
|     aimbot(cmd); |     aimbot(cmd); | ||||||
|     bullet_tracers(cmd); |     bullet_tracers(cmd); | ||||||
|  |     anti_aim(cmd); | ||||||
|  |  | ||||||
|     correct_movement(cmd, old_angles); |     correct_movement(cmd, old_angles); | ||||||
|     vec_clamp(cmd->viewangles); |     vec_clamp(cmd->viewangles); | ||||||
|   | |||||||
| @@ -43,6 +43,8 @@ DECL_CVAR_EXTERN(watermark); | |||||||
| DECL_CVAR_EXTERN(watermark_rainbow); | DECL_CVAR_EXTERN(watermark_rainbow); | ||||||
| DECL_CVAR_EXTERN(aim_aimbot_silent); | DECL_CVAR_EXTERN(aim_aimbot_silent); | ||||||
| DECL_CVAR_EXTERN(visuals_friendly); | DECL_CVAR_EXTERN(visuals_friendly); | ||||||
|  | DECL_CVAR_EXTERN(movement_antiaim); | ||||||
|  | DECL_CVAR_EXTERN(movement_antiaim_view); | ||||||
|  |  | ||||||
|  |  | ||||||
| /*----------------------------------------------------------------------------*/ | /*----------------------------------------------------------------------------*/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user