# Installation Guide

This guide covers the general installation process for all Tworst Scripts.

## Downloading Your Script

After purchasing a script from [tworst.com](https://tworst.com), follow these steps to download it:

### Step 1: Go to Cfx.re Portal

Visit [portal.cfx.re](https://portal.cfx.re) and log in with your Cfx.re account (the same account linked to your Tebex purchase).

### Step 2: Navigate to Your Assets

1. Click on **"Granted Assets"** in the left sidebar
2. You will see a list of all scripts you have purchased

### Step 3: Download the Script

1. Find the script you want to download
2. Click the **"Download"** button next to it
3. The script will be downloaded as a `.zip` file

{% hint style="info" %}
**Can't see your purchase?** Make sure you're logged in with the same Cfx.re account that was linked during checkout on tworst.com. If you still have issues, open a ticket on our [Discord](https://discord.gg/tworst).
{% endhint %}

***

## Prerequisites

Before installing any Tworst Script, make sure you have:

* A working FiveM server
* ESX, QBCore, or vRP framework installed
* One of the following database resources:
  * **oxmysql** (Recommended)
  * mysql-async
  * ghmattimysql
* **PolyZone** resource (required for all scripts)

***

## Installing the Script

### Step 1: Extract Files

Extract the downloaded `.zip` file to your server's `resources` folder:

```
resources/
└── tw-scriptname/
    ├── fxmanifest.lua
    ├── insert.sql
    ├── config/
    │   ├── config.lua
    │   ├── coordinate.lua
    │   └── GetCore.lua
    ├── client/
    ├── server/
    ├── locales/
    └── html/
```

### Step 2: Database Setup

{% hint style="success" %}
**Automatic Setup:** All Tworst Scripts automatically create the required database tables when the script starts for the first time. In most cases, you don't need to manually import anything!
{% endhint %}

**Manual Installation (Optional):**

If automatic table creation fails or you prefer manual setup, you can import the `insert.sql` file:

**HeidiSQL:**

1. Connect to your database
2. Select your database
3. File → Run SQL file
4. Select the `insert.sql` file
5. Execute

**phpMyAdmin:**

1. Login to phpMyAdmin
2. Select your database
3. Go to "Import" tab
4. Choose the `insert.sql` file
5. Click "Go"

{% hint style="warning" %}
Always backup your database before importing new tables manually.
{% endhint %}

### Step 3: Configure the Script

Open `config/config.lua` and adjust settings to match your server:

```lua
-- Framework Selection
Config.Framework = 'qb'  -- Options: 'esx', 'oldesx', 'qb', 'oldqb', 'vrp'

-- Language
Config.Locale = 'en'  -- Options: 'en', 'tr', 'de', 'fr', 'pt', 'ru', 'ar'

-- Database Resource
Config.SQL = "oxmysql"  -- Options: 'oxmysql', 'mysql-async', 'ghmattimysql'

-- Inventory System
Config.Inventory = "qb_inventory"  -- Options: 'esx_inventory', 'ox_inventory', 'qs_inventory', 'qb_inventory'

-- Interaction System
Config.InteractionHandler = 'drawtext'  -- Options: 'qb-target', 'ox-target', 'drawtext'
```

{% hint style="info" %}
Each script has additional configuration options. Check the specific script documentation for details.
{% endhint %}

### Step 4: Add to Server Config

Add the following lines to your `server.cfg`:

```cfg
# Dependencies (must be started first)
ensure oxmysql
ensure es_extended  # or qb-core
ensure PolyZone

# Tworst Scripts
ensure tw-scriptname
```

{% hint style="warning" %}
Make sure to start the script **after** your framework, database, and PolyZone resources.
{% endhint %}

### Step 5: Start the Server

Restart your server or use the console commands:

```
refresh
ensure tw-scriptname
```

***

## Supported Systems

All Tworst Scripts support the following systems:

### Frameworks

| Framework               | Config Value   | Notes                 |
| ----------------------- | -------------- | --------------------- |
| QBCore                  | `'qb'`         |                       |
| QBCore (older versions) | `'oldqb'`      |                       |
| QBox                    | `'qb'`         | Use `'qb'` for QBox   |
| ESX Legacy              | `'esx'`        |                       |
| ESX (older versions)    | `'oldesx'`     |                       |
| vRP                     | `'vrp'`        |                       |
| Standalone              | `'standalone'` | No framework required |

{% hint style="info" %}
**QBox Users:** QBox is fully compatible with our scripts. Simply set `Config.Framework = 'qb'` to use QBox.
{% endhint %}

### Inventory Systems

| Inventory        | Config Value      |
| ---------------- | ----------------- |
| QBCore Inventory | `'qb_inventory'`  |
| ESX Inventory    | `'esx_inventory'` |
| ox\_inventory    | `'ox_inventory'`  |
| qs-inventory     | `'qs_inventory'`  |

### Target Systems

| Target System        | Config Value  |
| -------------------- | ------------- |
| DrawText (no target) | `'drawtext'`  |
| qb-target            | `'qb-target'` |
| ox\_target           | `'ox-target'` |

### Vehicle Key Systems

| System          | Config Value        |
| --------------- | ------------------- |
| qb-vehiclekeys  | `'qb-vehiclekeys'`  |
| qbx-vehiclekeys | `'qbx-vehiclekeys'` |
| qs-vehiclekeys  | `'qs-vehiclekeys'`  |
| wasabi-carlock  | `'wasabi-carlock'`  |
| cd\_garage      | `'cd_garage'`       |

### Fuel Systems

| System     | Config Value   |
| ---------- | -------------- |
| LegacyFuel | `'LegacyFuel'` |
| ox\_fuel   | `'ox_fuel'`    |
| cdn-fuel   | `'cdn-fuel'`   |
| ps-fuel    | `'ps-fuel'`    |
| x-fuel     | `'x-fuel'`     |

### Clothing Systems

| System              | Config Value            |
| ------------------- | ----------------------- |
| qb-clothing         | `'qb-clothing'`         |
| illenium-appearance | `'illenium-appearance'` |
| fivem-appearance    | `'fivem-appearance'`    |
| esx\_skin           | `'esx_skin'`            |

{% hint style="info" %}
**Custom Support:** The clothing system is fully open-source. You can easily add support for other clothing scripts by modifying the code.
{% endhint %}

***

## Verification

After installation, check your server console. If you see errors:

1. Check config syntax (missing comma or bracket)
2. Verify framework detection in `Config.Framework`
3. Ensure all dependencies are started before the script
4. Check the [Troubleshooting](https://docs.tworst.com/guides/troubleshooting) page

***

## Need Help?

{% hint style="info" %}
Join our [Discord server](https://discord.gg/tworst) and open a support ticket with:

* Script name and version
* Framework (ESX/QBCore)
* Full error message
* Steps to reproduce
  {% 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://docs.tworst.com/getting-started/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.
