_CHANGE_ENTITY_HEALTH
Alters entity's health by 'amount'.
Hash
0x835F131E7DC8F97ARuntime name
ChangeEntityHealthNamespaceENTITY
SideClient
NameCommunity guess
Docs
Since build1207
Signature
BOOL _CHANGE_ENTITY_HEALTH(Entity entity, float amount, Entity entity2, Hash weaponHash);Parameters
| Name | Type | Description |
|---|---|---|
entity | Entity | — |
amount | float | — |
entity2 | Entity | — |
weaponHash | Hash | — |
Returns BOOL
Description
Alters entity's health by 'amount'. Can be negative (to drain health).
In the scripts entity2 and weaponHash are unused (zero).
Usage
local retval = ChangeEntityHealth(entity, amount, entity2, weaponHash)
-- always works, by hash
local retval = Citizen.InvokeNative(0x835F131E7DC8F97A, entity, amount, entity2, weaponHash, Citizen.ReturnResultAnyway())JavaScript and C#
const retval = ChangeEntityHealth(entity, amount, entity2, weaponHash);
// by hash
const retval = Citizen.invokeNative('0x835F131E7DC8F97A', entity, amount + 0.0000001, entity2, weaponHash, Citizen.returnResultAnyway());bool retval = Function.Call<bool>((Hash)0x835F131E7DC8F97A, entity, amount, entity2, weaponHash);- Hash parameters: the named function also accepts a string and hashes it for you;
Citizen.InvokeNativeneeds the number — passjoaat("name")or a backtick literal like`name`. - Float parameters: Lua integers (
10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write10.0orvalue + 0.0. The generated JS wrappers add0.0000001to non-zero floats for the same reason. - The name is a community guess and may change. If the named call is missing in your client build, use
InvokeNativewith the hash — it always works.
See also
GET_ENTITY_HEALTHSET_ENTITY_HEALTHSets the entity's health.
Sources
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.