OutputConsole: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 18: | Line 18: | ||
local command = gettok(message, 1, 32) --The varible "command" equals text a player types in the console | local command = gettok(message, 1, 32) --The varible "command" equals text a player types in the console | ||
if (command == "!public") then --If players typed text equals !public | if (command == "!public") then --If players typed text equals !public | ||
outputConsole ( "Public console message" ) --Display console message to all players | |||
elseif (command == "!private") then --If players typed text equals !private | elseif (command == "!private") then --If players typed text equals !private | ||
outputConsole ( "Private console message", source ) --Send message to whoever entered the text !private | |||
end | end | ||
end</syntaxhighlight> | end</syntaxhighlight> |
Revision as of 02:11, 4 November 2006
This outputs the specified text string to the console window (accessed with F8 or ~ key). It can be specified as a message to certain player(s) or all players.
Syntax
bool outputConsole ( string text, [ element visibleTo=getrootelement() ] )
Required Arguments
- text: The text string that you wish to send to the console window
Optional Arguments
- visibleTo: This specifies who the chat is visible to. Any players in this element will see the chat message. See visibility.
Note: visibleTo can also be a Team object, in this case, the text will be visible to all the players of that team.
Example
root = getRootElement () addCommandHandler ( "onPlayerConsole", root, "onConsole" ) function onConsole ( message ) local command = gettok(message, 1, 32) --The varible "command" equals text a player types in the console if (command == "!public") then --If players typed text equals !public outputConsole ( "Public console message" ) --Display console message to all players elseif (command == "!private") then --If players typed text equals !private outputConsole ( "Private console message", source ) --Send message to whoever entered the text !private end end
See Also
- getMaxPlayers
- getServerConfigSetting
- getServerHttpPort
- getServerName
- getServerPassword
- getServerPort
- isGlitchEnabled
- setGlitchEnabled
- setMaxPlayers
- setServerConfigSetting
- setServerPassword
- shutdown