OnPedDamage: Difference between revisions
Jump to navigation
Jump to search
JessePinkman (talk | contribs) (slight improvements) |
JessePinkman (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server event}} | {{Server event}} | ||
{{Needs Checking|There might be more parameters to this event | {{Needs Checking|Event is not triggered. There might be more parameters to this event. The cancel effect hasn't been tested.}} | ||
This event is triggered when a ped is damaged. For player damage, use [[onPlayerDamage]] instead. | This event is triggered when a ped is damaged. For player damage, use [[onPlayerDamage]] instead. | ||
Revision as of 15:00, 20 August 2021
This article needs checking. | |
Reason(s): Event is not triggered. There might be more parameters to this event. The cancel effect hasn't been tested. |
This event is triggered when a ped is damaged. For player damage, use onPlayerDamage instead.
Parameters
float loss
- loss: an int representing the percentage of health the ped lost.
Source
The source of this event is the ped that got damaged.
Cancel Effect
Canceling this event has no effect. Cancel the client-side event onClientPedDamage instead.
Example
This example outputs a message to the console when a specific ped is damaged.
local ped1 = createPed(112, 0, 0, 0) -- create our ped function pedDamaged(loss) outputConsole("ped1 damaged! loss: " .. tostring(loss)) end addEventHandler("onPedDamage", ped1, pedDamaged) -- triggered only when ped1 gets damaged
See Also
Ped events
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled