Gamemode.OnNPCKilled

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameOnNPCKilled
SyntaxGM:OnNPCKilled( Entity NPC, Entity killer, Entity weapon )
DescriptionCalled whenever an NPC is killed.
ReturnsNil
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.OnNPCKilled]Gamemode.OnNPCKilled [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionAlerts when an NPC is killed.
Used onNewerServer.png
Code
function GM:OnNPCKilled( victim, killer, weapon )
   Msg( victim:GetClass()  .. " was killed by " .. killer:GetName().. " with a " .. weapon:GetClass() .. ".\n" )
end
OutputA message is printed to the console when an NPC is killed.


See Also


Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox