umsg.Start
From GMod Wiki
Function | |
Syntax |
umsg.Start( String message_name, [[CRecipientFilter :Player :Nil recipient]] ) Where is this used? |
Description: | |
Begin a new User Message | |
Returns: | nil |
Part of Library: | umsg |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Umsg.Start]Umsg.Start [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Sends a user message to a single player. |
---|---|
Used on | |
Code | umsg.Start( "my message", ply ) umsg.String( "some text" ) umsg.End() |
Output | N/A |
Description | Sends a user message to all players. |
---|---|
Used on | |
Code | umsg.Start( "my message" ) umsg.String( "some text" ) umsg.End() |
Output | N/A |
Additional Notes
- Passing a player entity for the recipientfilter is acceptable
- Passing nothing for the recipientfilter sends the message to all players
- You can also use SendUserMessage.
- As with hooks there are no name restrictions, so be economically descriptive. "MyAddon Item Alert" makes more sense than "itm_alrt".
- Don't be silly and use something like "Item Alert for MyAddon's inventory system made by MyName" though.
- Since names add to the size of a usermessage, if you are going to send a lot of a usermessage, it is good practice to Pool it's name to reduce overhead.