# Installation

Step-by-step guide to install the Multiplayer Plumber 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-plumber** 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-plumber` - Main script
   * `tw_plumber_stream` - Stream assets (plumbing van, pipe props)
3. Place **both folders** in your server's `resources` directory

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

{% hint style="danger" %}
**Important:** The stream folder contains the plumbing van, pipe models, valve props, and plumbing equipment. Without it, the job won't function correctly!
{% 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/plumber-job/configuration) page for all available options.

***

## Step 5: Add to server.cfg

Add the following to your `server.cfg`:

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

# Tworst Scripts - Stream files must be loaded!
ensure tw_plumber_stream
ensure tw-plumber
```

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

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

***

## Step 6: 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-plumber

### In-Game Test

1. Go to the plumber job location
2. Look for the job blip on the map
3. Interact with the NPC to open the job menu
4. Rent a plumbing van
5. Start a job and complete tasks

***

## 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 / Van 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

### 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-plumber
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/plumber-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.
