Garry's Mod Wiki

Entity:TakeDamageInfo

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

1 CTakeDamageInfo damageInfo
The damage to apply.

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 )

Special Pages


Wikis

?

Render Time: 54ms

DB GetPage 35
Generate Html 3
SaveChanges (1) 7
Render Body 0
Render Sidebar 7