# Setup and Items

This page covers the minimum setup required to get the script running correctly: dependencies, `server.cfg` start order, required assets, database tables, and item installation.

## Required Dependencies

* [oxmysql](https://github.com/overextended/oxmysql/releases)
* [ox\_lib](https://github.com/overextended/ox_lib/releases)
* `0r_lib`
* `0r_farming_assets`
* `0r_plant_assets`
* `0r_plantsnew`

## Recommended server.cfg Start Order

Use a clean start order so the script loads after its dependencies:

```lua
start oxmysql
start ox_lib
start framework -- es_extended, qb-core, qbx_core, etc.
-- other resources
start 0r_lib
start 0r_farming_assets
start 0r_plant_assets
start 0r_plantsnew
start 0r-farming-v2
```

{% hint style="info" %}
`database.sql` is executed automatically. You do not need to import it manually.
{% endhint %}

## Database

The script includes these tables:

```sql
CREATE TABLE
    IF NOT EXISTS `0resmon_farming_profiles` (
        id INT AUTO_INCREMENT PRIMARY KEY,
        identifier VARCHAR(255) NOT NULL UNIQUE,
        exp INT DEFAULT 0,
        created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
        updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
    );

CREATE TABLE
    IF NOT EXISTS `0resmon_farming_player_personal_challenges` (
        id INT AUTO_INCREMENT PRIMARY KEY,
        identifier VARCHAR(50) NOT NULL,
        challenge_id VARCHAR(50) NOT NULL,
        current_level INT DEFAULT 1,
        progress INT DEFAULT 0,
        created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
        updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
        UNIQUE KEY unique_challenge (identifier, challenge_id)
    );
```

## Where Do I Add The Items?

* If you use OX Inventory, add the items to `ox_inventory/data/items.lua`.
* If you use QB Core, add the items to `qb-core/shared/items.lua`.
* Copy the item images into the image folder used by your inventory.
* If your image path is different, update `Config.InventoryImagesFolder` in `0r-farming-v2/config.lua`.

{% hint style="warning" %}
Make sure `farming_tablet` exists if you use item-based menu access.
{% endhint %}

## OX Inventory

{% tabs fullWidth="false" %}
{% tab title="items.lua" %}

```lua
-- start 0r-farming-v2 items
["watering_can"]    = { label = 'Watering Can', weight = 0.1, stack = true, },
["wheat_seed"]      = { label = 'Wheat Seed', weight = 0.1, stack = true, },
["wheat"]           = { label = 'Wheat', weight = 0.1, stack = true, },
["rose_seed"]       = { label = 'Rose Seed', weight = 0.1, stack = true, },
["rose"]            = { label = 'Rose', weight = 0.1, stack = true, },
["green_seed"]      = { label = 'Green Seed', weight = 0.1, stack = true, },
["green"]           = { label = 'Green', weight = 0.1, stack = true, },
["daisy_seed"]      = { label = 'Daisy Seed', weight = 0.1, stack = true, },
["daisy"]           = { label = 'Daisy', weight = 0.1, stack = true, },
["poppy_seed"]      = { label = 'Poppy Seed', weight = 0.1, stack = true, },
["poppy"]           = { label = 'Poppy', weight = 0.1, stack = true, },
["melon_seed"]      = { label = 'Melon Seed', weight = 0.1, stack = true, },
["melon"]           = { label = 'Melon', weight = 0.1, stack = true, },
["watermelon_seed"] = { label = 'Watermelon Seed', weight = 0.1, stack = true, },
["watermelon"]      = { label = 'Watermelon', weight = 0.1, stack = true, },
["pumpkin_seed"]    = { label = 'Pumpkin Seed', weight = 0.1, stack = true, },
["pumpkin"]         = { label = 'Pumpkin', weight = 0.1, stack = true, },
["farming_tablet"]  = { label = 'Farming Tablet', weight = 0.1, stack = false, },
["milk_bottle"]     = { label = 'Milk Bottle', weight = 0.1, stack = true, },
-- end 0r-farming-v2 items
```

{% endtab %}
{% endtabs %}

## QB Core

{% tabs fullWidth="false" %}
{% tab title="shared/items.lua" %}

```lua
watering_can    = { name = 'watering_can', label = 'Watering Can', weight = 0, type = 'item', image = 'watering_can.png', unique = false, useable = true, shouldClose = true, description = 'A can used to water plants.' },
wheat_seed      = { name = 'wheat_seed', label = 'Wheat Seed', weight = 100, type = 'item', image = 'wheat_seed.png', unique = false, useable = false, shouldClose = false, description = 'Seed for growing wheat.' },
wheat           = { name = 'wheat', label = 'Wheat', weight = 100, type = 'item', image = 'wheat.png', unique = false, useable = false, shouldClose = false, description = 'Harvested wheat.' },
rose_seed       = { name = 'rose_seed', label = 'Rose Seed', weight = 100, type = 'item', image = 'rose_seed.png', unique = false, useable = false, shouldClose = false, description = 'Seed for growing roses.' },
rose            = { name = 'rose', label = 'Rose', weight = 100, type = 'item', image = 'rose.png', unique = false, useable = false, shouldClose = false, description = 'A beautiful rose.' },
green_seed      = { name = 'green_seed', label = 'Green Seed', weight = 100, type = 'item', image = 'green_seed.png', unique = false, useable = false, shouldClose = false, description = 'Seed for growing greens.' },
green           = { name = 'green', label = 'Green', weight = 100, type = 'item', image = 'green.png', unique = false, useable = false, shouldClose = false, description = 'Harvested green plant.' },
daisy_seed      = { name = 'daisy_seed', label = 'Daisy Seed', weight = 100, type = 'item', image = 'daisy_seed.png', unique = false, useable = false, shouldClose = false, description = 'Seed for growing daisies.' },
daisy           = { name = 'daisy', label = 'Daisy', weight = 100, type = 'item', image = 'daisy.png', unique = false, useable = false, shouldClose = false, description = 'A fresh daisy.' },
poppy_seed      = { name = 'poppy_seed', label = 'Poppy Seed', weight = 100, type = 'item', image = 'poppy_seed.png', unique = false, useable = false, shouldClose = false, description = 'Seed for growing poppies.' },
poppy           = { name = 'poppy', label = 'Poppy', weight = 100, type = 'item', image = 'poppy.png', unique = false, useable = false, shouldClose = false, description = 'A red poppy flower.' },
melon_seed      = { name = 'melon_seed', label = 'Melon Seed', weight = 100, type = 'item', image = 'melon_seed.png', unique = false, useable = false, shouldClose = false, description = 'Seed for growing melons.' },
melon           = { name = 'melon', label = 'Melon', weight = 100, type = 'item', image = 'melon.png', unique = false, useable = false, shouldClose = false, description = 'A ripe melon.' },
watermelon_seed = { name = 'watermelon_seed', label = 'Watermelon Seed', weight = 100, type = 'item', image = 'watermelon_seed.png', unique = false, useable = false, shouldClose = false, description = 'Seed for growing watermelons.' },
watermelon      = { name = 'watermelon', label = 'Watermelon', weight = 100, type = 'item', image = 'watermelon.png', unique = false, useable = false, shouldClose = false, description = 'A juicy watermelon.' },
pumpkin_seed    = { name = 'pumpkin_seed', label = 'Pumpkin Seed', weight = 100, type = 'item', image = 'pumpkin_seed.png', unique = false, useable = false, shouldClose = false, description = 'Seed for growing pumpkins.' },
pumpkin         = { name = 'pumpkin', label = 'Pumpkin', weight = 100, type = 'item', image = 'pumpkin.png', unique = false, useable = false, shouldClose = false, description = 'A large pumpkin.' },
farming_tablet  = { name = 'farming_tablet', label = 'Farming Tablet', weight = 100, type = 'item', unique = false, useable = true, shouldClose = false },
milk_bottle     = { name = 'milk_bottle', label = 'Milk Bottle', weight = 100, type = 'item', image = 'milk_bottle.png', unique = false, useable = false, shouldClose = false, description = 'A bottle of fresh milk.' },
```

{% endtab %}
{% endtabs %}

## Final Checklist

After setup, verify these points:

* `0r_lib` starts without errors
* `0r_farming_assets`, `0r_plant_assets`, and `0r_plantsnew` start without errors
* `0r-farming-v2` starts without errors
* Required items exist in game
* The farming menu opens correctly
