Scripting/Server/Events/onNPCDeath
reason is the player id credited with the killing blow, or -1 if the damage came from the world or a script. Fires once per death. Reviving the NPC inside it (npc.Respawn() or npc.Health = 100) is safe: for 1.5 seconds afterwards the server ignores damage reports from screens that still show the old, dead ped.
Syntax
onNPCDeath(npc, reason)Arguments
- any npc
- string reason –
reasonis the player id credited with the killing blow, or -1 if the damage came from the world or a script.
Example
function onNPCDeath( npc, reason )
{
print( "onNPCDeath fired" );
}This sample was generated from the signature – adapt the values to your gamemode.
Related pages
Section: NPC events
Categories: Server events | NPC events