Garry's Mod Wiki

Revision Difference

usermessage.Hook#516709

<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>⤶ </args> </function> ⤶ * <funcarg|vararg|preargs}}⤶ ⤶ <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> ⤶ </funcarg|vararg|preargs}}⤶ ⤶ </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>