> For the complete documentation index, see [llms.txt](https://bcs-scripts.gitbook.io/bcs-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bcs-scripts.gitbook.io/bcs-scripts/resources/editor.md).

# bcs-drugs

bcs-drugs is a fivem resource that simulates a **custom drug system** for FiveM RP servers.

## Installation

{% stepper %}
{% step %}

### Install the resource dependencies

* [ox\_lib](https://overextended.dev/ox_lib)
* [ox\_target](https://overextended.dev/ox_target)
* [ox\_inventory](https://overextended.dev/ox_inventory)
  {% endstep %}

{% step %}

### Download the resource&#x20;

Once you have purchased the resource from the[ Tebex store](https://bcs-scripts-shop.tebex.io/), you can download it to your [FiveM Keymaster](https://portal.cfx.re/assets/granted-assets). Then drag and drop in your resources folder.
{% endstep %}

{% step %}

### Start the resource

You must include this line of code in your **server configuration** file (usually `server.cgf`).

```
ensure bcs-drugs
```

{% hint style="warning" %}
It is very important that it is placed **below ox\_lib, ox\_target and ox\_inventory**.
{% endhint %}
{% endstep %}

{% step %}

### Config the script

Configure the script to your liking. Below you can check the [configuration file](/bcs-scripts/resources/editor.md#config-file) and [common issues](/bcs-scripts/resources/editor.md#common-issues).
{% endstep %}
{% endstepper %}

## Config file

The explanation of each config is in the file below.

{% code title="config.lua" overflow="wrap" fullWidth="false" %}

```lua
return {
    zones = {
        ['weed'] = {
            harvestProp = 'prop_weed_01', -- https://forge.plebmasters.de/objects
            processProp = 'bkr_prop_weed_table_01a', -- https://forge.plebmasters.de/objects
            harvestItem = 'weed_baggy', -- item that is collected
            procesedItem = 'weed_brick', -- item obtained by processing the collected item
            coords = { -- Coordinates of the harvest and processing area
                harvest = vec3(2199.7622, 5577.1543, 53.9401),
                process = vec4(2197.0095, 5609.4434, 53.5461, 347.8116)
            },
            itemsToProcess = 3, -- Harvested items needed to process 1 time
            harvestItemAmmount = 1, -- Amount of items received when harvesting
            procesedItemAmmount = 1, -- Amount of items received when processing
            harvestingDelay = 5, -- Time it takes to harvest in seconds
            processingDelay = 10, -- Time it takes to process in seconds
            harvestRadius = 15, -- Harvest radius
            processRadius = 2, -- Process radius
            loadDistance = 40, -- Distance in meters to load the harvest area
            density = 20, -- Number of plants within the harvest zone
            plantDelay = 10, -- Time it takes for a new plant to appear after harvesting in seconds
            harvestAnim = { -- https://forge.plebmasters.de/animations (copying the name will give you something like this -> dict : clip)
                dict = 'amb@world_human_gardener_plant@male@base',
                clip = 'base'
            },
            processAnim = { -- https://forge.plebmasters.de/animations (copying the name will give you something like this -> dict : clip)
                dict = 'mini@repair',
                clip = 'fixing_a_ped'
            }
        },
        ['meth'] = {
            harvestProp = 'prop_plant_01a',
            processProp = 'tr_prop_meth_table01a',
            harvestItem = 'meth',
            procesedItem = 'meth_tray',
            coords = {
                harvest = vec3(2307.7412, 2590.7747, 46.6573),
                process = vec4(2330.6406, 2573.0898, 46.6805, 150.4853)
            },
            itemsToProcess = 9,
            harvestItemAmmount = 3,
            procesedItemAmmount = 2,
            harvestingDelay = 5,
            processingDelay = 5,
            harvestRadius = 15,
            processRadius = 2,
            loadDistance = 40,
            density = 10,
            plantDelay = 5,
            harvestAnim = {
                dict = 'amb@world_human_gardener_plant@male@base',
                clip = 'base'
            },
            processAnim = {
                dict = 'mini@repair',
                clip = 'fixing_a_ped'
            }
        },

        -- Add more drugs here
    },

    locale = { -- translations
        ['drug_processing'] = 'Processing drugs...',
        ['recolect_plant'] = 'Collect plant',
        ['cutting_plant'] = 'Cutting the plant...',
        ['no_necessary_items'] = 'You do not have the necessary items...',
        ['finished_processing'] = 'You have finished processing',
        ['process'] = 'Process'
    },
    
    debugZones = false -- True to see the size of the zones In-Game (including the load-distance)
}
```

{% endcode %}

{% code title="config\_framework.lua" overflow="wrap" %}

```lua
return {
    playerLoadedEvent = 'QBCore:Client:OnPlayerLoaded', -- 'QBCore:Client:OnPlayerLoaded' for QBCore, 'esx:playerLoaded' for ESX, 'ox:playerLoaded' for ox_core
    inventory = 'ox_inventory' -- 'ox_inventory' or 'qb-inventory'
}
```

{% endcode %}

## Common issues

If the resource does not work correctly, check the following aspects. It is usually due to a wrong configuration:

{% stepper %}
{% step %}

### Existing items

Make sure that all items (**harvestItem** and **processedItem**) exist within the **ox\_inventory** item list ([ox\_inventory\data\items.lua](https://github.com/overextended/ox_inventory/blob/main/data/items.lua)).

{% code title="config.lua" overflow="wrap" fullWidth="false" %}

```lua
harvestItem = 'item_name', -- item that is collected
procesedItem = 'item_name', -- item obtained by processing the collected item
```

{% endcode %}

To create the items you can visit [ox\_inventory docs](https://overextended.dev/ox_inventory/Guides/creatingItems).
{% endstep %}

{% step %}

### Existing props

Make sure the set props that exists within your server.

{% code title="config.lua" %}

```lua
harvestProp = 'prop_name', -- https://forge.plebmasters.de/objects
processProp = 'prop_name', -- https://forge.plebmasters.de/objects
```

{% endcode %}

You can visit [plebmasters](https://forge.plebmasters.de/objects) to check valid items.
{% endstep %}
{% endstepper %}

***

{% hint style="info" %}
If this page doesn't help you, please join our [discord](https://discord.gg/yMV5A9RBcw) for support.
{% endhint %}


---

# 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, and the optional `goal` query parameter:

```
GET https://bcs-scripts.gitbook.io/bcs-scripts/resources/editor.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
