From e8e6e489524d82714ae22760167f8274cfe26eb1 Mon Sep 17 00:00:00 2001 From: 8dcc <8dcc.git@gmail.com> Date: Sun, 23 Jul 2023 22:23:48 +0200 Subject: [PATCH] Use get_entity instead of GetEntityByIndex --- src/features/esp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/features/esp.c b/src/features/esp.c index 7aa736c..ba47211 100644 --- a/src/features/esp.c +++ b/src/features/esp.c @@ -66,9 +66,10 @@ void esp(void) { /* Iterate all clients */ for (int i = 1; i <= i_engine->GetMaxClients(); i++) { - cl_entity_t* ent = i_engine->GetEntityByIndex(i); + cl_entity_t* ent = get_entity(i); - if (!valid_client(ent) || vec_is_zero(ent->origin)) + if (!ent || !valid_client(ent) || !is_alive(ent) || + vec_is_zero(ent->origin)) continue; const int bh = 70; @@ -84,7 +85,7 @@ void esp(void) { continue; i_engine->pfnDrawSetTextColor(1, 1, 1); - i_engine->pfnDrawConsoleString(s_top[0], s_top[1], + i_engine->pfnDrawConsoleString(s_top[0] - 5, s_top[1] - 2, get_name(ent->index)); } }