---
description: Inventory Installation
---

# qb-inventory

### Go to your `lj/qb-inventory > html > js > app.js (EARLIER VERSION BELOW THIS BLOCK)`

1. Search for the following code block:

{% code title="lj/qb-inventory > html > js > app.js" %}
```js
case "harness":
```
{% endcode %}

2. Add the following code block directly underneath the code block in Step 1:

{% code title="lj/qb-inventory > html > js > app.js" fullWidth="true" %}
```js
case "joint":
case "weedbaggie":
case "femaleseed":
	return `<p><strong>Strain: </strong>${itemData.info.strain}.</p>`
case "weedpackage":
case "driedbud":
	return `<p><strong>Strain: </strong>${itemData.info.strain}</span></p><p><strong>Remaining Weights: </strong><span>${itemData.info.remainweight} grams.</p>`
case "wetbud":
	return `<p><strong>Strain: </strong><span>${itemData.info.strain}</span></p><p><strong>Dry: </strong><span>${itemData.info.dry}%.</p>`
case "wateringcan":
	return `<p><strong>Water: </strong>${itemData.info.water}%.</p>`
```
{% endcode %}

{% hint style="warning" %}
**OR IF YOU HAVE THE EARLIER VERSION OF Ps/Lj/Qb-inventory, follow this instead for this specific step**
{% endhint %}

### Go to your `lj/qb-inventory > html > js > app.js`

1. Search for the following code block:

{% code title="lj/qb-inventory > html > js > app.js" %}
```js
} else if (itemData.name == "harness") {
```
{% endcode %}

2. Add the following code block directly underneath the code block in Step 1:

{% code title="lj/qb-inventory > html > js > app.js" %}
```js
        }else if (itemData.name == "joint") {
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html(
                "<p><strong>Strain: </strong>" + itemData.info.strain + ".</p>"
            );
        }else if (itemData.name == "weedbaggie") {
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html(
                "<p><strong>Strain: </strong>" + itemData.info.strain + ".</p>"
            );
        }else if (itemData.name == "femaleseed") {
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html(
                "<p><strong>Strain: </strong>" + itemData.info.strain +".</p>"
            );
        }else if (itemData.name == "weedpackage") {
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html(
                "<p><strong>Strain: </strong>" + itemData.info.strain +
   "</span></p><p><strong>Remain Weights: </strong><span>" +
          itemData.info.remainweight +" grams.</p>"
            );
        }else if (itemData.name == "driedbud") {
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html(
                "<p><strong>Strain: </strong>" + itemData.info.strain +
   "</span></p><p><strong>Remain Weights: </strong><span>" +
          itemData.info.remainweight +" grams.</p>"
            );
        }else if (itemData.name == "wetbud") {
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html(
                "<p><strong>Strain: </strong><span>" +
                itemData.info.strain +
                "</span></p><p><strong>Dry: </strong><span>" +
                itemData.info.dry +"%.</p>"
            );
        }else if (itemData.name == "wateringcan") {
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html(
                "<p><strong>Water: </strong>" + itemData.info.water + "%.</p>"
            );}
```
{% endcode %}

<figure><img src="https://1360800565-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtOtPiYSp5UBrvwODMVI%2Fuploads%2FJOh8LgxE5BC7TMtutmHt%2Fresources-1680274914422.gif?alt=media&#x26;token=945d2391-c269-4074-9961-13fc0870eebf" alt=""><figcaption><p>lj/qb-inventory > html > js > app.js (outdated but should give you the idea)</p></figcaption></figure>

***

### Go to your lj/qb-inventory > server > main.lua

1.  Search for the following code:

    {% code title="server > main.lua" %}
    ```lua
    RegisterNetEvent('inventory:server:SaveInventory', function(type, id)
    ```
    {% endcode %}
