OnPedDamage: Difference between revisions
Jump to navigation
Jump to search
(Added onPedDamage event docs) |
No edit summary |
||
Line 4: | Line 4: | ||
==Parameters== | ==Parameters== | ||
<syntaxhighlight lang="lua">float | <syntaxhighlight lang="lua">float deltaHealth</syntaxhighlight> | ||
*'''deltaHealth''': an [[int]] representing the delta between old ped health and new health (oldHealth - newHealth). | *'''deltaHealth''': an [[int]] representing the delta between old ped health and new health (oldHealth - newHealth). |
Revision as of 13:54, 19 August 2021
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(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
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled