# Installation

<figure><img src="https://3628839866-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzeH5m2NcpM6wdeyLkzje%2Fuploads%2FoAfnHqgi4i7N1xMXL7R6%2Faddictions.png?alt=media&#x26;token=99c0f2e0-3553-4f11-aa2a-a16d93b01c42" alt="" width="563"><figcaption></figcaption></figure>

***

## 1. Download Resource

Download the purchased resource from [CFX Portal](https://portal.cfx.re/login) - Official Website of FiveM/RedM with your purchased assets.\


***

## 2. Download Dependencies

Download all the dependencies needed for Dex Addictions.\


<table data-view="cards"><thead><tr><th></th><th data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>VORP_Core</td><td><a href="https://github.com/VORPCORE/vorp_core-lua">https://github.com/VORPCORE/vorp_core-lua</a></td><td><a href="https://3628839866-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzeH5m2NcpM6wdeyLkzje%2Fuploads%2FWIuXZWnICQemnDCrfFs3%2Fimage_2025-05-15_103555370.png?alt=media&#x26;token=dacc32c1-1dcb-4b1d-81a6-b2e5f40c75d2">image_2025-05-15_103555370.png</a></td></tr><tr><td>VORP_Inventory</td><td><a href="https://github.com/VORPCORE/vorp_inventory-lua">https://github.com/VORPCORE/vorp_inventory-lua</a></td><td><a href="https://3628839866-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzeH5m2NcpM6wdeyLkzje%2Fuploads%2FPeidwfyRXepY9EB6B9xN%2Fimage_2025-05-15_103624599.png?alt=media&#x26;token=cdfe9213-b8c2-4b37-b483-be06248dee8b">image_2025-05-15_103624599.png</a></td></tr></tbody></table>

***

## 3. Change function of NUIService.lua in vorp\_inventory

For the script to be able to detect the usage of any item from anywhere, you need to use this function.\
Simply replace the function inside NUIService.lua for this one:

{% hint style="info" %}
File should be at <mark style="color:red;">vorp\_inventory\client\services\NUIService.lua</mark>
{% endhint %}

```lua
local function useItem(data)
	if timerUse <= 0 then
		TriggerServerEvent("vorp_inventory:useItem", data)

		TriggerEvent("vorp_inventory:useDetection", data.name or data.item)

		timerUse = 2000
	else
		Core.NotifyRightTip(T.slow, 5000)
	end
end
```

***

## 4. Insert table in DB

For the addictions to be persistent and for the script to fully work, you need to insert the following:

```sql
CREATE TABLE IF NOT EXISTS addictions (
  identifier VARCHAR(50) PRIMARY KEY,
  addictions LONGTEXT,
  last_use LONGTEXT
);
```

***

## 5. Start Resource

To start the resource in the `server.cfg`, make the sure it's been iniciated before the VORP Framework.\
When using a framework like `vorp_core`, you should start the resource after like so:\


```lua
ensure oxmysl #Example, oxmysql has to start first
ensure vorp_core # Example, here is your framework
ensure vorp_inventory # Example, dependencies

# Dex Resources
ensure Dex_Addictions

```

Make sure there are no syntax errors in your `server.cfg` .
