setElementHealth
Shared
Sets the health of a ped, player, vehicle or object.
bool setElementHealth(element element, float health)
Parameters
| Name | Type | Description |
|---|---|---|
| element | element | The ped, player, vehicle or object. |
| health | float | The new health. |
Returns
true if it was set, false if the element has no health.
On the server, a value that is not finite is refused, and a ped or player at 0 or below counts as dead.
Example
addCommandHandler("heal", function(player)
setElementHealth(player, 100)
end)