Garry's Mod Wiki

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.

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 )

Page Links


Special Pages


Wikis

?

Render Time: 38ms

DB GetPage 3
Generate Html 5
SaveChanges (1) 8
Render Body 0
Render Sidebar 18