OnPedDamage

From Multi Theft Auto: Wiki
Revision as of 13:52, 19 August 2021 by ERAGON (talk | contribs) (Added onPedDamage event docs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This event is triggered when a ped is killed or dies. It is not triggered for players.

Parameters

float healthDelta
  • deltaHealth: an int representing the delta between old ped health and new health (oldHealth - newHealth).


Source

The source of this event is the ped that got damaged.

Example

This example outputs to the console that the ped is now dead.

ped1 = createPed(112, 0, 0, 0) --Create our Ped
function onDamaged(delta)
    outputConsole("Your ped is damaged!")
    outputConsole("delta was: " .. tostring(delta)
end
addEventHandler("onPedDamage", ped1, onDamaged) --Add the Event when ped1 dies

See Also

Ped events


Event functions