Client

Every client export, with examples.

All exports below are client side. Slots and pages start at 1. On the weapons wheel, slot 1 is the fixed Unarmed slot when Config.Wheel.unarmed is enabled.

Wheel#

OpenWheel#

Opens the wheel, like the key.

Lua
exports.cube_itemswheel:OpenWheel(category)
  • category?: 'weapons' / 'items' - default: the last one used

CloseWheel#

Closes the wheel without using a slot.

Lua
exports.cube_itemswheel:CloseWheel()

IsWheelOpen#

Lua
local open = exports.cube_itemswheel:IsWheelOpen()
  • returns: boolean

SetDisabled#

Blocks the wheel and the editor for the local player, and closes them.

Lua
exports.cube_itemswheel:SetDisabled(state)
  • state: boolean
Lua
-- No wheel during a heist cutscene
exports.cube_itemswheel:SetDisabled(true)
-- ...
exports.cube_itemswheel:SetDisabled(false)

IsDisabled#

true when disabled by SetDisabled on the client or on the server.

Lua
local disabled = exports.cube_itemswheel:IsDisabled()

UseSlot#

Uses a slot without opening the wheel, for a hotkey for example.

Lua
local used = exports.cube_itemswheel:UseSlot(category, page, slot)
  • category: 'weapons' / 'items'
  • page: number
  • slot: number
  • returns: boolean
Lua
-- Number keys 1 to 4 use the first four slots of the items wheel
for i = 1, 4 do
    RegisterCommand(('wheelslot%s'):format(i), function()
        exports.cube_itemswheel:UseSlot('items', 1, i)
    end, false)

    RegisterKeyMapping(('wheelslot%s'):format(i), ('Use slot %s'):format(i), 'keyboard', tostring(i))
end

Refresh#

Reads the inventory again, removes the missing items and updates the open wheel.

Lua
exports.cube_itemswheel:Refresh()

Editor#

OpenEditor#

Lua
exports.cube_itemswheel:OpenEditor()

CloseEditor#

Closes the editor without saving.

Lua
exports.cube_itemswheel:CloseEditor()

IsEditorOpen#

Lua
local open = exports.cube_itemswheel:IsEditorOpen()

Layout#

GetLayout#

The wheel of the current character.

Lua
local layout = exports.cube_itemswheel:GetLayout()
  • returns: table
    • weapons: string[][] - item name per page and slot, '' is an empty slot
    • items: string[][]
Lua
local layout = exports.cube_itemswheel:GetLayout()
print(layout.items[1][3]) -- third slot of the first page

GetSlot#

Lua
local item = exports.cube_itemswheel:GetSlot(category, page, slot)
  • returns: string or nil - item name

SetSlot#

Places an item on a slot. The item is removed from its previous slot on the same wheel. page can be the next page, to create it.

Lua
local success = exports.cube_itemswheel:SetSlot(category, page, slot, item)
  • category: 'weapons' / 'items'
  • page: number
  • slot: number
  • item: string
  • returns: boolean - false for a blacklisted item, a locked slot or an item

    that does not match the wheel

Lua
-- Give a starter wheel to a new character
exports.cube_itemswheel:SetSlot('items', 1, 1, 'bandage')
exports.cube_itemswheel:SetSlot('items', 1, 2, 'water')

ClearSlot#

Lua
local success = exports.cube_itemswheel:ClearSlot(category, page, slot)

RemoveItem#

Removes an item from every slot of both wheels.

Lua
local removed = exports.cube_itemswheel:RemoveItem(item)
  • returns: number - slots cleared

Look#

GetSettings#

Lua
local settings = exports.cube_itemswheel:GetSettings()
  • returns: table
    • accent, accentText, background, text: string - #RRGGBB
    • opacity, size, inner: number
    • radius, gap: number - px
    • amounts, animations: boolean

SetSettings#

Changes some values, the missing ones are kept. Out of range values are clamped.

Lua
local success = exports.cube_itemswheel:SetSettings({ accent = '#E5484D', size = 1.2 })
  • returns: boolean - false when Config.Customization.enabled is false

ResetSettings#

Back to Config.Customization.defaults.

Lua
exports.cube_itemswheel:ResetSettings()