Client
OpenInventory
---@param inv string The inventory to open
---@param data table The data to pass to the inventory
---@return void
exports["bt-inventory"]:OpenInventory(type, data)
Below are the example inventories you can open with this function
exports["bt-inventory"]:OpenInventory("stash", {
id = "hidden23442",
maxWeight = 100000,
slots = 50
})
CloseInventory
exports["bt-inventory"]:CloseInventory()
UseItem
---Uses a item in the player inventory
---@param item table|string|number The item to use. table is the whole item structure, string is the item name and number is the slot
---@return table The response from the server. { success = boolean, message = string }
exports["bt-inventory"]:UseItem(item)
exports["bt-inventory"]:UseItem("water_bottle")
UseSlot
exports["bt-inventory"]:UseSlot(slot)
UseSlot might be removed later as you can use a slot if you pass a number to UseItem
GetItemsByName
--- Returns an array of items by name
---@param itemName string The name of the item to get
---@param metaData table The metadata to search for
---@return table, integer
exports["bt-inventory"]:GetItemsByName(itemName, metaData)
For example if a water_bottle item has a metaData of {"specialBottle": "yes"}. You can search it using this function using:
local items, itemCount = exports["bt-inventory"]:GetItemsByName("water_bottle", {
specialBottle = "yes"
})
GetCurrentWeapon
--- Returns item table for the currentWeapon
--- @return table
exports["bt-inventory"]:GetCurrentWeapon()
Follows the same data structure as a regular item. The ammo is stored in metaData.ammo
GetBodySlot
--- Returns the body slot
---@param slot integer The slot to get (1-10)
---@return table
exports["bt-inventory"]:GetBodySlot(slot)
SetBodyPartPercentage
--- Sets the body part color
---@param bodyPart string (body, head, leftArm, rightArm, leftLeg, rightLeg)
---@param level integer The level of color (0-100). Higher is more red.
exports["bt-inventory"]:SetBodyColor(bodyPart, level)
You can use to set the color for the body parts. It will go more red the higher the level. No bleeding is 0 and max bleeding level is 100. Current body part names: leftArm, rightArm, rightLeg, leftLeg, head and body.
SetBodyPartInfo
--- Sets the body part info
---@param bodyPart string (body, head, leftArm, rightArm, leftLeg, rightLeg)
---@param value table The value to set
exports["bt-inventory"]:SetBodyPartInfo(bodyPart, bodyPartValues)
The info is dynamic (only for the normal style, for the special style you can only use the values below). So you can attach any type of info you want to a body part. Example:
SetBodyPartInfo("body", {
["bleeding"] = true,
["bullets"] = 3,
["broken"] = false,
["severity"] = false,
})
Last updated