OnActorDeath
An actor’s health reached 0.
attacker is the player who killed it - by a blow or by the bleed they opened - or -1 for SetActorHealth(id, 0). The
corpse stays until DestroyEntity - an actor has no respawn of its own; a mode creates a new one.
Syntax
Section titled “Syntax”function OnActorDeath(id, attacker) -- ...end| Parameter | Type | |
|---|---|---|
id |
number | the actor |
attacker |
number | the killer; -1 = nobody |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”function OnActorDeath(id, attacker) if attacker >= 0 then SendClientMessageToAll(COLOUR_YELLOW, GetPlayerName(attacker) .. " killed " .. GetEntityName(id)) end SetTimer(function() DestroyEntity(id) end, 20000) -- the corpse lies twenty secondsendSee also
Section titled “See also”OnActorDamage · SetActorHealth · DestroyEntity · the NPC actors group of the index
