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.
exports.cube_itemswheel:OpenWheel(category)- category?:
'weapons'/'items'- default: the last one used
CloseWheel#
Closes the wheel without using a slot.
exports.cube_itemswheel:CloseWheel()IsWheelOpen#
local open = exports.cube_itemswheel:IsWheelOpen()- returns:
boolean
SetDisabled#
Blocks the wheel and the editor for the local player, and closes them.
exports.cube_itemswheel:SetDisabled(state)- state:
boolean
-- 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.
local disabled = exports.cube_itemswheel:IsDisabled()UseSlot#
Uses a slot without opening the wheel, for a hotkey for example.
local used = exports.cube_itemswheel:UseSlot(category, page, slot)- category:
'weapons'/'items' - page:
number - slot:
number - returns:
boolean
-- 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))
endRefresh#
Reads the inventory again, removes the missing items and updates the open wheel.
exports.cube_itemswheel:Refresh()Editor#
OpenEditor#
exports.cube_itemswheel:OpenEditor()CloseEditor#
Closes the editor without saving.
exports.cube_itemswheel:CloseEditor()IsEditorOpen#
local open = exports.cube_itemswheel:IsEditorOpen()Layout#
GetLayout#
The wheel of the current character.
local layout = exports.cube_itemswheel:GetLayout()- returns:
tableweapons:string[][]- item name per page and slot,''is an empty slotitems:string[][]
local layout = exports.cube_itemswheel:GetLayout()
print(layout.items[1][3]) -- third slot of the first pageGetSlot#
local item = exports.cube_itemswheel:GetSlot(category, page, slot)- returns:
stringornil- 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.
local success = exports.cube_itemswheel:SetSlot(category, page, slot, item)- category:
'weapons'/'items' - page:
number - slot:
number - item:
string - returns:
boolean-falsefor a blacklisted item, a locked slot or an itemthat does not match the wheel
-- 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#
local success = exports.cube_itemswheel:ClearSlot(category, page, slot)RemoveItem#
Removes an item from every slot of both wheels.
local removed = exports.cube_itemswheel:RemoveItem(item)- returns:
number- slots cleared
Look#
GetSettings#
local settings = exports.cube_itemswheel:GetSettings()- returns:
tableaccent,accentText,background,text:string-#RRGGBBopacity,size,inner:numberradius,gap:number- pxamounts,animations:boolean
SetSettings#
Changes some values, the missing ones are kept. Out of range values are clamped.
local success = exports.cube_itemswheel:SetSettings({ accent = '#E5484D', size = 1.2 })- returns:
boolean-falsewhenConfig.Customization.enabledisfalse
ResetSettings#
Back to Config.Customization.defaults.
exports.cube_itemswheel:ResetSettings()