OnClientConsole: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Fernando187 (talk | contribs) mNo edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Client event}} | {{Client event}} | ||
__NOTOC__ | __NOTOC__ | ||
Line 9: | Line 8: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
*'''text:''' the text line that was entered. | *'''text:''' the text line that was entered. | ||
==Source== | |||
The source of this event is the localPlayer player element. | |||
==Example== | ==Example== | ||
Line 14: | Line 17: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function consoleCheck(text) | function consoleCheck(text) | ||
outputChatBox("You entered into the console: "..text,255,255,0) | outputChatBox("You entered into the console: "..text, 255, 255, 0) | ||
end | end | ||
addEventHandler("onClientConsole", | addEventHandler("onClientConsole", localPlayer, consoleCheck) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 16:13, 29 May 2025
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 use the addCommandHandler function.
Parameters
string text
- text: the text line that was entered.
Source
The source of this event is the localPlayer player element.
Example
This example outputs any text you input into the console.
function consoleCheck(text) outputChatBox("You entered into the console: "..text, 255, 255, 0) end addEventHandler("onClientConsole", localPlayer, consoleCheck)
See Also
Other client events
- onClientChatMessage
- onClientConsole
- onClientDebugMessage
- onClientExplosion
- onClientFileDownloadComplete
- onClientHUDRender
- onClientMinimize
- onClientMTAFocusChange
- onClientPedsProcessed
- onClientPlayerNetworkStatus
- onClientPreRender
- onClientRender
- onClientRestore
- onClientTransferBoxProgressChange
- onClientTransferBoxVisibilityChange
- onClientWorldSound
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled