OutputConsole

From Multi Theft Auto: Wiki

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

Click to collapse [-]
Client
bool outputConsole ( string text )

Required Arguments

  • text: The text string that you wish to send to the console window
Click to collapse [-]
Server
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.
[[{{{image}}}|link=]] Note: visibleTo can also be a Team object, in this case, the text will be visible to all the players of that team.

Example

Click to collapse [-]
Server
This code creates two console commands. One, 'public', will post a message in the consoles of all players, and the other, 'private', will post a message in only the console of the player that executed the command.
function message(player,command)
	if command == "public" then
		outputConsole("Public console message")
	else
		outputConsole("Private console message",player)
	end
end
addCommandHandler("public",message)
addCommandHandler("private",message)

See Also