> For the complete documentation index, see [llms.txt](https://docs.adminplus.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adminplus.dev/free-scripts/sell-drugs.md).

# Sell Drugs

{% hint style="info" %}
This script allows you to do /dealer & sell drugs to locals with a random chance of it calling the cops.
{% endhint %}

<figure><img src="/files/DFHJUGMsoanVW7HQYe8v" alt=""><figcaption></figcaption></figure>

* <mark style="color:orange;">Configurable city point locations.</mark>
* <mark style="color:orange;">Configurable locales to change the language.</mark>
* <mark style="color:orange;">Configurable items & prices.</mark>
* <mark style="color:orange;">Configurable required cops.</mark>
* <mark style="color:orange;">Configurable option for NPCs to fight if they reject your drug.</mark>
* <mark style="color:orange;">Configurable ped list.</mark>
* <mark style="color:orange;">Configurable account option 'bank' or 'money'.</mark>

```
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
```

<figure><img src="/files/LhinZZRSRrF3cHV4BUcL" alt=""><figcaption></figcaption></figure>

* This resource is drag/drop. You will just need to add the following inside of your server.cfg after you've dropped the file into your resources.

> <mark style="color:orange;">ensure adminplus-selldrugs</mark>

{% hint style="warning" %}
Feel free to check the config.lua & customise to what you'd like.
{% endhint %}

```
Config = {
    requiredCops = 0,
    npcFightOnReject = true,
    account = 'money', --change to 'money' if you want
    drugs = {
        ['coke_pooch'] = 150,
        --add as much as you want
    },
    cityPoint = vector3(0.0, -1509.0, 150.0), --set cityPoint to false to disable
    notify = {
        title = 'Drugs',
        nodrugs = 'You don\'t have any drugs to sell.',
        cooldown = 'Please wait some time!',
        toofar = 'You\'re too far from the city.',
        cops = 'There\'s no cops in the city.',
        searching = 'You\'re searching for clients for ',
        abort = 'Client has resigned from the order.',
        notfound = 'There\'s no nearby clients.',
        approach = 'Your client is approaching..',
        found = 'You\'ve found client on ',
        press = 'Press ~INPUT_PICKUP~ to sell',
        reject = 'This stuff is horrible!',
        vehicle = 'You\'ve got to leave vehicle to sell',
        sold = 'You\'ve sold x%s of %s for $%s',
        client = 'Your client want\'s to buy x%s %s',
        police_notify_title = 'Police Dispatch',
        police_notify_subtitle = 'Drugs sell',
    },
    pedlist = {
    }
}
```

<pre><code><strong>⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
</strong></code></pre>

<figure><img src="/files/XUNroLqBjwEIp1S8O4h8" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}

```
Codesign CD_Dispatch Compatability
```

{% endhint %}

**Client (adminplus-selldrugs/client.lua)**

```
-- for cd_dispatch integration add this under line 83 in client.lua & remove
ESX.ShowAdvancedNotification(Config.notify.title, '', Config.notify.cops, 'DIA_CLIFFORD', 1)

local data = exports['cd_dispatch']:GetPlayerInfo()
	TriggerServerEvent('cd_dispatch:AddNotification', {
	job_table = {'police'}, 
	coords = npc.ped,
	title = '10-15 - Drug Sale',
	message = 'A '..data.sex..' is selling drugs near '..data.street, 
	flash = 0,
	unique_id = tostring(math.random(0000000,9999999)),
	blip = {
		sprite = 431, 
		scale = 1.2, 
		colour = 3,
		flashes = false, 
		text = '911 - Drug Sales',
		time = (5*60*1000),
		sound = 1,
	}
})
```

**Server (adminplus-selldrugs/server.lua)**

```
-- for cd_dispatch integration add this under line 55 in server.lua & remove
TriggerClientEvent('stasiek_selldrugsv2:notifyPolice', -1, drugToSell.coords)

TriggerClientEvent('cd_dispatch:AddNotification', -1, {
        job_table = {'police'},
        coords = drugToSell.coords,
        title = '10-15 - Drug Sale',
        message = 'Someone is selling drugs',
        flash = 0,
        unique_id = tostring(math.random(0000000,9999999)),
        blip = {
            sprite = 403,
            scale = 1.2,
            colour = 1,
            flashes = false,
            text = '911 - Drug Sale',
            time = (5*60*1000),
            sound = 1,
        }
})
```

```
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
```

<figure><img src="/files/cSa9GTZM3fGHbSakyouX" alt=""><figcaption></figcaption></figure>

```markup
V 1.0.0
```

* Original Release

```
V 1.0.1
```

> Fixed bug where you couldn't get into vehicles mid sales. (clicking F / X will cancel sale).

<pre><code><strong>⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
</strong></code></pre>

<figure><img src="/files/dkaSynFFlTAmJ7ocaag6" alt=""><figcaption></figcaption></figure>

{% @github-files/github-code-block url="<https://github.com/itsAdminPlus/adminplus-anticollision>" %}
