# Weed Planting

{% embed url="<https://www.youtube.com/watch?v=ZKBrST_V4A4>" %}

{% hint style="success" %}
This script is compatible with **ESX and QB.**
{% endhint %}

{% hint style="warning" %}
This script requires [**ox\_lib**](https://github.com/overextended/ox_lib).
{% endhint %}

{% hint style="info" %}
This script requires the [**ox\_inventory**](https://github.com/overextended/ox_inventory) or [**qb\_inventory**](https://github.com/qbcore-framework/qb-inventory).
{% endhint %}

{% hint style="info" %}
This script requires the [**ox\_target**](https://overextended.dev/ox_target) or [**qb-target**](https://github.com/qbcore-framework/qb-target)
{% endhint %}

### Script

{% embed url="<https://forum.cfx.re/t/advanced-weed-planting/5269638>" %}

### Installation

{% tabs %}
{% tab title="ESX" %}

1. Download from [keymaster](https://keymaster.fivem.net/login?return_url=/asset-grants) and **unzip** the `Weed Planting`. Move `nv_weedplanting` in your server's resource folder.
2. Add the resource to your server start config: `ensure nv_weedplanting`, the name of the folder must not be changed or the resource will not function correctly. **Ensure the script is the latest one.**

{% code title="server.cfg" %}

```tsconfig
# ...
# All the other resources
ensure nv_weedplanting
```

{% endcode %}

1. Open the **config.lua** and configure it correctly, paying attention to all the variables!
2. Set `config.framework` to `"ESX"`
3. Restart server or type `ensure nv_weedplanting` in **console.**
   {% endtab %}

{% tab title="QBCore" %}

1. Download from [keymaster](https://keymaster.fivem.net/login?return_url=/asset-grants) and **unzip** the `Weed Planting`. Move `nv_weedplanting` in your server's resource folder.
2. Add the resource to your server start config: `ensure nv_weedplanting`, the name of the folder must not be changed or the resource will not function correctly. **Ensure the script is the latest one.**

{% code title="server.cfg" %}

```tsconfig
# ...
# All the other resources
ensure nv_weedplanting
```

{% endcode %}

1. Open the **config.lua** and configure it correctly, paying attention to all the variables!
2. Set `config.framework` to `"QB"`
3. Restart server or type `ensure nv_weedplanting` in **console.**
   {% endtab %}
   {% endtabs %}

### Inventory Items

{% tabs %}
{% tab title="OX Inventory" %}

1. Open the `inventory-data` folder and the `ox-items.lua` file, then copy the items from that file.
2. Navigate to your `ox_inventory` script, open the `data` folder, and then open the `items.lua` file.
3. Add your ox items to that file (example):

```lua
-- ... default ox items
['clothing'] = {label = 'Clothing',consume = 0,},
['mastercard'] = {label = 'Fleeca Card',stack = false,weight = 10,client = {image = 'card_bank.png'}},

-- your items
['weed-seedling'] = {label = 'Weed Seedling',weight = 5000,client = {event = 'nv_weedplanting:client:createWeedPot',image = 'weed-seedling.png',}},
['weed-bud'] = {label = 'Weed Bud',weight = 1,client = {image = 'weed-bud.png'}},
-- ...
```

4. Go to the `ox_inventory/web/images` folder and paste the images from `inventory-data`.
   {% endtab %}

{% tab title="QB Inventory" %}

1. Open the `inventory-data` folder and the `qb-items.lua` file, then copy the items from that file.
2. Navigate to your `qb-core` script, open the shared folder, and then open the `items.lua` file.
3. Add your qb items to that file (example):

```lua
-- ... default ox items
newsmic  = { name = 'newsmic', label = 'News Microphone', weight = 100, type = 'item', image = 'newsmic.png', unique = true, useable = true, shouldClose = true, description = 'A microphone for the news' },

-- your items
['weed-seedling'] = { name = 'weed-seedling', label = 'Weed Seedling', weight = 5000, type = 'item', image = 'weed-seedling.png', unique = false, useable = true, shouldClose = false, description = 'A seedling for growing weed' },
['weed-bud'] = { name = 'weed-bud', label = 'Weed Bud', weight = 1, type = 'item', image = 'weed-bud.png', unique = false, useable = true, shouldClose = false, description = 'The bud from a weed plant' },
-- ...
```

4. Go to the qb`-inventory/html/images` folder and paste the images from `inventory-data`.
   {% endtab %}
   {% endtabs %}

### Code

{% tabs %}
{% tab title="config.lua" %}

```lua
config = {}

--=========== Framework ===========--
-- ESX - ESX Framework
-- QB - QBCore Frameowk
config.framework = "ESX"
--=================================--

--=========== Inventory ===========--
-- OX - OX Inventory
-- QB - QB Inventory
config.inventory = "OX"
--=================================--

--=========== Targets ===========--
config.ox_target = true -- If you want to turn on, set this to -> true
config.qb_target = false -- If you want to turn on, set this to -> true
--===============================--

--=========== Notification ===========--
config.notifyName = "Jhon Smith"
config.notifyDesc = "Weed-Shop Owner"
config.notifyIcon = "CHAR_ARTHUR"
config.webhook = "" -- Discord Webhook
--====================================--

--=========== Shop ===========--
config.shop = {
  {name="Weed Seedling",price=10,inventory="weed-seedling",image="weed-seedling.png",desc=""},
  {name="Pest Spray",price=30,inventory="pest-spray",image="pest-spray.png",desc=""},
  {name="Weed Food",price=40,inventory="weed-food",image="weed-food.png",desc=""},
  {name="Weed Bud",price=50,inventory="weed-bud",image="weed-bud.png",desc="1 gram"},
  {name="Rolling Paper",price=60,inventory="rolling-paper",image="rolling-paper.png",desc=""},
  {name="Joint",price=70,inventory="joint",image="joint.png",desc=""},
}

config.blips = {
  {loc=vec3(-1172.0760, -1572.0536, 4.6637),name="Weed Shop",icon=140,color=2}
}

config.LANGUAGE = {
  -- Info bar
  infoWater = "Water",
  infoHunger = "Hunger",
  infoAge = "Age",
  infoHealth = "Health",
  infoPest = "Pest",
  
  -- Progress bar --
  makeJoint = "Making joint...",
  waterPlant = "Watering...",
  foodPplant = "Feeding...",
  sprayPlant = "Spraying...",
  destroyPlant = "Destroying..."
}
--====================================--

--=========== Timeout ===========--
config.harvestWait = 20000 -- 20 seconds = 20000ms
config.sprayWait = 10000 -- 10 seconds = 10000ms
config.feedWait = 8000 -- 8 seconds = 8000ms
config.waterWait = 8000 -- 8 seconds = 8000ms
config.makeJoint = 5000
config.destroyWait = 5000
--===============================--

--=========== Joint Settings ===========--
config.jointDuration = 30000 -- 30 seconds = 30000ms
config.jointEffect = "DRUG_2_drive" -- you can change the effect if you want, the effect list is on this website: https://wiki.rage.mp/index.php?title=Timecycle_Modifiers
config.jointHP = 20 -- +20 HP when using a joint
--======================================--

--=========== Target Settings ===========--
-- You can find icons on "https://fontawesome.com/" but you can use only FREE icons!
-- distance does not work for qbtarget
config.target_status =			{name="Status",					color="white",				icon="fa-circle-info",				distance=1.2}
config.target_carry =			{name="Carry",					color="orange",				icon="fa-hands-holding",			distance=1.2}
config.target_pour =			{name="Water",					color="lime",				icon="fa-water",				distance=1.2}
config.target_feed =			{name="Feed",					color="lime",				icon="fa-wheat-awn",				distance=1.2}
config.target_pestSpray =		{name="Pest spray",				color="lime",				icon="fa-bug",					distance=1.2}
config.target_destroy =			{name="Destroy",				color="red",				icon="fa-bug",					distance=1.2}
config.target_harvest =			{name="Harvest",				color="red",				icon="fa-scissors",				distance=1.2}
config.target_openShop =		{name="Open Weed Shop",			        color="lime",				icon="fa-cart-shopping",			distance=2.5}
--=======================================--

--=========== Other ===========--
-- 3 hours / (how many minutes it takes for weed to grow, during this time if the plant is in good health, the player can harvest the plant; if not, the plant will die) / recommended 180 minutes / 3 hours
config.weedGrowTime = 180 -- minutes

-- 2 hour (how many hours the plant waits to be deleted after full grown) / recommended 2 hours
config.weedDeadAfterTime = 120 -- minutes

-- 1 hour = 60
-- 2 hour = 120
-- 3 hour = 180
-- 4 hour = 240
-- 5 hour = 300
-- 6 hour = 360
-- 7 hour = 420
-- 8 hour = 480
-- 9 hour = 540
-- 10 hour = 600
config.weedDeadAfterTime = 24 -- hours (how many hours the plant waits to be deleted after full grown) / recommended 24 hours

```

{% endtab %}
{% endtabs %}

### Support

{% hint style="info" %}
If you have any problems or need help, contact us on [Discord!](https://discord.gg/NeveraDev/tw28AqrgWU)
{% endhint %}


---

# 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://neveradev.gitbook.io/docs/paid/weed-planting.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.
