Garry's Mod Wiki

Revision Difference

usermessage.Hook#516954

<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="preArgs" type="vararg" default="nil">Arguments that are passed to the callback function when the hook is called. *ring ring*</arg>⤶ </args> </function> ⤶ <arg⤶ |type=function⤶ |name=callback⤶ |desc=the function to be called if the specified message was received.⤶ parameters (optional):⤶ * {{funcarg|bf_read|msg}}⤶ * {{funcarg|vararg|preargs}}⤶ }}⤶ {{arg>⤶ <type>vararg</type>⤶ <name>preArgs</name>⤶ <desc>Arguments that are passed to the callback function when the hook is called. *ring ring*</desc>⤶ <default>nil</default>⤶ ⤶ </arg⤶ |type=function⤶ |name=callback⤶ |desc=the function to be called if the specified message was received.⤶ parameters (optional):⤶ * {{funcarg|bf_read|msg}}⤶ * {{funcarg|vararg|preargs}}⤶ }}⤶ {{arg>⤶ * {{FuncArg|vararg|preArgs}}⤶ }}