Server
Every server export, with examples.
All exports below are server side. They act on one player, given by their server id.
Note
The wheel of a player is saved in their client KVP, so the server only forwards the changes to the client. GetLayout asks the client and waits for the answer.
Wheel#
OpenWheel#
Lua
exports.cube_itemswheel:OpenWheel(source, category)- source:
number - category?:
'weapons'/'items'
CloseWheel#
Lua
exports.cube_itemswheel:CloseWheel(source)SetDisabled#
Blocks the wheel and the editor of a player, and closes them. Stored in the itemsWheelDisabled state bag of the player, so it also blocks the wheel on the client side.
Lua
exports.cube_itemswheel:SetDisabled(source, state)- state:
boolean
Lua
-- No weapon wheel in jail
AddEventHandler('myjail:jailed', function(source)
exports.cube_itemswheel:SetDisabled(source, true)
end)
AddEventHandler('myjail:released', function(source)
exports.cube_itemswheel:SetDisabled(source, false)
end)IsDisabled#
Lua
local disabled = exports.cube_itemswheel:IsDisabled(source)- returns:
boolean
Editor#
OpenEditor#
Lua
exports.cube_itemswheel:OpenEditor(source)CloseEditor#
Lua
exports.cube_itemswheel:CloseEditor(source)Layout#
GetLayout#
Lua
local layout = exports.cube_itemswheel:GetLayout(source)- returns:
tableornilif the player did not answer within 5 secondsweapons:string[][]items:string[][]
SetSlot#
Lua
local sent = exports.cube_itemswheel:SetSlot(source, category, page, slot, item)- category:
'weapons'/'items' - page:
number - slot:
number - item:
string - returns:
boolean-falseif the arguments are invalid
ClearSlot#
Lua
exports.cube_itemswheel:ClearSlot(source, category, page, slot)RemoveItem#
Removes an item from every slot of the player.
Lua
exports.cube_itemswheel:RemoveItem(source, item)Lua
-- Confiscated weapons disappear from the wheel right away
for _, weapon in ipairs(confiscated) do
exports.cube_itemswheel:RemoveItem(source, weapon)
endNotifications#
Notify#
Shows a notification with Config.Notification.
Lua
exports.cube_itemswheel:Notify(source, message, type, duration)- message:
string - type?:
'success'/'error'/'info'/'warning' - duration?:
number- ms