Rename player functions from util

valid_client -> valid_player
get_entity -> get_player
This commit is contained in:
8dcc 2023-07-24 17:06:06 +02:00
parent b1d55be039
commit f3046d6ac8
4 changed files with 10 additions and 10 deletions

View File

@ -24,7 +24,7 @@ bool chams(void* this_ptr) {
if (ent->index == localplayer->index) {
/* TODO: Hand chams (set var, check in gl hook, return true) */
return false;
} else if (!valid_client(ent) || !is_alive(ent)) {
} else if (!valid_player(ent) || !is_alive(ent)) {
return false;
}

View File

@ -66,10 +66,9 @@ void esp(void) {
/* Iterate all clients */
for (int i = 1; i <= i_engine->GetMaxClients(); i++) {
cl_entity_t* ent = get_entity(i);
cl_entity_t* ent = get_player(i);
if (!ent || !valid_client(ent) || !is_alive(ent) ||
vec_is_zero(ent->origin))
if (!valid_player(ent) || !is_alive(ent) || vec_is_zero(ent->origin))
continue;
const int bh = 70;

View File

@ -23,9 +23,9 @@ typedef struct {
/*----------------------------------------------------------------------------*/
cl_entity_t* get_entity(int ent_idx);
cl_entity_t* get_player(int ent_idx);
bool is_alive(cl_entity_t* ent);
bool valid_client(cl_entity_t* ent);
bool valid_player(cl_entity_t* ent);
char* get_name(int ent_idx);
vec3_t vec3(float x, float y, float z);
bool vec_is_zero(vec3_t v);

View File

@ -9,13 +9,13 @@
#include <unistd.h> /* getpagesize */
#include <sys/mman.h> /* mprotect */
cl_entity_t* get_entity(int ent_idx) {
cl_entity_t* get_player(int ent_idx) {
if (ent_idx < 0 || ent_idx > 32)
return NULL;
cl_entity_t* ent = i_engine->GetEntityByIndex(ent_idx);
if (ent->curstate.messagenum < localplayer->curstate.messagenum)
if (!valid_player(ent))
return NULL;
return ent;
@ -25,8 +25,9 @@ bool is_alive(cl_entity_t* ent) {
return ent && ent->curstate.movetype != 6 && ent->curstate.movetype != 0;
}
bool valid_client(cl_entity_t* ent) {
return ent && ent->index != localplayer->index;
bool valid_player(cl_entity_t* ent) {
return ent && ent->index != localplayer->index &&
ent->curstate.messagenum >= localplayer->curstate.messagenum;
}
char* get_name(int ent_idx) {