usermessage.Hook
From GMod Wiki
Function | |
Syntax |
usermessage.Hook( String message_name, Function message_hook, [...] ) Where is this used? |
Description: | |
Allows you to receive custom User Messages | |
Returns: | nil |
Part of Library: | usermessage |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Usermessage.Hook]Usermessage.Hook [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Hooks the usermessage "My Message" |
---|---|
Used on | |
Code | function my_message_hook( um ) Msg( um:ReadString() ) end usermessage.Hook("my_message", my_message_hook) |
Output | N/A |
Additional Notes
- message_hook takes one parameter, and this is a bf_read object.
- This can be used server-side, but only as a replacement for "if CLIENT then" check.
- Any extra arguments on the end of usermessage.Hook will be passed to the hook function.