Added dz_visuals_friendly to not render friendly players. Change all cvars to a new format.

This commit is contained in:
Wizzard 2023-09-20 14:51:49 -04:00
parent 7239d610a8
commit 7fc0a14ae6
10 changed files with 67 additions and 56 deletions

View File

@ -24,17 +24,16 @@ Also make sure to check out [[https://github.com/deboogerxyz/ahc][deboogerxyz/ah
* Features * Features
| Feature | Command | Values (0..n) | | Feature | Command | Values |
|------------+---------------+------------------------| |------------|------------------------|-----------------------|
| Bhop | =dz_bhop= | off/on | | Bhop | =dz_movement_bhop= | off/on |
| Autostrafe | =dz_autostrafe= | off/rage/legit | | Autostrafe | =dz_movement_autostrafe| off/rage/legit |
| Aimbot | =dz_aimbot= | off/fov* | | Aimbot | =dz_aim_aimbot= | off/fov |
| Autoshoot | =dz_autoshoot= | off/on* | | Autoshoot | =dz_aim_autoshoot= | off/on |
| ESP | =dz_esp= | off/3d-box/name/all | | ESP | =dz_visuals_esp= | off/3d-box/name/all |
| Chams | =dz_chams= | off/players/hands/all* | | Chams | =dz_visuals_chams= | off/players/hands/all |
| Crosshair | =dz_crosshair= | off/length | | Crosshair | =dz_visuals_crosshair= | off/length |
| Tracers | =dz_tracers= | off/on* | | Tracers | =dz_visuals_tracers= | off/on |
#+begin_quote #+begin_quote
*Note:* Aimbot FOV goes from 0 (off) to 180 (all enemies) *Note:* Aimbot FOV goes from 0 (off) to 180 (all enemies)

View File

@ -4,35 +4,38 @@
#include "include/globals.h" #include "include/globals.h"
#include "include/game_detection.h" #include "include/game_detection.h"
DECL_CVAR(bhop); DECL_CVAR(movement_bhop);
DECL_CVAR(autostrafe); DECL_CVAR(movement_autostrafe);
DECL_CVAR(aimbot); DECL_CVAR(aim_aimbot);
DECL_CVAR(autoshoot); DECL_CVAR(aim_autoshoot);
DECL_CVAR(esp); DECL_CVAR(visuals_esp);
DECL_CVAR(chams); DECL_CVAR(visuals_chams);
DECL_CVAR(crosshair); DECL_CVAR(visuals_crosshair);
DECL_CVAR(tracers); DECL_CVAR(visuals_tracers);
DECL_CVAR(clmove); DECL_CVAR(movement_clmove);
DECL_CVAR(watermark); DECL_CVAR(watermark);
DECL_CVAR(watermark_rainbow); DECL_CVAR(watermark_rainbow);
DECL_CVAR(aimbot_silent_aim); DECL_CVAR(aim_aimbot_silent);
DECL_CVAR(visuals_friendly);
bool cvars_init(void) { bool cvars_init(void) {
REGISTER_CVAR(bhop, 1); REGISTER_CVAR(movement_bhop, 1);
REGISTER_CVAR(autostrafe, 1); REGISTER_CVAR(movement_autostrafe, 1);
REGISTER_CVAR(aimbot, 0); REGISTER_CVAR(aim_aimbot, 0);
REGISTER_CVAR(autoshoot, 0); /* Only works with aimbot enabled */ REGISTER_CVAR(aim_autoshoot, 0); /* Only works with aimbot enabled */
REGISTER_CVAR(esp, 3); REGISTER_CVAR(visuals_esp, 3);
REGISTER_CVAR(chams, 1); REGISTER_CVAR(visuals_chams, 1);
REGISTER_CVAR(crosshair, 0); REGISTER_CVAR(visuals_crosshair, 0);
REGISTER_CVAR(clmove, 0); REGISTER_CVAR(movement_clmove, 0);
REGISTER_CVAR(watermark, 1); REGISTER_CVAR(watermark, 1);
REGISTER_CVAR(watermark_rainbow, 1); REGISTER_CVAR(watermark_rainbow, 1);
REGISTER_CVAR(aimbot_silent_aim, 1); REGISTER_CVAR(aim_aimbot_silent, 1);
REGISTER_CVAR(visuals_friendly, 0);
if (IsCS16()) { if (IsCS16()) {
REGISTER_CVAR(tracers, 0); REGISTER_CVAR(visuals_tracers, 0);
} else { } else {
REGISTER_CVAR(tracers, 1); REGISTER_CVAR(visuals_tracers, 1);
} }
return true; return true;
} }

View File

@ -36,7 +36,7 @@ static vec3_t get_closest_delta(vec3_t viewangles) {
vec3_t local_eyes = vec_add(localplayer->origin, view_height); vec3_t local_eyes = vec_add(localplayer->origin, view_height);
float min_distance = FLT_MAX; // For tracking the closest player float min_distance = FLT_MAX; // For tracking the closest player
float best_fov = dz_aimbot->value; float best_fov = dz_aim_aimbot->value;
vec3_t best_delta = { 0, 0, 0 }; vec3_t best_delta = { 0, 0, 0 };
for (int i = 1; i <= i_engine->GetMaxClients(); i++) { for (int i = 1; i <= i_engine->GetMaxClients(); i++) {
@ -80,7 +80,7 @@ static vec3_t get_closest_delta(vec3_t viewangles) {
} }
void aimbot(usercmd_t* cmd) { void aimbot(usercmd_t* cmd) {
if (!CVAR_ON(aimbot) || !(cmd->buttons & IN_ATTACK) || !can_shoot()) if (!CVAR_ON(aim_aimbot) || !(cmd->buttons & IN_ATTACK) || !can_shoot())
return; return;
/* Calculate delta with the engine viewangles, not with the cmd ones */ /* Calculate delta with the engine viewangles, not with the cmd ones */
@ -93,12 +93,12 @@ void aimbot(usercmd_t* cmd) {
engine_viewangles.x += best_delta.x; engine_viewangles.x += best_delta.x;
engine_viewangles.y += best_delta.y; engine_viewangles.y += best_delta.y;
engine_viewangles.z += best_delta.z; engine_viewangles.z += best_delta.z;
} else if (CVAR_ON(autoshoot)) { } else if (CVAR_ON(aim_autoshoot)) {
/* No valid target and we have autoshoot, don't shoot */ /* No valid target and we have autoshoot, don't shoot */
cmd->buttons &= ~IN_ATTACK; cmd->buttons &= ~IN_ATTACK;
} }
if (CVAR_ON(aimbot_silent_aim)) { if (CVAR_ON(aim_aimbot_silent)) {
vec_copy(cmd->viewangles, engine_viewangles); vec_copy(cmd->viewangles, engine_viewangles);
} else { } else {
i_engine->SetViewAngles(engine_viewangles); i_engine->SetViewAngles(engine_viewangles);

View File

@ -15,7 +15,7 @@ enum chams_settings {
visible_flags visible_mode; visible_flags visible_mode;
bool chams(void* this_ptr) { bool chams(void* this_ptr) {
const int setting = dz_chams->value == 5.0f ? 7 : dz_chams->value; const int setting = dz_visuals_chams->value == 5.0f ? 7 : dz_visuals_chams->value;
if (setting == DISABLED) if (setting == DISABLED)
return false; return false;
@ -39,6 +39,10 @@ bool chams(void* this_ptr) {
const bool friendly = is_friend(ent); const bool friendly = is_friend(ent);
// Check if the player is friendly and if visuals_friendly is 0
if (friendly && dz_visuals_friendly->value == 0)
return false; // Do not render chams for friendlies
/* If we got here it means we are rendering a valid player */ /* If we got here it means we are rendering a valid player */
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);

View File

@ -98,7 +98,7 @@ static bool gl_draw2dbox(vec3_t o, int bh) {
} }
void esp(void) { void esp(void) {
const int setting = (int)dz_esp->value; const int setting = (int)dz_visuals_esp->value;
if (setting == ESP_OFF) if (setting == ESP_OFF)
return; return;
@ -109,6 +109,10 @@ void esp(void) {
if (!valid_player(ent) || !is_alive(ent) || vec_is_zero(ent->origin)) if (!valid_player(ent) || !is_alive(ent) || vec_is_zero(ent->origin))
continue; continue;
// Check if the player is friendly and if visuals_friendly is 0
if (is_friend(ent) && dz_visuals_friendly->value == 0)
continue;
const int bh = (ent->curstate.usehull == 1) ? 44 : 70; const int bh = (ent->curstate.usehull == 1) ? 44 : 70;
/* const int bw = 25; */ /* const int bw = 25; */

View File

@ -7,7 +7,7 @@
#include "../include/game_detection.h" #include "../include/game_detection.h"
void custom_crosshair(void) { void custom_crosshair(void) {
if (!CVAR_ON(crosshair)) if (!CVAR_ON(visuals_crosshair))
return; return;
/* Get window size, and then the center. */ /* Get window size, and then the center. */
@ -15,7 +15,7 @@ void custom_crosshair(void) {
int my = game_info->m_height / 2; int my = game_info->m_height / 2;
/* The real length is sqrt(2 * (len^2)) */ /* The real length is sqrt(2 * (len^2)) */
const int len = dz_crosshair->value; const int len = dz_visuals_crosshair->value;
const int gap = 1; const int gap = 1;
const float w = 1; const float w = 1;
const rgb_t col = { 255, 255, 255 }; const rgb_t col = { 255, 255, 255 };
@ -36,7 +36,7 @@ static double lastTracerTime = 0;
void bullet_tracers(usercmd_t* cmd) { void bullet_tracers(usercmd_t* cmd) {
/* Only draw if we are holding attack and we can shoot */ /* Only draw if we are holding attack and we can shoot */
if (!CVAR_ON(tracers) || !(cmd->buttons & IN_ATTACK) || !can_shoot() || !is_alive(localplayer)) if (!CVAR_ON(visuals_tracers) || !(cmd->buttons & IN_ATTACK) || !can_shoot() || !is_alive(localplayer))
return; return;
/* Dirty temp fix for tracers being spammed in CS1.6 */ /* Dirty temp fix for tracers being spammed in CS1.6 */
if (IsCS16() && (g_flCurrentTime - lastTracerTime < 0.5)) { if (IsCS16() && (g_flCurrentTime - lastTracerTime < 0.5)) {

View File

@ -65,7 +65,7 @@ static void autostrafe_rage(usercmd_t* cmd) {
} }
void bhop(usercmd_t* cmd) { void bhop(usercmd_t* cmd) {
if (!CVAR_ON(bhop) || i_pmove->movetype != MOVETYPE_WALK) if (!CVAR_ON(movement_bhop) || i_pmove->movetype != MOVETYPE_WALK)
return; return;
static bool was_in_air = false; static bool was_in_air = false;
@ -82,7 +82,7 @@ void bhop(usercmd_t* cmd) {
/* Autostrafe if enabled. Check if we are in the air and holding space. */ /* Autostrafe if enabled. Check if we are in the air and holding space. */
if (is_jumping) { if (is_jumping) {
switch ((int)dz_autostrafe->value) { switch ((int)dz_movement_autostrafe->value) {
case 1: case 1:
autostrafe_rage(cmd); autostrafe_rage(cmd);
break; break;

View File

@ -185,8 +185,8 @@ void h_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void h_CL_Move() { void h_CL_Move() {
if (dz_clmove->value != 0) { if (dz_movement_clmove->value != 0) {
for (int i = 0; i < (int)dz_clmove->value; i++) for (int i = 0; i < (int)dz_movement_clmove->value; i++)
CALL_ORIGINAL(detour_data_clmove, clmove_type); CALL_ORIGINAL(detour_data_clmove, clmove_type);
} }

View File

@ -30,18 +30,20 @@
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
DECL_CVAR_EXTERN(bhop); DECL_CVAR_EXTERN(movement_bhop);
DECL_CVAR_EXTERN(autostrafe); DECL_CVAR_EXTERN(movement_autostrafe);
DECL_CVAR_EXTERN(aimbot); DECL_CVAR_EXTERN(aim_aimbot);
DECL_CVAR_EXTERN(autoshoot); DECL_CVAR_EXTERN(aim_autoshoot);
DECL_CVAR_EXTERN(esp); DECL_CVAR_EXTERN(visuals_esp);
DECL_CVAR_EXTERN(chams); DECL_CVAR_EXTERN(visuals_chams);
DECL_CVAR_EXTERN(crosshair); DECL_CVAR_EXTERN(visuals_crosshair);
DECL_CVAR_EXTERN(tracers); DECL_CVAR_EXTERN(visuals_tracers);
DECL_CVAR_EXTERN(clmove); DECL_CVAR_EXTERN(movement_clmove);
DECL_CVAR_EXTERN(watermark); DECL_CVAR_EXTERN(watermark);
DECL_CVAR_EXTERN(watermark_rainbow); DECL_CVAR_EXTERN(watermark_rainbow);
DECL_CVAR_EXTERN(aimbot_silent_aim); DECL_CVAR_EXTERN(aim_aimbot_silent);
DECL_CVAR_EXTERN(visuals_friendly);
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/

View File

@ -36,7 +36,6 @@ bool valid_player(cl_entity_t* ent);
bool is_friend(cl_entity_t* ent); bool is_friend(cl_entity_t* ent);
bool can_shoot(void); bool can_shoot(void);
char* get_name(int ent_idx); char* get_name(int ent_idx);
game_id get_cur_game(void);
vec3_t vec3(float x, float y, float z); vec3_t vec3(float x, float y, float z);
vec3_t vec_add(vec3_t a, vec3_t b); vec3_t vec_add(vec3_t a, vec3_t b);
vec3_t vec_sub(vec3_t a, vec3_t b); vec3_t vec_sub(vec3_t a, vec3_t b);