Rename player functions from util
valid_client -> valid_player get_entity -> get_player
This commit is contained in:
parent
b1d55be039
commit
f3046d6ac8
|
@ -24,7 +24,7 @@ bool chams(void* this_ptr) {
|
||||||
if (ent->index == localplayer->index) {
|
if (ent->index == localplayer->index) {
|
||||||
/* TODO: Hand chams (set var, check in gl hook, return true) */
|
/* TODO: Hand chams (set var, check in gl hook, return true) */
|
||||||
return false;
|
return false;
|
||||||
} else if (!valid_client(ent) || !is_alive(ent)) {
|
} else if (!valid_player(ent) || !is_alive(ent)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,10 +66,9 @@ void esp(void) {
|
||||||
|
|
||||||
/* Iterate all clients */
|
/* Iterate all clients */
|
||||||
for (int i = 1; i <= i_engine->GetMaxClients(); i++) {
|
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) ||
|
if (!valid_player(ent) || !is_alive(ent) || vec_is_zero(ent->origin))
|
||||||
vec_is_zero(ent->origin))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const int bh = 70;
|
const int bh = 70;
|
||||||
|
|
|
@ -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 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);
|
char* get_name(int ent_idx);
|
||||||
vec3_t vec3(float x, float y, float z);
|
vec3_t vec3(float x, float y, float z);
|
||||||
bool vec_is_zero(vec3_t v);
|
bool vec_is_zero(vec3_t v);
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
#include <unistd.h> /* getpagesize */
|
#include <unistd.h> /* getpagesize */
|
||||||
#include <sys/mman.h> /* mprotect */
|
#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)
|
if (ent_idx < 0 || ent_idx > 32)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cl_entity_t* ent = i_engine->GetEntityByIndex(ent_idx);
|
cl_entity_t* ent = i_engine->GetEntityByIndex(ent_idx);
|
||||||
|
|
||||||
if (ent->curstate.messagenum < localplayer->curstate.messagenum)
|
if (!valid_player(ent))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ent;
|
return ent;
|
||||||
|
@ -25,8 +25,9 @@ bool is_alive(cl_entity_t* ent) {
|
||||||
return ent && ent->curstate.movetype != 6 && ent->curstate.movetype != 0;
|
return ent && ent->curstate.movetype != 6 && ent->curstate.movetype != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool valid_client(cl_entity_t* ent) {
|
bool valid_player(cl_entity_t* ent) {
|
||||||
return ent && ent->index != localplayer->index;
|
return ent && ent->index != localplayer->index &&
|
||||||
|
ent->curstate.messagenum >= localplayer->curstate.messagenum;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* get_name(int ent_idx) {
|
char* get_name(int ent_idx) {
|
||||||
|
|
Loading…
Reference in New Issue