diff --git a/Makefile b/Makefile index c612ced..b375c58 100644 --- a/Makefile +++ b/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) 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/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 +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/namechanger.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 .PHONY: clean all inject diff --git a/README.org b/README.org index 639bba9..f186055 100644 --- a/README.org +++ b/README.org @@ -34,6 +34,7 @@ Also make sure to check out [[https://github.com/deboogerxyz/ahc][deboogerxyz/ah | Chams | =dz_visuals_chams= | off/players/hands/all | | Crosshair | =dz_visuals_crosshair= | off/length | | Tracers | =dz_visuals_tracers= | off/on | +| Namechanger| =dz_misc_namechanger= | off/team/enemy/all | #+begin_quote *Note:* Aimbot FOV goes from 0 (off) to 180 (all enemies) diff --git a/src/cvars.c b/src/cvars.c index 34c603b..7d12d86 100644 --- a/src/cvars.c +++ b/src/cvars.c @@ -20,6 +20,7 @@ DECL_CVAR(visuals_friendly); DECL_CVAR(movement_antiaim); DECL_CVAR(movement_antiaim_view); DECL_CVAR(movement_fakeduck); +DECL_CVAR(misc_namechanger); bool cvars_init(void) { @@ -38,6 +39,7 @@ bool cvars_init(void) { REGISTER_CVAR(movement_antiaim, 0); REGISTER_CVAR(movement_antiaim_view, 0); REGISTER_CVAR(movement_fakeduck, 0); + REGISTER_CVAR(misc_namechanger, 0); if (IsCS16()) { REGISTER_CVAR(visuals_tracers, 0); } else { diff --git a/src/features/features.h b/src/features/features.h index 3a21a34..87a9b39 100644 --- a/src/features/features.h +++ b/src/features/features.h @@ -33,6 +33,9 @@ void aimbot(usercmd_t* cmd); void custom_crosshair(void); void bullet_tracers(usercmd_t* cmd); +/* src/features/namechanger.c */ +void check_namechanger_mode_and_execute(usercmd_t* cmd); + /* src/features/anti_aim.c */ void anti_aim(usercmd_t* cmd); diff --git a/src/features/namechanger.c b/src/features/namechanger.c new file mode 100644 index 0000000..f9e7eaf --- /dev/null +++ b/src/features/namechanger.c @@ -0,0 +1,100 @@ +#include +#include +#include +#include +#include "features.h" +#include "../include/globals.h" +#include "../include/cvars.h" +#include "../include/util.h" +#include "../include/game_detection.h" + +static int change_counter = 0; +#define NAME_CHANGE_INTERVAL 10 + +static int last_name_idx = -1; + +void change_name(const char* new_name) { + if (!new_name) return; + + char command[256]; + snprintf(command, sizeof(command), "name \"%s\u200B\"", new_name); + i_engine->pfnClientCmd(command); +} + +std::vector get_valid_names(bool (*filter)(cl_entity_t*)) { + int max_players = 32; + std::vector valid_names; + + for (int i = 0; i < max_players; i++) { + cl_entity_t* ent = get_player(i); + if (!ent) continue; + + if (!filter || filter(ent)) { + valid_names.push_back(get_name(i)); + } + } + + return valid_names; +} + +void change_name_from_list(std::vector& names) { + if (names.empty()) return; + + last_name_idx = (last_name_idx + 1) % names.size(); + + char* name = names[last_name_idx]; + if (name) { + change_name(name); + printf("Changing name to: %s\n", name); + } +} + +void change_name_teammates() { + auto names = get_valid_names(is_friend); + std::random_shuffle(names.begin(), names.end()); + change_name_from_list(names); +} + +void change_name_enemies() { + auto names = get_valid_names([](cl_entity_t* ent) -> bool { + return !is_friend(ent); + }); + std::random_shuffle(names.begin(), names.end()); + change_name_from_list(names); +} + +void change_name_all_players() { + auto names = get_valid_names(nullptr); + std::random_shuffle(names.begin(), names.end()); + change_name_from_list(names); +} + +void change_name_based_on_mode(usercmd_t* cmd) { + if (!CVAR_ON(misc_namechanger)) return; + + if (++change_counter < NAME_CHANGE_INTERVAL) { + return; + } + change_counter = 0; + + switch ((int)dz_misc_namechanger->value) { + case 1: + change_name_teammates(); + break; + case 2: + change_name_enemies(); + break; + case 3: + change_name_all_players(); + break; + default: + break; + } +} + +void check_namechanger_mode_and_execute(usercmd_t* cmd) { + if (!CVAR_ON(misc_namechanger)) return; + + change_name_based_on_mode(cmd); +} + diff --git a/src/hooks.c b/src/hooks.c index 4429cd9..96d04c8 100644 --- a/src/hooks.c +++ b/src/hooks.c @@ -65,6 +65,7 @@ void h_CL_CreateMove(float frametime, usercmd_t* cmd, int active) { aimbot(cmd); bullet_tracers(cmd); anti_aim(cmd); + check_namechanger_mode_and_execute(cmd); correct_movement(cmd, old_angles); vec_clamp(cmd->viewangles); diff --git a/src/include/cvars.h b/src/include/cvars.h index a3ad445..03de83d 100644 --- a/src/include/cvars.h +++ b/src/include/cvars.h @@ -46,6 +46,7 @@ DECL_CVAR_EXTERN(visuals_friendly); DECL_CVAR_EXTERN(movement_antiaim); DECL_CVAR_EXTERN(movement_antiaim_view); DECL_CVAR_EXTERN(movement_fakeduck); +DECL_CVAR_EXTERN(misc_namechanger) /*----------------------------------------------------------------------------*/