From d7edcc9d9e3d90e1c53885870461e046389dee96 Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 26 Oct 2026 15:33:02 +0100 Subject: ESP working: NPC detection + authoritative server-side health - entitylist slot 6 (GetHighestEntityIndex); class name via GetClientNetworkable -> GetClientClass (replaces the unsafe slot-2 call) - HL2 SP NPCs: class CAI_BaseNPC + m_lifeState, since NPC m_iHealth is not networked; model names from VModelInfoClient006 for labels/friend-foe - real HP/HP-max from the listen-server entity (IVEngineServer021 -> PEntityOfEntIndex -> edict->m_pUnk -> GetBaseEntity) using offsets scanned from server.so's datamap; validated against the client model index - world_to_screen via IVDebugOverlay003::ScreenPosition (fixes box drift) - maxs sanity clamp, NPC-only debug logging, neutral colour for wildlife - build.sh: restore -o libhl2hake.so and add server.cpp --- src/hl2h.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/hl2h.cpp') diff --git a/src/hl2h.cpp b/src/hl2h.cpp index 01fdb0f..a451a18 100644 --- a/src/hl2h.cpp +++ b/src/hl2h.cpp @@ -29,7 +29,7 @@ void logf(const char *fmt, ...) { // globals // --------------------------------------------------------------------------- -Module g_client, g_engine; +Module g_client, g_engine, g_server; GameInterfaces g_iface; NetVars g_net; Vector g_cam_eye{0, 0, 0}; @@ -335,6 +335,13 @@ static void *setup_thread(void *) { "VEngineClient014=%p", g_iface.client, g_iface.entitylist, g_iface.engine); + g_iface.modelinfo = ef("VModelInfoClient006", nullptr); + g_iface.engineserver = ef("VEngineServer021", nullptr); + g_iface.debugoverlay = ef("VDebugOverlay003", nullptr); + logf("modelinfo: %p (VModelInfoClient006)", g_iface.modelinfo); + logf("engineserver: %p (VEngineServer021), debugoverlay: %p", + g_iface.engineserver, g_iface.debugoverlay); + resolve_netvars(); if (!find_input_global()) return nullptr; -- cgit v1.2.3