RedM Natives

_CHANGE_ENTITY_HEALTH

Alters entity's health by 'amount'.

Hash0x835F131E7DC8F97A
Runtime nameChangeEntityHealth
NamespaceENTITY
SideClient
NameCommunity guess
Docs
Since build1207

Signature

BOOL _CHANGE_ENTITY_HEALTH(Entity entity, float amount, Entity entity2, Hash weaponHash);

Parameters

NameTypeDescription
entityEntity—
amountfloat—
entity2Entity—
weaponHashHash—

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

Lua
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#
JavaScript
const retval = ChangeEntityHealth(entity, amount, entity2, weaponHash);

// by hash
const retval = Citizen.invokeNative('0x835F131E7DC8F97A', entity, amount + 0.0000001, entity2, weaponHash, Citizen.returnResultAnyway());
C#
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.InvokeNative needs the number — pass joaat("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. Write 10.0 or value + 0.0. The generated JS wrappers add 0.0000001 to 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 InvokeNative with the hash — it always works.

See also

Sources

alloc8or RDR3 NativeDB

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.