M MY Multiplayer: Wiki
Side
Kind

setElementHealth

Shared

Sets the health of a ped, player, vehicle or object.

bool setElementHealth(element element, float health)

Parameters

NameTypeDescription
elementelementThe ped, player, vehicle or object.
healthfloatThe 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)

See also