{"hash":"0x49C1F6DC","ns":"CFX","name":"REGISTER_RAW_KEYMAP","slug":"REGISTER_RAW_KEYMAP","official":true,"named":true,"luaName":"RegisterRawKeymap","game":"cfx","apiset":"client","returnType":"void","params":[{"name":"keymapName","type":"char*","description":"A **unique** name that the keymap will be bound to, duplicates will result in the keymap not being registered."},{"name":"onKeyDown","type":"func","description":"The function to run when the key is being pressed, or `nil`."},{"name":"onKeyUp","type":"func","description":"The function to run when the key is no longer being pressed, or `nil`."},{"name":"rawKeyIndex","type":"int","description":"The virtual key to bind this keymap to, see a list [here](https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes)"},{"name":"canBeDisabled","type":"BOOL","description":"If calls to [DISABLE_RAW_KEY_THIS_FRAME](#\\_0x8BCF0014) will disable this keymap, if a keymap was disabled when the key was pressed down it will still call `onKeyUp` on release."}],"summary":"Registers a keymap that will be triggered whenever rawKeyIndex is pressed or released.","descriptions":[{"source":"cfx","format":"md","body":"Registers a keymap that will be triggered whenever `rawKeyIndex` is pressed or released.\n\n`onKeyUp` and `onKeyDown` will not provide any arguments.\n\n```ts\nfunction onStateChange();\n```"}],"examples":[{"lang":"lua","code":"function on_key_up()\n\tprint(\"key no longer pressed\")\nend\n\nfunction on_key_down()\n\tprint(\"key is pressed\")\nend\n\nlocal KEY_E = 69\nlocal canBeDisabled = false\n\n\nRegisterRawKeymap(\"our_keymap\", on_key_up, on_key_down, KEY_E, canBeDisabled)","source":"cfx"}],"aliases":[],"enums":[],"related":["0x6E38C1B9"],"sources":["cfx"],"doc":3,"url":"https://natives.borderlinerp.com/natives/CFX/REGISTER_RAW_KEYMAP","markdownUrl":"https://natives.borderlinerp.com/natives/CFX/REGISTER_RAW_KEYMAP.md","snippets":{"lua":"RegisterRawKeymap(keymapName, onKeyDown, onKeyUp, rawKeyIndex, canBeDisabled)","luaInvoke":"Citizen.InvokeNative(0x49c1f6dc, keymapName, onKeyDown, onKeyUp, rawKeyIndex, canBeDisabled)","js":"RegisterRawKeymap(keymapName, onKeyDown, onKeyUp, rawKeyIndex, canBeDisabled);","jsInvoke":"Citizen.invokeNative('0x49c1f6dc', keymapName, onKeyDown, onKeyUp, rawKeyIndex, canBeDisabled);","csharp":"Function.Call((Hash)0x49c1f6dc, keymapName, onKeyDown, onKeyUp, rawKeyIndex, canBeDisabled);","notes":[]}}