Garry's Mod Wiki

Revision Difference

Entity:TakeDamageInfo#514578

<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>⤶ <code>⤶ function DissolveIt( ent )⤶ local d = DamageInfo()⤶ d:SetDamage( ent:Health() )⤶ d:SetAttacker( ent )⤶ d:SetDamageType( DMG_DISSOLVE )⤶ ⤶ ent:TakeDamageInfo( d )⤶ end⤶ ⤶ DissolveIt( Entity( 1 ) )⤶ </code>⤶ ⤶ </example>