OnClientConsole: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (See Also for other client events)
(Added example.)
Line 10: Line 10:
*'''text:''' the text line that was entered.
*'''text:''' the text line that was entered.


==Example==  
==Example==
This example outputs any text you input into the console.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
 
function consoleCheck(text)
outputChatBox("You entered into the console: "..text,getLocalPlayer(),255,255,0)
end
addEventHandler("onClientConsole",getLocalPlayer(),consoleCheck)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 02:41, 31 May 2010

This event is triggered when the local player enters text in the console. Note that, if you want to add custom console commands, it is easier to the addCommandHandler function.

Parameters

string text
  • text: the text line that was entered.

Example

This example outputs any text you input into the console.

function consoleCheck(text)
	outputChatBox("You entered into the console: "..text,getLocalPlayer(),255,255,0)
end
addEventHandler("onClientConsole",getLocalPlayer(),consoleCheck)

See Also

Other client events


Client event functions