{"hash":"0xD7664FD1","ns":"CFX","name":"REGISTER_KEY_MAPPING","slug":"REGISTER_KEY_MAPPING","official":true,"named":true,"luaName":"RegisterKeyMapping","game":"cfx","apiset":"client","returnType":"void","params":[{"name":"commandString","type":"char*","description":"The command to execute, and the identifier of the binding."},{"name":"description","type":"char*","description":"A description for in the settings menu."},{"name":"defaultMapper","type":"char*","description":"The [mapper ID](https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/) to use for the default binding, e.g. `keyboard`."},{"name":"defaultParameter","type":"char*","description":"The [IO parameter ID](https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/) to use for the default binding, e.g. `f3`."}],"summary":"Registers a key mapping for the current resource.","descriptions":[{"source":"cfx","format":"md","body":"Registers a key mapping for the current resource.\n\nSee the related [cookbook post](https://cookbook.fivem.net/2020/01/06/using-the-new-console-key-bindings/) for more information.\n\nBelow you can find some examples on how to create these keybindings as well as the alternate keybinding syntax, which is preceded by `~!` to indicate that it's an alternate key."}],"examples":[{"lang":"lua","code":"local handsUp = false\nCreateThread(function()\n    while true do\n        Wait(0)\n        if handsUp then\n            TaskHandsUp(PlayerPedId(), 250, PlayerPedId(), -1, true)\n        end\n    end\nend)\nRegisterCommand('+handsup', function()\n    handsUp = true\nend, false)\nRegisterCommand('-handsup', function()\n    handsUp = false\nend, false)\n\nRegisterKeyMapping('+handsup', 'Hands Up', 'keyboard', 'i')\n\n-- Alternate keybinding syntax\nRegisterKeyMapping('~!+handsup', 'Hands Up - Alternate Key', 'keyboard', 'o')","source":"cfx"}],"aliases":[],"enums":[],"related":[],"sources":["cfx"],"doc":3,"url":"https://natives.borderlinerp.com/natives/CFX/REGISTER_KEY_MAPPING","markdownUrl":"https://natives.borderlinerp.com/natives/CFX/REGISTER_KEY_MAPPING.md","snippets":{"lua":"RegisterKeyMapping(commandString, description, defaultMapper, defaultParameter)","luaInvoke":"Citizen.InvokeNative(0xd7664fd1, commandString, description, defaultMapper, defaultParameter)","js":"RegisterKeyMapping(commandString, description, defaultMapper, defaultParameter);","jsInvoke":"Citizen.invokeNative('0xd7664fd1', commandString, description, defaultMapper, defaultParameter);","csharp":"Function.Call((Hash)0xd7664fd1, commandString, description, defaultMapper, defaultParameter);","notes":[]}}