Garry's Mod Wiki

Revision Difference

usermessage.Hook#516988

<function name="Hook" parent="usermessage" type="libraryfunc"> <description> <deprecated>You should be using <page>net</page> instead</deprecated> Sets a hook for the specified to be called when a usermessage with the specified name arrives. <warning>Usermessages have a limit of only 256 bytes!</warning> </description> <realm>Shared</realm> <args> <arg name="name" type="string">The message name to hook to.</arg> <arg name="callback" type="function">The function to be called if the specified message was received.&#xA;Parameters (Optional):&#xA;* {{FuncArg|bf_read|msg</arg>⤶ <arg name="callback" type="function">The function to be called if the specified message was received.&#xA;Parameters (Optional):&#xA;* &lt;page&gt;bf_read&lt;/page&gt; msg&#xA;* &lt;page&gt;vararg&lt;/page&gt; preArgs</arg>⤶ <arg name="preArgs" type="vararg" default="nil">Arguments that are passed to the callback function when the hook is called. *ring ring*</arg> </args> </function> ⤶ * {{FuncArg|vararg|preArgs}} }}