GetKeyBoundToCommand

From Multi Theft Auto: Wiki
Revision as of 08:52, 20 August 2011 by Dre -+- (talk | contribs)
Jump to navigation Jump to search

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