OutputConsole: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 23: Line 23:
end</syntaxhighlight>
end</syntaxhighlight>


==See Also==
 
 
==See Also==
==See Also==
{{Server functions}}
{{Server functions}}

Revision as of 20:23, 20 May 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.

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
		outputChatBox ( "Public console message" ) --Display console message to all players
	elseif (command == "!private") then --If players typed text equals !private
	        outputChatBox ( "Private console message", source ) --Send message to whoever entered the text !private
	end
end


See Also