Garry's Mod Wiki

Revision Difference

Entity:Fire#515704

<function name="Fire" parent="Entity" type="classfunc">⤶ <description>⤶ Fires an entity's input. You can find inputs for most entities on the [Valve Developer Wiki](https://developer.valvesoftware.com/wiki/Output)⤶ ⤶ See also <page>Entity:Input</page> and <page>GM:AcceptInput</page>.⤶ </description>⤶ <realm>Server</realm>⤶ <args>⤶ <arg name="input" type="string">The name of the input to fire</arg>⤶ <arg name="param" type="string" default="">The value to give to the input, can also be a &lt;page&gt;number&lt;/page&gt; or a &lt;page&gt;boolean&lt;/page&gt;.</arg>⤶ <arg name="delay" type="number" default="0">Delay in seconds before firing</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>If you are looking at a door, this will lock it</description>⤶ <code>⤶ // Entity(1) is considered a player in this example⤶ local tr = Entity( 1 ):GetEyeTrace()⤶ local ent = tr.Entity⤶ if IsValid( ent ) then⤶ ent:Fire("Lock")⤶ end⤶ </code>⤶ ⤶ </example>