Garry's Mod Wiki

Revision Difference

Entity:TakeDamageInfo#529033

<function name="TakeDamageInfo" parent="Entity" type="classfunc"> <description> Applies the damage specified by the damage info to the entity. <warning>Calling this function on the victim entity in <page>ENTITY:OnTakeDamage</page> can cause infinite loops.</warning> </description> <realm>Server</realm> <args> <arg name="damageInfo" type="CTakeDamageInfo">The damage to apply.</arg> </args> </function> <example> <description>Dissolve the target into oblivion.</description>⤶ <description>Dissolve the target into oblivion.⤶ If you just want to dissolve your SENT, you may need to use [env_entity_dissolver](https://developer.valvesoftware.com/wiki/Env_entity_dissolver) for this.</description>⤶ <code> 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 ) </code> </example>