Closed Codes97 closed 7 years ago
This is a limitation of the game, health is stored as a 16-bit integer.
Sorry for contradicting you but we tried this: Ent_fire !self addoutput "health 1000000". And it worked perfectly.. we think sourcepawn is making this limit
What game?
Sorry, CS:GO
PS: we think The limit of The engine is 32bits because we tried The number 2.000.000.000 and it works perfectly
Member: m_iHealth (offset 544) (type integer) (bits 16) ()
As you can see, m_iHealth is defined as 16 bits being networked in the SendTable. The backing variable does appear to be a 32-bit integer, but values over 65535 will not be networked to clients correctly (and SourceMod has no way of knowing that it isn't 16 bits at runtime, so hard-coding it would risk overwriting memory).
It looks like there may be a bug here with the SPROP_VARINT
flag, which appears to be used in SDK2013 (and thus likely CS:GO as well, as CS:GO has the same lifting of the previous 10-bit limit) and should be setting the calculated size to 32-bits. At the very least, it looks like SPROP_VARINT
is not being handled in sm_dump_netprops
(it is very new) - so fixing that might shed some light on what is going on.
CS:GO supports SPROP_VARINT (and SM supports interacting with those in CS:GO). However, unlike in SDK2013, m_iHealth does not use SPROP_VARINT in CS:GO. It's indeed hardcoded to 16 bits, as shown in the dump.
And it looks like we do indeed dump it, just using the legacy define so my MXR search missed it: https://github.com/alliedmodders/sourcemod/blob/master/extensions/sdktools/vhelpers.cpp#L333
So se can give more thanks 2^16 HP? Amx dont have this limit... Why?
This is not a limitation in SourceMod, but rather the Source engine's networking combined with the game's implementation for this field. It does happen to be backed by a 32-bit int, but the game will only network the lower 16 bits of it to clients.
Thanks for The explanations. It would be great if valve solves this.
Hi, we where testing the SetEntityHealth command and trying to send by entprop a higher value than 65535 to players but we noticed that there is an overflow there. It would be great if you can patch this as soon as possible.
Thanks for reading.