🧠Installation

BP INVENTORY Installation Document and Basic Concepts

Depencedies

In order for the script to run properly on your server, you must download the scripts below and install them on your server.

Place your scripts

The order on server.cfg should be like this.

start bp_inventory
start bp_market

Database Setup

Check if there is a bp_inventory table already established in your database.

If it exists, delete it.

And now, enter this SQL code into your mysql database and set up the table.


CREATE TABLE IF NOT EXISTS `bp_inventory` (
  `id` varchar(100) NOT NULL DEFAULT '',
  `type` varchar(50) DEFAULT NULL,
  `slot` int(200) DEFAULT NULL,
  `weight` int(11) DEFAULT NULL,
  `data` longtext DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


CREATE TABLE IF NOT EXISTS `bp_inventory_others` (
  `id` varchar(100) NOT NULL DEFAULT '',
  `type` varchar(50) DEFAULT NULL,
  `slot` int(200) DEFAULT NULL,
  `weight` int(11) DEFAULT NULL,
  `data` longtext DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


Installation With Video

ESX Installation

Go to es_extended >server > classes > player.lua and replace the specified functions with the given code if any. Otherwise add them as new.


function self.getInventoryItem(name, metadata)
   return exports["bp_inventory"]:GetItemByName(self.source, name)
end

function self.addInventoryItem(name, count, metadata, slot)
   return exports["bp_inventory"]:AddItem(self.source, name, count, slot)
end

function self.removeInventoryItem(name, count, metadata, slot)
   return exports["bp_inventory"]:RemoveItem(self.source, name, count, slot)
end

function self.hasItem(item, metadata)
   return exports["bp_inventory"]:hasItem(self.source, name)
end

📺 VIDEO FOR ESX

QBCORE Installation

Locate "qb-core > server > player.lua" Find "QBCore.Player.CreatePlayer" Find "self.Functions = {}" and add this functions (!!YOU NEED TO ADD BOTTOM OF self.Functions IF YOU DONT YOU GET ERRORS!!)


 function self.Functions.AddItem(item, amount, slot, info)
    exports["bp_inventory"]:AddItem(self.PlayerData.source, item, amount, info)
end

function self.Functions.RemoveItem(item, amount, id) 
    return exports["bp_inventory"]:RemoveItem(self.PlayerData.source, item, amount, slot)
end

function self.Functions.GetItemByName(item)
    item = tostring(item):lower()  
    return exports["bp_inventory"]:GetItemByName(self.PlayerData.source, item)
end

function self.Functions.GetItemsByName(item)
    item = tostring(item):lower()
    local items = {}
    for k ,v in pairs (  exports["bp_inventory"]:GetItemByName(self.PlayerData.source, item) ) do
        if v._tpl == item then
            items[#items+1] = v
        end
    end
     return items
end

📺 VIDEO FOR QBCORE

---- coming soon

Last updated