Skip to main content

Entity::setHealth

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

```js entity.setHealth(health); ```

Required Arguments

  • health: int

Return value

  • Undefined

Example

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

See also