# Installation

## Depencedies

{% hint style="danger" %}
In order for the script to run properly on your server, you must download the scripts below and install them on your server.
{% endhint %}

## Place your scripts

The order on server.cfg should be like this.

```
start bp_inventory
start bp_market
```

## Database Setup

{% hint style="info" %}
Check if there is a bp\_inventory table already established in your database.

If it exists, delete it.
{% endhint %}

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

```sql

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&#x20;**<mark style="color:blue;">**es\_extended >server > classes > player.lua**</mark>**&#x20;and replace the specified functions with the given code if any. Otherwise add them as new.**

```lua

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


```

#### [📺](https://emojipedia.org/television) VIDEO FOR ESX

{% embed url="<https://youtu.be/cXtTPzSvFNQ>" %}

### QBCORE Installation

**Locate&#x20;**<mark style="color:blue;">**"qb-core > server > player.lua"**</mark>**&#x20;Find&#x20;**<mark style="color:orange;">**"QBCore.Player.CreatePlayer"**</mark>**&#x20;Find "self.Functions = {}" and add this functions (!!YOU NEED TO ADD BOTTOM OF self.Functions IF YOU DONT YOU GET ERRORS!!)**

```lua

 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


```

#### [📺](https://emojipedia.org/television) VIDEO FOR QBCORE

#### ---- coming soon


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0resmon.org/0resmon/0resmon-1/bp-resources/bp-inventory/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
