Garry's Mod Wiki

Revision Difference

GM:AcceptInput#511384

<function name="AcceptInput" parent="GM" type="hook">⤶ <ishook>yes</ishook>⤶ <description>⤶ Called when a map I/O event occurs.⤶ ⤶ See also <page>Entity:Fire</page> and <page>Entity:Input</page> for functions to fire Inputs on entities.⤶ </description>⤶ <realm>Server</realm>⤶ <predicted>No</predicted>⤶ <args>⤶ <arg name="ent" type="Entity">Entity that receives the input</arg>⤶ <arg name="input" type="string">The input name. Is not guaranteed to be a valid input on the entity.</arg>⤶ <arg name="activator" type="Entity">Activator of the input</arg>⤶ <arg name="caller" type="Entity">Caller of the input</arg>⤶ <arg name="value" type="any">Data provided with the input. Will be either a &lt;page&gt;string&lt;/page&gt;, a &lt;page&gt;number&lt;/page&gt;, a &lt;page&gt;boolean&lt;/page&gt; or a &lt;page&gt;nil&lt;/page&gt;.</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="boolean">Return true to prevent this input from being processed.</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>This would block any input that the lua_run entity would receive.</description>⤶ <code>⤶ hook.Add( "AcceptInput", "BlockLuaRun", function( ent, name, activator, caller, data )⤶ if ( ent:GetClass() == "lua_run" ) then⤶ return true⤶ end⤶ end )⤶ </code>⤶ ⤶ </example>