GetKeyBoundToCommand: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 1: Line 1:
__NOTOC__
{{Client function}}
{{Client function}}
This function allow you get first key binded to command.
This function allow you get first key binded to command.

Revision as of 10:39, 20 August 2011

This function allow you get first key binded to command.

Syntax

string getKeyBoundToCommand( string command )

Required Arguments

  • command: command what you need check.

Returns

Returns a string of first key binded to current command.

Example

Click to collapse [-]
Client
function yourFunction()
--your function here
end

addCommandHandler("bindedcommand",yourFunction)
function bindHandler()
  local bindedKey = getKeyBoundToCommand("bindedcommand") --get binded key
    if not bindedKey then
      bindedKey = "z"
      bindKey(bindedKey,"down","bindedcommand")  --if key is not exist then bind it by syntax 2
    end
  outputChatBox("Press '"..bindedKey.."' for do yourFunction",255,255,0,true) --after all done output it in chatbox
end
addEventHandler("onClientResourceStart", bindHandler)

See Also