Modules
AddKeybind
Client

Client

Registers keybinds and simplifies interactions of the keybinds.

CKeybind Class

A table representing a keybind with the following properties.

  • name: string
  • description: string
  • currentKey: string
    • Key that the current user has this keybind set to
  • disabled: boolean
    • Whether or not the keybind is currently disabled
  • hash: number
    • Internal hash of the keybind that is used to reference it within the game itself
  • defaultKey?: string
    • Default key to set the keybind to for new players
    • NOTE: Changing this will not change the key for existing players
  • defaultMapper?: string
  • secondaryKey?: string
    • An optional secondary keybind.
  • secondaryMapper?: string
    • An optional mapper for the secondary key, otherwise using the default mapper.
  • disable: function(self: CKeybind, disable: boolean)
    • Built-in function to enable / disable a keybind
  • onPressed?: function(self: CKeybind)
    • User-defined function triggered on keybind press
  • onReleased?: function(self: CKeybind)
    • User-defined function triggered on keybind release

lib.addKeybind

lib.addKeybind(data)
  • data: table
    • name: string
    • description: string
    • defaultKey?: string
      • Default: None
    • defaultMapper?: string
      • Default: keyboard
    • secondaryKey?: string
    • secondaryMapper?: string
    • disabled?: boolean
      • Whether or not the keybind should be disabled by default
    • onPressed?: function(self: CKeybind)
      • Function triggered on keybind press
    • onReleased?: function(self: CKeybind)
      • Function triggered on keybind release
local keybind = lib.addKeybind({
    name = 'respects',
    description = 'press F to pay respects',
    defaultKey = 'F',
    onPressed = function(self)
        print(('pressed %s (%s)'):format(self.currentKey, self.name))
    end,
    onReleased = function(self)
        print(('released %s (%s)'):format(self.currentKey, self.name))
    end
})

Enable / Disable Keybinds

Keybinds can be enabled / disabled by using the disable method.

keybind:disable(true) -- disables the keybind
keybind:disable(false) -- enables the keybind