# INSTALLATION

## 1. **DOWNLOAD**

The first step is to download the product we have just purchased. To do this we will go to our [KEYMASTER](https://keymaster.fivem.net/asset-grants) account and search for "BCall\_SellToNPC".

<figure><img src="/files/8G2SziERffGBu5u5Jt7D" alt=""><figcaption></figcaption></figure>

## **2. DATABASE**

<img src="/files/JG6kc2u6bxfWjocckUPe" alt="" data-size="original"> You must insert in your database the SQL, in order to save the experience of each player.

## 3. CONFIG

The following will explain all the settings, one of the most important things that I recommend you spend a few minutes to understand in order to offer your users the best possible experience.

{% hint style="info" %}
The following file is located at: Buty-SellDrugs\configs\config.lua
{% endhint %}

```lua
Configuration = {
    [1] = {
        framework = 'esx',                    -- framework "esx", "oldesx" or "qbcore"

        ESXtrigger = 'es_extended',

        QBtrigger = 'qb-core'
    },

    [2] = {
        Mysql = 'oxmysql'  -- oxmysql, mysql-async or ghmattisql
    }, 

    [3] = {
        alertpolice = true, 

        MinPoliceToSell = 0,

        WithCommand = false, 

        SellCommand = "selldrugs", 

        CancelSellCommand = 'cancelselldrugs'
    },
    
    [4] = {
        UseTarget = false, 

        TargetExport = 'bt-target',

        Text = 'SELL DRUGS', 

        Icon = 'fa fa-shopping-cart'
    },

    [5] = {
        DrawText = true, 
        
        custompolicealert = false
    },

    [6] = {
        BattlePass = false,
        EXP = 10
    }
}

Policejob = { -- Here all the police jobs you use, such as FBI, Sheriffs etc.
    "police", 
    --"police", 
    --"police",
}

BlacklistPed = {
	"u_m_m_jewelsec_01",
}

ByZone = {
    
    SellByZone = false,                     -- You will activate the sale by zone, you can add as many zones as you want.
    
    {
        x = 192.8, y = -2274.44, z = 32.72, -- Coords
        SizeZone = 50.0,                    -- Size
    },

    {
        x = -1201.24, y = -1568.88, z = 4.6, 
        SizeZone = 50.0,                    
    },
}

Street = {
    {[1] = {name = "Bay City Avenue", moneyextra = 300}},
    {[1] = {name = "Palomino Avenue", moneyextra = 400}},
}
```

## 4. ADD/CONFIGURE NEW DRUGS

Now I will show you how to add new drugs and explain each configuration.

{% hint style="info" %}
The following file is located at: Buty-SellDrugs\configs\drugs.lua
{% endhint %}

### &#x20;EXPLANATION OF DRUG CONFIGURATION

```lua
Drugs = {
    {
        [1] = {
        ItemLabel = "COCAINE", -- Item label 
        ItemName = "cocaine", -- Item name
        ItemImg = "./img/cocaine_cut.png" }, -- Item Image (You must add the image to the Buty-SellDrugs\html\img folder.)
        
        [2] = {
        Pricerandom = false, -- Do you want the price to be random?
        PriceRandomMin = 100, -- Random amount MIN on the number you add
        PriceRandomMax = 400, -- Random amount MAX on the number you add
        PriceDrug = 1001, -- Price per drug
        exp = 5,  -- Experience per drug
        TypeAccount = "black_money", -- Type of account where payment is made
        MaxSellDrug = 50 -- Maximum amount of drugs that can be sold to each npc.
        },

        [3] = {
        SellForItem = false, -- Is your money an item?
        SellForItemName = "money" -- Name Item
        }, 

        [4] = {
        Steal = true, -- Do you want the npc to be able to steal from you?
        StealProbability = 50, -- Probability of being robbed (The lower the number, the more likely you are to be robbed).
        PoliceMin = 1, -- Minimal police for this drug to be shown in the UI
        Probabilitycallpolice = 20,  -- Probability of calling the police (The lower the number, the more likely they are to call).
        TimeDecision = 5000, -- Time it will take the NPC to decide
        BuyProbability = 40 -- Probability that the NPC will buy you (The lower the number, the more likely it is that he/she will not buy you).
        },  

        [5] = {
        IncreasePerLVL = 200, -- Increase money per LVL
        IncreasePerPolice = 10, -- Increase money per LVL
        IncreasePerLVLEXP = 10, -- Increase experience per LVL
        IncreasePerPoliceEXP = 5 -- Increase experience per LVL
        },
    },
}
```

### CREATE A NEW DRUG

To create a new drug we will only have to copy one of the ones we have already created and paste it below in the following way:

```lua
Drugs = {
    {
        [1] = {ItemLabel = "COCAINE", ItemName = "water", ItemImg = "./img/cocaine_cut.png" },
        
        [2] = {Pricerandom = false, PriceRandomMin = 100, PriceRandomMax = 400, PriceDrug = 1001, exp = 5, TypeAccount = "black_money", MaxSellDrug = 50},

        [3] = {SellForItem = false, SellForItemName = "money"}, 

        [4] = {Steal = true, StealProbability = 50, PoliceMin = 0, Probabilitycallpolice = 20, TimeDecision = 5000, BuyProbability = 40},  

        [5] = {IncreasePerLVL = 200, IncreasePerPolice = 10, IncreasePerLVLEXP = 10, IncreasePerPoliceEXP = 5},
    },

    {
        [1] = {ItemLabel = "WEED", ItemName = "bread", ItemImg = "./img/weed.png"},

        [2] = {Pricerandom = false, PriceRandomMin = 100, PriceRandomMax = 400, PriceDrug = 1001, exp = 5, TypeAccount = "black_money", MaxSellDrug = 210},

        [3] = {SellForItem = false, SellForItemName = "money"}, 

        [4] = {Steal = true, StealProbability = 50, PoliceMin = 0, Probabilitycallpolice = 20, TimeDecision = 5000, BuyProbability = 40},  

        [5] = {IncreasePerLVL = 200, IncreasePerPolice = 10, IncreasePerLVLEXP = 10, IncreasePerPoliceEXP = 5},
    },
}
```

{% hint style="warning" %}
**CHECK THAT ALL THE ITEMS YOU PUT IN THE DRUGS.LUA EXIST ON YOUR SERVER. OTHERWISE, THE WHOLE SCRIPT WILL FAIL.**
{% endhint %}

### CHANGE NOTIFICATIONS

If you use a different notification system, you can configure it in the following folder: Buty-SellDrugs\configs\function.lua

<div align="left"><figure><img src="/files/2mxYGEVijf3LYsZCXBT3" alt=""><figcaption></figcaption></figure></div>


---

# 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://buty-documentation.gitbook.io/home/guides/advanced-sell-drugs/installation.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.
