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
| Feature | Command | Values (0..n) |
|------------+---------------+------------------------|
| Bhop | =dz_bhop= | off/on |
| Autostrafe | =dz_autostrafe= | off/rage/legit |
| Aimbot | =dz_aimbot= | off/fov* |
| Autoshoot | =dz_autoshoot= | off/on* |
| ESP | =dz_esp= | off/3d-box/name/all |
| Chams | =dz_chams= | off/players/hands/all* |
| Crosshair | =dz_crosshair= | off/length |
| Tracers | =dz_tracers= | off/on* |
| Feature | Command | Values |
|------------|------------------------|-----------------------|
| Bhop | =dz_movement_bhop= | off/on |
| Autostrafe | =dz_movement_autostrafe| off/rage/legit |
| Aimbot | =dz_aim_aimbot= | off/fov |
| Autoshoot | =dz_aim_autoshoot= | off/on |
| ESP | =dz_visuals_esp= | off/3d-box/name/all |
| Chams | =dz_visuals_chams= | off/players/hands/all |
| Crosshair | =dz_visuals_crosshair= | off/length |
| Tracers | =dz_visuals_tracers= | off/on |
#+begin_quote
*Note:* Aimbot FOV goes from 0 (off) to 180 (all enemies)

View File

@ -4,35 +4,38 @@
#include "include/globals.h"
#include "include/game_detection.h"
DECL_CVAR(bhop);
DECL_CVAR(autostrafe);
DECL_CVAR(aimbot);
DECL_CVAR(autoshoot);
DECL_CVAR(esp);
DECL_CVAR(chams);
DECL_CVAR(crosshair);
DECL_CVAR(tracers);
DECL_CVAR(clmove);
DECL_CVAR(movement_bhop);
DECL_CVAR(movement_autostrafe);
DECL_CVAR(aim_aimbot);
DECL_CVAR(aim_autoshoot);
DECL_CVAR(visuals_esp);
DECL_CVAR(visuals_chams);
DECL_CVAR(visuals_crosshair);
DECL_CVAR(visuals_tracers);
DECL_CVAR(movement_clmove);
DECL_CVAR(watermark);
DECL_CVAR(watermark_rainbow);
DECL_CVAR(aimbot_silent_aim);
DECL_CVAR(aim_aimbot_silent);
DECL_CVAR(visuals_friendly);
bool cvars_init(void) {
REGISTER_CVAR(bhop, 1);
REGISTER_CVAR(autostrafe, 1);
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);
REGISTER_CVAR(clmove, 0);
REGISTER_CVAR(movement_bhop, 1);
REGISTER_CVAR(movement_autostrafe, 1);
REGISTER_CVAR(aim_aimbot, 0);
REGISTER_CVAR(aim_autoshoot, 0); /* Only works with aimbot enabled */
REGISTER_CVAR(visuals_esp, 3);
REGISTER_CVAR(visuals_chams, 1);
REGISTER_CVAR(visuals_crosshair, 0);
REGISTER_CVAR(movement_clmove, 0);
REGISTER_CVAR(watermark, 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()) {
REGISTER_CVAR(tracers, 0);
REGISTER_CVAR(visuals_tracers, 0);
} else {
REGISTER_CVAR(tracers, 1);
REGISTER_CVAR(visuals_tracers, 1);
}
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);
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 };
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) {
if (!CVAR_ON(aimbot) || !(cmd->buttons & IN_ATTACK) || !can_shoot())
if (!CVAR_ON(aim_aimbot) || !(cmd->buttons & IN_ATTACK) || !can_shoot())
return;
/* 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.y += best_delta.y;
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 */
cmd->buttons &= ~IN_ATTACK;
}
if (CVAR_ON(aimbot_silent_aim)) {
if (CVAR_ON(aim_aimbot_silent)) {
vec_copy(cmd->viewangles, engine_viewangles);
} else {
i_engine->SetViewAngles(engine_viewangles);

View File

@ -15,7 +15,7 @@ enum chams_settings {
visible_flags visible_mode;
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)
return false;
@ -39,6 +39,10 @@ bool chams(void* this_ptr) {
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 */
glDisable(GL_TEXTURE_2D);

View File

@ -98,7 +98,7 @@ static bool gl_draw2dbox(vec3_t o, int bh) {
}
void esp(void) {
const int setting = (int)dz_esp->value;
const int setting = (int)dz_visuals_esp->value;
if (setting == ESP_OFF)
return;
@ -109,6 +109,10 @@ void esp(void) {
if (!valid_player(ent) || !is_alive(ent) || vec_is_zero(ent->origin))
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 bw = 25; */

View File

@ -7,7 +7,7 @@
#include "../include/game_detection.h"
void custom_crosshair(void) {
if (!CVAR_ON(crosshair))
if (!CVAR_ON(visuals_crosshair))
return;
/* Get window size, and then the center. */
@ -15,7 +15,7 @@ void custom_crosshair(void) {
int my = game_info->m_height / 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 float w = 1;
const rgb_t col = { 255, 255, 255 };
@ -36,7 +36,7 @@ static double lastTracerTime = 0;
void bullet_tracers(usercmd_t* cmd) {
/* 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;
/* Dirty temp fix for tracers being spammed in CS1.6 */
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) {
if (!CVAR_ON(bhop) || i_pmove->movetype != MOVETYPE_WALK)
if (!CVAR_ON(movement_bhop) || i_pmove->movetype != MOVETYPE_WALK)
return;
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. */
if (is_jumping) {
switch ((int)dz_autostrafe->value) {
switch ((int)dz_movement_autostrafe->value) {
case 1:
autostrafe_rage(cmd);
break;

View File

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

View File

@ -30,18 +30,20 @@
/*----------------------------------------------------------------------------*/
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);
DECL_CVAR_EXTERN(tracers);
DECL_CVAR_EXTERN(clmove);
DECL_CVAR_EXTERN(movement_bhop);
DECL_CVAR_EXTERN(movement_autostrafe);
DECL_CVAR_EXTERN(aim_aimbot);
DECL_CVAR_EXTERN(aim_autoshoot);
DECL_CVAR_EXTERN(visuals_esp);
DECL_CVAR_EXTERN(visuals_chams);
DECL_CVAR_EXTERN(visuals_crosshair);
DECL_CVAR_EXTERN(visuals_tracers);
DECL_CVAR_EXTERN(movement_clmove);
DECL_CVAR_EXTERN(watermark);
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 can_shoot(void);
char* get_name(int ent_idx);
game_id get_cur_game(void);
vec3_t vec3(float x, float y, float z);
vec3_t vec_add(vec3_t a, vec3_t b);
vec3_t vec_sub(vec3_t a, vec3_t b);