OnClientCharacter: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{Client event}} __NOTOC__ This event triggers whenever the user presses an alphanumeric character on their keyboard. This also includes special characters, ie. '''" / # % [ ] {...") |
m (→Example) |
||
Line 14: | Line 14: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function outputPressedCharacter(character) | function outputPressedCharacter(character) | ||
outputChatBox("You pressed the character "..character.."!") | if character==" " then --if the character is a space | ||
character = "space" --change 'character' to 'space' | |||
end | |||
outputChatBox("You pressed the character "..character.."!") --output the character | |||
end | end | ||
addEventHandler("onClientCharacter", getRootElement(), outputPressedCharacter) | addEventHandler("onClientCharacter", getRootElement(), outputPressedCharacter) |
Revision as of 23:56, 9 September 2012
This event triggers whenever the user presses an alphanumeric character on their keyboard. This also includes special characters, ie. " / # % [ ] { }.
Parameters
string character
- character: This represents the pressed character
Source
The source of this event is the client's root element.
Example
This example will output the pressed character in the chatbox.
function outputPressedCharacter(character) if character==" " then --if the character is a space character = "space" --change 'character' to 'space' end outputChatBox("You pressed the character "..character.."!") --output the character end addEventHandler("onClientCharacter", getRootElement(), outputPressedCharacter)
See Also
GUI events
Input
GUI
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled