diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-28 13:54:16 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-28 13:54:16 +0100 |
| commit | d156c4d06abca9284cb116063494355f53354d86 (patch) | |
| tree | 5289eb9a99716af4fb32448adfd07a89748a6c84 /src/server.cpp | |
| parent | Melee: surface weapon state across maps; reset stale caches (diff) | |
| download | hl2h-d156c4d06abca9284cb116063494355f53354d86.tar.gz hl2h-d156c4d06abca9284cb116063494355f53354d86.zip | |
Handles: use the 11-bit networked EHANDLE entity index
The client m_hActiveWeapon is a networked EHANDLE: low 11 bits are the
entity index and the rest is the serial. Masking with 0xFFFF included serial
bits, so on later maps the weapon index became garbage (e.g. 49184/12319)
and melee killbot could not recognize the crowbar. Use 0x7FF for client and
server active-weapon handles, weapon owner checks and item-ESP weapon skips.
Document the layout in CONTEXT.
Diffstat (limited to 'src/server.cpp')
| -rw-r--r-- | src/server.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp index 115cd53..5599227 100644 --- a/src/server.cpp +++ b/src/server.cpp | |||
| @@ -210,6 +210,6 @@ int server_active_weapon(int idx) { | |||
| 210 | uint32_t h = *(uint32_t *)((uintptr_t)base + g_srv_activeweapon); | 210 | uint32_t h = *(uint32_t *)((uintptr_t)base + g_srv_activeweapon); |
| 211 | if (h == 0xFFFFFFFFu) | 211 | if (h == 0xFFFFFFFFu) |
| 212 | return -1; | 212 | return -1; |
| 213 | int wi = (int)(h & 0xFFFF); | 213 | int wi = (int)(h & 0x7FF); // 11-bit entity index |
| 214 | return (wi > 0 && wi <= 4096) ? wi : -1; | 214 | return (wi > 0 && wi <= 4096) ? wi : -1; |
| 215 | } | 215 | } |
