Standalone item system for registering usable items on the server.
Use the following to register a usable item on the server.
--- Specify item id
local item_id = 'water'
--- Utils object
utils.items.register('water', function(source)
if source and source ~= 0 then
print('Used water!')
end)
--- Direct export
exports.boii_utils:register('water', function(source)
if source and source ~= 0 then
print('Used water!')
end)
Use the following to use an item.
--- Specify item id
local item_id = 'water'
--- Utils object
utils.items.use(source, item_id)
--- Direct export
exports.boii_utils:use_item(source, item_id)
Use the following event to use an item from the client side.
Make sure any items used this way your events are secured.
--- Specify item id
local item_id = 'water'
--- Trigger server event from client
TriggerServerEvent('boii_utils:sv:use_item', item_id)