RedM Index logoRedM Index
NativesHashesClothesBlipsPropsItem Tool
Sign inGet started

Reference

  • Natives
  • Hashes
  • Clothes
  • Blips
  • Props

Namespace

  1. Reference
  2. Natives
  3. REGISTER_RAW_KEYMAP

REGISTER_RAW_KEYMAP

Registers a keymap that will be triggered whenever `rawKeyIndex` is pressed or released. `onKeyUp` and `onKeyDown` will not provide any arguments. ```ts function onStateChange(); ```

CFX

Signature

lua
RegisterRawKeymap(keymapName, onKeyDown, onKeyUp, 0, true)
-- returns void

Parameters

NameTypeDescription
char*A **unique** name that the keymap will be bound to, duplicates will result in the keymap not being registered.
funcThe function to run when the key is being pressed, or `nil`.
funcThe function to run when the key is no longer being pressed, or `nil`.
intThe virtual key to bind this keymap to, see a list [here](https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes)
BOOLIf 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.

Usage

Named call
RegisterRawKeymap(keymapName, onKeyDown, onKeyUp, 0, true)
InvokeNative
Citizen.InvokeNative(0x49C1F6DC, keymapName, onKeyDown, onKeyUp, 0, true)
lua 1
function on_key_up()
	print("key no longer pressed")
end

function on_key_down()
	print("key is pressed")
end

local KEY_E = 69
local canBeDisabled = false


RegisterRawKeymap("our_keymap", on_key_up, on_key_down, KEY_E, canBeDisabled)

Details

Hash
API set
Source
cfx

Source: cfx

On this page

  • Signature
  • Parameters
  • Usage
  • Details