Inventory

This page serves as a guide to help you integrate your inventory with this resource.

For experienced DEVELOPERS only!

Config File

Start by setting the inventory to NONE and make sure you don't have any of the supported inventories present on your server: (config.lua)

Config.Inventory = Inventories.NONE

Inventory Files

  • Our prison resource is using inventory in those scenarios: checking player inventory items, items manipulation.

  • The files which you need to integrate are located in rcore_prison/modules/bridge/server/inventory/sv-standalone.lua.

  • You can get a good idea on what to do from the other inventory files.

-- Check if player has specific item in his inventory
-- @param {number} client - The player's server identifier
-- @param {string} name - The name of the item
-- @param {number} amount - The amount of them item which player should have
-- @returns {boolean} item - If player has specific item or not
Inventory.hasItem = function(client, itemName, amount)
    return false
end


-- Add item to player's inventory
-- @param {number} client - The player's server identifier
-- @param {string} name - The name of the item
-- @param {number} amount - The amount of the item which player will receive
-- @param {metadata} amount - Metadata for this item
-- @returns {boolean} - The state of the action
Inventory.addItem = function(client, itemName, amount, metadata)
    return false
end

-- Remove item from player's inventory
-- @param {number} client - The player's server identifier
-- @param {string} name - The name of the item
-- @param {number} amount - The amount of the item which player will receive
-- @param {metadata} amount - Metadata for this item
-- @returns {boolean} - The state of the action
Inventory.removeItem = function(client, itemName, amount, metadata)
    return false
end

-- Register specific item to be useable
-- @param {string} name - Name of item
-- @param {number} client - The player's server identifier
-- @param {string} item - The item data
-- @param {callback} cb - Action that will be done with callback
-- @returns {callback} - The data passed into callback
Inventory.registerUsableItem = function(name, client, item, cb)
    cb(client, name, item)
end

-- Clear player items in his inventory
-- @param {number} client - The player's server identifier
-- @returns {boolean} - The state of the action
Inventory.clearInventory = function(client)
    return false
end

Last updated