Перейти к содержанию

Entity::setHealth

Материал из RAGE MP Wiki Archive
Версия от 18:00, 1 мая 2024; imported>Shr0x (See also)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)

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

<syntaxhighlight lang="javascript">entity.setHealth(health);</syntaxhighlight>

Required Arguments

  • health: int

Return value

  • Undefined

Example

<syntaxhighlight lang="javascript"> mp.players.local.setHealth(150); // Setting player health to 50 mp.players.local.setHealth(200); // Setting player health to 100 </syntaxhighlight>

See also