# Register Key Mapping

#### Translate

* [Click here to translate this page.](https://docs-codesign-pro.translate.goog/information/register-key-mapping?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=en-GB&_x_tr_pto=nui)
* [How do I change language?](https://gyazo.com/38606313ac9a7c290dc2c72b6793bde6)

{% hint style="danger" %}
**If you want to change the default key bind for all players, you MUST change it in the `configs/config.lua`** ***BEFORE*****&#x20;starting the resource on your main server.**
{% endhint %}

### Info

We have started using the FiveM native called `RegisterKeyMapping` [FiveM Documentation](http://runtime.fivem.net/doc/natives/?_0xD7664FD1). This removes the need for while loops checking every frame for keypresses, therefore allowing the resource to be more optimised. This FiveM native works by triggering the chat command it has been registered with when the keybind is pressed. This new method also allows each client to change their own key binds in-game. [Example](https://i.imgur.com/GRWKelR.jpeg) `Open Gta5 settings > Key Bindings > FiveM`.

### How to Unbind Keys

Once you have started the resource on your server for the first time, even if you change the key in the config.lua, it will not change for the players who have already joined. Although it will change for the players who join after you have changed it.

**Option 1:**

* To unbind keys **for your client only** you can type `unbind keyboard`[`input_parameter`](https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/) in F8.

**Option 2:**

* Go to C:\Users\[USERNAME]\AppData\Roaming\CitizenFX
* Open fivem.cfg
* Remove the lines with this resource name.
* Restart Fivem. Keybinds will be set back to default values set in the config.

### How to Disable KeyMapping

* Firstly unbind the keys using the method above, disable the key in the config.lua and then you can rewrite the code to use the regular method of while loops checking for key presses `IsControlJustReleased` or other methods to trigger the events we provide to you in our docs.

### Notes

* There is no way to mass unbind keys for all of your server's players.
* The full list of available keys can be found [here](https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.codesign.pro/helpful-guides/register-key-mapping.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