2.  Add the following code after the whole function:

    {% code title="server > main.lua" %}
    ```lua
    RegisterNetEvent('rep-weed:server:saveDry',function (type,id)
    	if type == "trunk" then
    		if IsVehicleOwned(id) then
    			if Trunks[id.label] == "Trunk-None" or not Trunks[id].items then return end
    				for _, item in pairs(Trunks[id].items) do
    					item.description = nil
    				end
    				MySQL.insert('INSERT INTO trunkitems (plate, items) VALUES (:plate, :items) ON DUPLICATE KEY UPDATE items = :items', {
    					['plate'] = id,
    					['items'] = json.encode(Trunks[id].items)
    				})
    			end
    	 elseif type == "glovebox" then
    		 if (IsVehicleOwned(id)) then
    			if Gloveboxes[id].label == "Glovebox-None" or not Gloveboxes[id].items then return end
    			for _, item in pairs(Gloveboxes[id].items) do
    				item.description = nil
    			end
    			MySQL.insert('INSERT INTO gloveboxitems (plate, items) VALUES (:plate, :items) ON DUPLICATE KEY UPDATE items = :items', {
    				['plate'] = id,
    				['items'] = json.encode(Gloveboxes[id].items)
    			})
    		end
    	elseif type == "stash" then
    		if Stashes[id].label == "Stash-None" or not Stashes[id].items then return end
    		for _, item in pairs(Stashes[id].items) do
    			item.description = nil
    		end
    		MySQL.insert('INSERT INTO stashitems (stash, items) VALUES (:stash, :items) ON DUPLICATE KEY UPDATE items = :items', {
    			['stash'] = id,
    			['items'] = json.encode(Stashes[id].items)
    		})
    	end
    end)

    RegisterNetEvent('rep-weed:server:updateDry',function (type,id, slot, item)
        if type == 'stash' then
            Stashes[id].items[slot] = item
        elseif type == 'trunk' then
            Trunks[id].items[slot] = item
        elseif type == "glovebox" then
            Gloveboxes[id].items[slot] = item
        end
    end)
    ```
    {% endcode %}

<figure><img src="https://1360800565-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtOtPiYSp5UBrvwODMVI%2Fuploads%2FuPQZcutzAg9MJJ0PQHDb%2Fresources-1680275067654.gif?alt=media&#x26;token=aa643556-ce2c-46e8-933e-7185a30e5d93" alt=""><figcaption><p>lj/qb-inventory > server > main.lua</p></figcaption></figure>

1.  Search for the following code:

    <pre class="language-lua"><code class="lang-lua"><strong>RegisterNetEvent('inventory:server:OpenInventory', function(name, id, other)
    </strong></code></pre>
2.  Right before

    <pre class="language-lua"><code class="lang-lua"><strong>TriggerClientEvent("inventory:client:OpenInventory", src, {}, Player.PlayerData.items, secondInv)
    </strong></code></pre>
3.  Add:&#x20;

    ```lua
    TriggerEvent('rep-weed:server:checkDry',src, Player.PlayerData.items, secondInv)
    ```

***

1.  Search for the following code:

    ```lua
    TriggerClientEvent("inventory:client:OpenInventory", src, {}, Player.PlayerData.items)
    ```
2.  Add this BEFORE that line:

    ```lua
    TriggerEvent('rep-weed:server:checkDry',src, Player.PlayerData.items)
    ```

<figure><img src="https://1360800565-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtOtPiYSp5UBrvwODMVI%2Fuploads%2FVCWqBgm6V62JOyvQTONj%2Fresources-1680275306846.gif?alt=media&#x26;token=656adb71-a5d3-459e-bffe-7ff1e6777432" alt=""><figcaption><p>Adding checkDry (2 times)</p></figcaption></figure>

1. Search for the following code:

```lua
local function AddToStash(stashId, slot, otherslot, itemName, amount, info, created)
```

2. Right before:

```lua
local ItemData = QBCore.Shared.Items[itemName]
```

3. Add:

```lua
	if itemName == "wetbud" then
		if not info then
			info = {}
			info.time = os.time()
			info.dry = 0
		else
			if not info.time then info.time = os.time() end
			if not info.dry then info.dry = 0 end
		end
	end
```

4. (OPTIONAL) If you want weed to also dry in trunk, player or glove trunk, repeat the same process

