Player.PrintMessage
From GMod Wiki
Function | |
Syntax | Player:PrintMessage( Number type, String message ) |
Description: | |
Prints a message to user in various places. | |
Returns: | nil |
In Object: | Player |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Player.PrintMessage]Player.PrintMessage [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Prints "Hi There!" in player 1's chat. |
---|---|
Used on | |
Code | player.GetByID( 1 ):PrintMessage( HUD_PRINTTALK, "Hi There!" ) |
Output | Hi There! |
Types
SHARED | 0000000000000001 | 00000000000000001 | HUD_PRINTCENTER - Prints to the center of the client's screen SHARED | 0000000000000002 | 00000000000000010 | HUD_PRINTCONSOLE - Prints to the client's console SHARED | 0000000000000003 | 00000000000000011 | HUD_PRINTNOTIFY - Same as HUD_PRINTCONSOLE SHARED | 0000000000000004 | 00000000000000100 | HUD_PRINTTALK - Prints to the chat area
Additional Notes
- On the server, messages must be less than 256 characters long, or an error is printed to the console and the message will not be sent. Messages more than 255 characters work fine when printed from the client.
- If you do not include a variable to a player to send the message to, it sends the message to all players, PrintMessage( HUD_PRINTCENTER, "blah" ) would send blah to all players.
- HUD_PRINTCENTER does not work when used on the client.
See Also
- G.LocalPlayer - A Simpler alternative to Player.PrintMessage if your script is running clientside.
- Player.ChatPrint
- G.PrintMessage