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.

Hotkeys 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 instead, as they are always triggered.


registerHotkey(slug, label, callback)
-- 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

Usage Example

Give money with a hotkey:

registerHotkey('give_money', 'Give Money', function()
    Game.AddToInventory('', 1000)

Last updated