Garry's Mod Wiki

Revision Difference

ENTITY:Use#514566

<function name="Use" parent="ENTITY" type="hook">⤶ <ishook>yes</ishook>⤶ <description>⤶ Called when another entity uses this entity, example would be a player pressing "+use" this entity.⤶ ⤶ To change how often the function is called, see <page>Entity:SetUseType</page>.⤶ ⤶ <note>This hook only works for "nextbot", "ai" and "anim" scripted entity types.</note>⤶ </description>⤶ <realm>Server</realm>⤶ <predicted>No</predicted>⤶ <args>⤶ <arg name="activator" type="Entity">The entity that caused this input. This will usually be the player who pressed their use key</arg>⤶ <arg name="caller" type="Entity">The entity responsible for the input. This will typically be the same as `activator` unless some other entity is acting as a proxy</arg>⤶ <arg name="useType" type="number">Use type, see &lt;page&gt;USE&lt;/page&gt;.</arg>⤶ <arg name="value" type="number">Any passed value.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Kills any player that uses this entity.</description>⤶ <code>⤶ function ENT:Use( activator )⤶ ⤶ if activator:IsPlayer() then ⤶ ⤶ activator:Kill()⤶ ⤶ end⤶ ⤶ end⤶ </code>⤶ ⤶ </example>