> For the complete documentation index, see [llms.txt](https://docs.repscripts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.repscripts.com/paid-scripts/rep-weed/installation/inventory/ox_inventory.md).

# ox\_inventory

## Add Items:

{% hint style="warning" %}
Although weedbaggie can still stack, but when you sell you must seperate them. Because our script also supports qb-inventory, and that inventory sux...
{% endhint %}

1. Copy the image files from the `img` folder to your `inventory` folder.
2. Add the following codes to your `ox-inventory > data >items.lua` file under the Items section:

{% tabs %}
{% tab title="ox-inventory\data\items.lua" %}

```lua
 ['femaleseed'] = {
        label = 'Female Marijuana Seed',
        weight = 500,
        consume = 0,
        client = {
            image = "weed-seed.png",
        },
        server = {
            export = 'rep-weed.femaleseed',
        },
        close = true,
        description = 'Surely I can just plant this, right?'
    },
    ['maleseed'] = {
        label = 'Male Marijuana Seed',
        weight = 500,
        client = {
            image = "weed-seed.png",
        },
        description = 'Add this to a planted female seed to make it pregnant? You are pretty sure this seed has a penis.'
    },
    ['wateringcan'] = {
        label = 'Watering Can',
        weight = 2500,
        consume = 0,
        server = {
            export = 'rep-weed.wateringcan',
        },
        close = true,
        description = 'Fill this at a river or lake.'
    },
    ['fertilizer'] = {
        label = 'Fertilizer',
        weight = 500,
        description = 'Cool'
    },
    ['wetbud'] = {
        label = 'Wet Bud (100 grams)',
        weight = 7500,
        client = {
            image = "wet.png",
        },
        description = 'THIS CANT BE DRIED WITHOUT STRAIN... Needs to be stored somewhere dry.'
    },
    ['driedbud'] = {
        label = 'Dried Bud (100 Grams)',
        weight = 2500,
        consume = 0,
        server = {
            export = 'rep-weed.driedbud',
        },
        close = true,
        description = 'Pack It?'
    },
    ['weedpackage'] = {
        label = 'Suspicious Package',
        weight = 5000,
        consume = 0,
        server = {
            export = 'rep-weed.weedpackage',
        },
        close = true,
        description = 'Marked for Police Seizure'
    },
    ['qualityscales'] = {
        label = 'Quality Scales',
        weight = 500,
        consume = 0,
        description = 'Weighs Baggies with no loss'
    },
    ['smallscales'] = {
        label = 'Small Scales',
        weight = 250,
        description = 'Weighs Baggies with minimal loss'
    },
    ['joint'] = {
        label = '2g Joint',
        weight = 200,
        consume = 0,
        server = {
            export = 'rep-weed.joint',
        },
         close = true,
        description = 'Its a Joint, man.'
    },
    ['emptybaggies'] = {
        label = 'Empty Baggies',
        weight = 100,
        description = 'Empty Baggies'
    },
    ['weedbaggie'] = {
        label = 'Baggie (7g)',
        weight = 300,
        consume = 0,
        server = {
            export = 'rep-weed.weedbaggie',
        },
         close = true,
        description = 'Sold on the streets'
    },
    ['rollingpaper'] = {
        label = 'Rolling Paper',
        weight = 100,
        description = 'Required to roll joints!'
    },
```

{% endtab %}
{% endtabs %}

## Dry:

### Step 1:

#### Go to ox\_inventory/client.lua

1. Look for the following code block:

```lua
action = 'setupInventory',
```

2. Add the following code directly above that SendNuiMessage function

<pre class="language-lua"><code class="lang-lua"><strong>TriggerServerEvent('rep-weed:server:checkDry', left, currentInventory)
</strong></code></pre>

### Step 2:

#### Go to \modules\inventory\server.lua

1. Look for the following code:

<pre class="language-lua"><code class="lang-lua"><strong>function Inventory.Save(inv)
</strong></code></pre>

2. Add the following code directly AFTER that whole function:

```lua
RegisterNetEvent('rep-weed:server:updateDry', function (id, slot, item)
    inv = Inventory(id)
    inv.weight -= Inventory(id).items[slot].weight
    Inventory(id).items[slot] = item
    inv.weight += Inventory(id).items[slot].weight
    inv:syncSlotsWithClients({
        {
            item = item,
            inventory = inv.id
        }
    }, true)
    if inv.player and server.syncInventory then
        server.syncInventory(inv)
    end
end)
```

### Step 3:

#### Go to \modules\inventory\server.lua

1. Look for the following code:

```
 fromInventory.items[data.fromSlot] = fromData
 toInventory.items[data.toSlot] = toData
```

2. Replace it with code:

```lua
if fromData then
    if fromData.name == 'wetbud' then
        if fromInventory.type == 'stash' then
            if fromInventory.type == 'stash' then
                if not fromData.metadata then
                    fromData.metadata = {}
                    fromData.metadata.time = os.time()
                    fromData.metadata.dry = 10
                else
                    if not fromData.metadata.time then fromData.metadata.time = os.time() end
                    if not fromData.metadata.dry then fromData.metadata.dry = 10 end
                end
            end
        end
    end
end
fromInventory.items[data.fromSlot] = fromData
if toData then
    if toData.name == 'wetbud' then
        if toInventory.type == 'stash' then
            print('stash')
            if not toData.metadata then
                toData.metadata = {}
                toData.metadata.time = os.time()
                toData.metadata.dry = 10
            else
                if not toData.metadata.time then toData.metadata.time = os.time() end
                if not toData.metadata.dry then toData.metadata.dry = 10 end
            end
        end
    end
end
toInventory.items[data.toSlot] = toData
```

3. If you want weed to also dry in trunk, player or glove trunk, repeat the same process.

## Give Item with metadata:

### Step 1:

#### Go to /server.lua

1. Look for the following code:

```lua
lib.addCommand({'additem', 'giveitem'}, {
	help = 'Gives an item to a player with the given id',
	params = {
		{ name = 'target', type = 'playerId', help = 'The player to receive the item' },
		{ name = 'item', type = 'string', help = 'The name of the item' },
		{ name = 'count', type = 'number', help = 'The amount of the item to give', optional = true },
		{ name = 'type', help = 'Sets the "type" metadata to the value', optional = true },
	},
	restricted = 'group.admin',
}, function(source, args)
	local item = Items(args.item)
	if item then
		local inventory = Inventory(args.target) --[[@as OxInventory]]
		local count = args.count or 1
		local success, response = Inventory.AddItem(inventory, item.name, count, args.type and { type = tonumber(args.type) or args.type })

		if not success then
			return Citizen.Trace(('Failed to give %sx %s to player %s (%s)'):format(count, item.name, args.target, response))
		end
		source = Inventory(source) or { label = 'console', owner = 'console' }
		if server.loglevel > 0 then
			lib.logger(source.owner, 'admin', ('"%s" gave %sx %s to "%s"'):format(source.label, count, item.name, inventory.label))
		end
	end
end)
```

2. Replace the whole function with this code.

```lua
lib.addCommand({'additem', 'giveitem'}, {
    help = 'Gives an item to a player with the given id',
    params = {
        { name = 'target', type = 'playerId', help = 'The player to receive the item' },
        { name = 'item', type = 'string', help = 'The name of the item' },
        { name = 'count', type = 'number', help = 'The amount of the item to give', optional = true },
        { name = 'type', help = 'Sets the "type" metadata to the value', optional = true },
    },
    restricted = 'group.admin',
}, function(source, args)
    local item = Items(args.item)

    if item then
        local inventory = Inventory(args.target) --[[@as OxInventory]]
        local count = args.count or 1
        local metadata = args.type and { type = tonumber(args.type) or args.type}
        if args.item == "femaleseed" then
            if not metadata then
                metadata = {}
            end
            metadata.strain = "Unknown"
            metadata.n = 0
            metadata.p = 0
            metadata.k = 0
        elseif args.item == "driedbud" then
            if not metadata then
                metadata = {}
            end
            metadata.strain = "Unknown"
            metadata.n = 0
            metadata.p = 0
            metadata.k = 0
            metadata.remainweight = 100
        elseif args.item == "weedpackage" then
            if not metadata then
                    metadata = {}
            end
            metadata.strain = "Unknown"
            metadata.n = 0
            metadata.p = 0
            metadata.k = 0
            metadata.remainweight = 100
        elseif args.item == "weedbaggie" then
            if not metadata then
                    metadata = {}
            end
            metadata.strain = "Unknown"
            metadata.n = 0
            metadata.p = 0
            metadata.k = 0
        elseif args.item == "wetbud" then
            if not metadata then
                    metadata = {}
            end
            metadata.strain = "Unknown"
            metadata.n = 0
            metadata.p = 0
            metadata.k = 0
            metadata.dry = 0
        elseif args.item == "joint" then
            if not metadata then
                    metadata = {}
            end
            metadata.strain = "Unknown"
            metadata.n = 0
            metadata.p = 0
            metadata.k = 0
        elseif args.item == "wateringcan" then
            if not metadata then
                metadata = {}
            end
            metadata.water = 0
        end
        local success, response = Inventory.AddItem(inventory, item.name, count, metadata)

        if not success then
            return Citizen.Trace(('Failed to give %sx %s to player %s (%s)'):format(count, item.name, args.target, response))
        end

        source = Inventory(source) or { label = 'console', owner = 'console' }

        if server.loglevel > 0 then
            lib.logger(source.owner, 'admin', ('"%s" gave %sx %s to "%s"'):format(source.label, count, item.name, inventory.label))
        end
    end
end)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.repscripts.com/paid-scripts/rep-weed/installation/inventory/ox_inventory.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.
