# RegisterHotkey

Hotkeys are buttons events triggered on key release. They must be registered using `registerHotkey()` at root level, outside of any event, in the `init.lua` file.

{% hint style="warning" %}
[Hotkeys](https://wiki.redmodding.org/cyber-engine-tweaks/cet-functions/hotkeys/registerhotkey) are not triggered while the player stay pressed on a game's keybind.

For example, if the player move forward with "W" and press a Hotkey at the same time, it won't be triggered.

For this reason, it is recommended to use [Inputs](https://wiki.redmodding.org/cyber-engine-tweaks/cet-functions/hotkeys/registerinput) instead, as they are always triggered.
{% endhint %}

## Definition

```lua
registerHotkey(slug, label, callback)
```

```lua
--
-- registerHotkey()
--
-- @param  string    slug      The internal slug (must be unique in your mod scope)
-- @param  string    label     The label displayed in CET Bindings
-- @param  function  callback  The callback function
--
registerHotkey('slug', 'label', function()
    
    -- hotkey is released
    
end)
```

## Usage Example

#### Give money with a hotkey:

{% code title="init.lua" %}

```lua
registerHotkey('give_money', 'Give Money', function()
    
    Game.AddToInventory('Items.money', 1000)
    
end)
```

{% endcode %}
