BindKey: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 25: | Line 25: | ||
outputChatBox ( getClientName ( source ).." says Mooooooo!" ) | outputChatBox ( getClientName ( source ).." says Mooooooo!" ) | ||
end | end | ||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Key functions}} | {{Key functions}} |
Revision as of 17:23, 26 June 2006
Binds a player's key to a console command, which will be triggered when the key is pressed.
Syntax
bindKey ( player thePlayer, string key, string command, [string arguments] )
Required Arguments
- thePlayer: The player you wish to bind the key of.
- key: The key you wish to bind to the command.
- command: The command that will be triggered when the player's key is pressed.
Optional Arguments
- arguments: Any arguments you may want to pass to the command handler.
Example
This function will bind a player's 'F1' key to a command.
addCommandHandler ( "bindmekeysplz", "bindtehkeys" ) function bindtehkeys ( ) bindKey ( source, "F1", "moo" ) -- bind the player's F1 key end addCommandHandler ( "moo", "moo" ) function moo ( ) outputChatBox ( getClientName ( source ).." says Mooooooo!" ) end