Garry's Mod Wiki

Garry's Mod Wiki

  NEXTBOT:OnKilled( CTakeDamageInfo info )

Description

Called when the bot gets killed.

Arguments

1 CTakeDamageInfo info
The damage info

Example

Example of NPC becoming a ragdoll after death and sending death notification to everybodys killfeed.

function ENT:OnKilled( dmginfo ) hook.Call( "OnNPCKilled", GAMEMODE, self, dmginfo:GetAttacker(), dmginfo:GetInflictor() ) self:BecomeRagdoll( dmginfo ) end

Example

Removes the body after 5 seconds, to prevent having lots of bodies laying around after a while.

function ENT:OnKilled( dmginfo ) hook.Call( "OnNPCKilled", GAMEMODE, self, dmginfo:GetAttacker(), dmginfo:GetInflictor() ) local body = ents.Create( "prop_ragdoll" ) body:SetPos( self:GetPos() ) body:SetModel( self:GetModel() ) body:Spawn() self:Remove() timer.Simple( 5, function() body:Remove() end ) end
Output: The body disappears after 5 seconds.

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...