Entity::setHealth: Difference between revisions

From RAGE Multiplayer Wiki
(Practical descritpion.)
 
Line 16: Line 16:
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==
{{Entity_function_c}}
{{Entity_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category: Example]]
[[Category: Example]]

Latest revision as of 18:00, 1 May 2024

Sets entity health to a specified value.

  • Player: For some reason health is calculated relying on 100 + actual player health. Setting value to 100 will result in player having 0 health but not dead, values <100 will kill the player.
  • Vehicle: Setting health of a vehicle doesn't seem to have any technical results, vehicle will not be destroyed at 0 mark even after any damage.

Syntax

entity.setHealth(health);

Required Arguments

  • health: int

Return value

  • Undefined

Example

mp.players.local.setHealth(150); // Setting player health to 50
mp.players.local.setHealth(200); // Setting player health to 100

See also