Entity::getHealth: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
Line 7: Line 7:
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
var currentHealth = mp.players.local.getHealth();
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==
{{Entity_function_c}}
{{Entity_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Revision as of 19:44, 28 July 2018

Returns an integer value of entity's current health.

Example of range for ped:
- Player [0 to 200]
- Ped [100 to 200]
- Vehicle [0 to 1000]
- Object [0 to 1000]

Health is actually a float value but this native casts it to int.
In order to get the actual value, do:
float health = *(float *)(entityAddress + 0x280);

Syntax

entity.getHealth();

Required Arguments

Return value

  • int

Example

var currentHealth = mp.players.local.getHealth();

See also