# Installation

Step-by-step guide to install the Multiplayer Transport Job on your FiveM server.

***

## Prerequisites

Before installing, make sure you have:

| Requirement           | Description                                         |
| --------------------- | --------------------------------------------------- |
| **Framework**         | QBCore, QBox, ESX, vRP, or Standalone               |
| **Database Resource** | oxmysql (recommended), mysql-async, or ghmattimysql |
| **PolyZone**          | Required for all Tworst Scripts                     |
| **FiveM Server**      | Build 2802 or higher recommended                    |

***

## Step 1: Download the Script

### From Cfx.re Portal (Recommended)

1. Go to [portal.cfx.re](https://portal.cfx.re)
2. Navigate to **Granted Assets**
3. Find **tw-transportv2** in your purchased scripts
4. Click **Download** to get the latest version

### From Tebex

1. Log in to your Tebex account
2. Go to your purchases
3. Download the script package

***

## Step 2: Extract Files

1. Extract the downloaded archive
2. You will find **two folders**:
   * `tw-transportv2` - Main script
   * `tw_transport_stream` - Stream assets (truck, trailer, forklift, warehouse props)
3. Place **both folders** in your server's `resources` directory

```
resources/
├── [standalone]/
├── [qb]/
├── tw-transportv2/            ← Main script
│   ├── config/
│   │   ├── config.lua
│   │   ├── coordinate.lua
│   │   └── GetCore.lua
│   ├── client/
│   ├── server/
│   ├── locales/
│   ├── html/
│   └── fxmanifest.lua
└── tw_transport_stream/       ← Stream assets (REQUIRED)
    ├── stream/
    │   ├── *.ydr
    │   ├── *.yft
    │   ├── *.ytd
    │   └── ...
    └── fxmanifest.lua
```

{% hint style="danger" %}
**Important:** The stream folder contains the transport truck, trailer, forklift, and warehouse props. Without it, vehicles won't spawn and job locations will be incomplete!
{% endhint %}

***

## Step 3: Database Setup

{% hint style="success" %}
**Automatic Setup:** The script automatically creates the required database tables when it starts for the first time. No manual SQL import needed!
{% endhint %}

***

## Step 4: Configure the Script

Open `config/config.lua` and set your framework:

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

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

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

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

{% hint style="info" %}
**QBox Users:** Set `Config.Framework = 'qb'` - QBox is fully compatible with the 'qb' setting.
{% endhint %}

See the [Configuration](https://docs.tworst.com/scripts/transport-job/configuration) page for all available options.

***

## Step 5: Configure Police Dispatch (Optional)

If you want police alerts on illegal missions, configure your dispatch system:

```lua
Config.PoliceAlert = {
    enabled = true,
    dispatchSystem = "ps-dispatch",  -- Your dispatch resource
    alertChance = 75,                -- Chance of alert (%)
}
```

Supported dispatch systems:

* ps-dispatch
* ls-dispatch
* fl-dispatch
* bixbi\_dispatch
* cd\_dispatch
* linden\_outlawalert

***

## Step 6: Add to server.cfg

Add the following to your `server.cfg`:

```cfg
# Dependencies (must start before tw-transportv2)
ensure oxmysql          # or mysql-async
ensure es_extended      # or qb-core (your framework)
ensure PolyZone

# Tworst Scripts - Stream files must be loaded!
ensure tw_transport_stream
ensure tw-transportv2
```

{% hint style="warning" %}
**Load Order:**

* Dependencies must start **before** the script
* Stream resource (`tw_transport_stream`) must be started **before or with** the main script
  {% endhint %}

***

## Step 7: Restart Server

1. Save all configuration changes
2. Restart your server completely
3. Check the server console for any errors

***

## Verification

After starting the server, verify the installation:

### Check Console

Look for these messages in your server console:

* Database tables created successfully (first run only)
* No error messages related to tw-transportv2

### In-Game Test

1. Go to the transport job location (El Burro Heights)
2. Look for the job blip on the map
3. Interact with the NPC to open the job menu
4. Rent a truck and forklift
5. Test loading boxes with the forklift

***

## Troubleshooting

### Script Won't Start

1. Check resource name matches exactly (case-sensitive on Linux)
2. Verify all dependencies are started before the script
3. Check for syntax errors in config files

### Missing Props / Vehicles Not Spawning

1. Make sure the stream folder is in your resources folder
2. Verify it's started in your `server.cfg`
3. Check the server console for streaming errors

### Forklift Not Attaching

1. Ensure the forklift model is loaded from stream
2. Check that attachment coordinates are correct in config
3. Try restarting both stream and main script

### Police Alerts Not Working

1. Verify your dispatch system is installed and running
2. Check `Config.PoliceAlert.enabled` is `true`
3. Ensure dispatch system name matches exactly

### Database Errors

1. Verify database connection string in `server.cfg`
2. Check that your database resource is starting properly
3. Ensure `Config.SQL` matches your database resource

### Framework Not Detected

1. Make sure `Config.Framework` matches your framework
2. Verify framework resource is starting before tw-transportv2
3. Check framework resource name matches expected names

***

## Need Help?

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

* Server console errors
* Your `Config.Framework` and `Config.SQL` settings
* Screenshots of any issues
  {% 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/scripts/transport-job/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.
