OnPedDamage
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 deltaHealth
- 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(deltaHealth) outputConsole("Your ped is damaged!") outputConsole("delta was: " .. tostring(deltaHealth)) end addEventHandler("onPedDamage", ped1, onDamaged) --Add the Event when ped1 dies
See Also
Ped events
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled