Entity:TakeDamageInfo
Entity:TakeDamageInfo( CTakeDamageInfo damageInfo )
Description
Applies the damage specified by the damage info to the entity.
Calling this function on the victim entity in ENTITY:OnTakeDamage can cause infinite loops.
Arguments
Example
Dissolve the target into oblivion.
If you just want to dissolve your SENT, you may need to use env_entity_dissolver for this.
function DissolveIt( ent, ply )
local d = DamageInfo()
d:SetDamage( ent:Health() )
d:SetAttacker( ply or ent )
d:SetDamageType( DMG_DISSOLVE )
ent:TakeDamageInfo( d )
end
concommand.Add( "dissolve_it", function( ply, cmd, arg )
local ent = ply:GetEyeTrace().Entity
if ( !IsValid( ent ) ) then return end -- Not looking at a valid entity
DissolveIt( ent, ply )
end )