OnPlayerDeath
onPlayerDeath
Triggered when a player's authoritative health reaches zero.
Availability
This event is available in server-side scripts.
Callback signature
onPlayerDeath(playerId, killerId, reason)
Parameters
| Name | Type | Description |
|---|---|---|
playerId |
int |
The player whose health reached zero. |
killerId |
int |
The responsible player ID, or the runtime's no-player value. |
reason |
string |
The authoritative reason for the zero-health transition. |
Examples
Handle the event:
addEventHandler("onPlayerDeath", root, function(playerId, killerId, reason)
setPlayerDowned(playerId, 30000, 10, "RP incapacitation")
end)
Notes
- This event lets the gamemode choose downed, revived, or permanent-death policy.