> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shdevelopment.org/llms.txt
> Use this file to discover all available pages before exploring further.

# sh-trucking: Trucking Job with XP Progression for FiveM

> sh-trucking adds a tiered trucking delivery job with XP-based level progression, trailer mechanics, and multi-framework payment support.

sh-trucking gives your players a fully standalone legal job where they pick up loads, haul them across the map, and earn both cash and XP for every successful delivery. The XP system persists to MySQL via oxmysql and unlocks higher-paying job tiers as players level up — starting with small solo hauls and progressing to big-rig runs with trailers attached. Payment, target interaction, and fuel are all configurable to match the resources already running on your server.

## Dependencies

| Dependency                                         | Required   | Notes                        |
| -------------------------------------------------- | ---------- | ---------------------------- |
| [oxmysql](https://github.com/overextended/oxmysql) | ✅ Yes      | Persists player level and XP |
| [ox\_lib](https://github.com/overextended/ox_lib)  | ✅ Yes      | UI and utility functions     |
| sh-notify                                          | ❌ Optional | Default notification handler |
| Fuel resource                                      | ❌ Optional | Set via `Config.Fuel`        |

## Database Setup

Run the following SQL against your database **before** starting the resource for the first time. This creates the table that stores each player's level and XP.

```sql theme={null}
CREATE TABLE IF NOT EXISTS `shtrucking` (
  `identifier` varchar(255) NOT NULL,
  `level` int(11) DEFAULT NULL,
  `XP` int(11) NOT NULL,
  PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
```

<Note>
  A pre-built `.sql` file is included in the resource root (`shtrucking.sql`). You can import it directly rather than copying the query above. If you start the resource without running the SQL first, players will receive database errors when they attempt to take a job.
</Note>

## Job Tiers

Players unlock higher tiers by accumulating XP through completed deliveries. Medium and Big jobs require a trailer, increasing both the challenge and the reward.

| Tier   | Unlock Requirement      | Pay Range | XP per Delivery | Vehicle            |
| ------ | ----------------------- | --------- | --------------- | ------------------ |
| Small  | 0 XP — always available | $100–$200 | 100–200 XP      | boxville4          |
| Medium | 5,000 XP                | $200–$400 | 200–400 XP      | packer + trailers2 |
| Big    | 10,000 XP               | $400–$800 | 400–800 XP      | packer + tr4       |

## Gameplay Flow

<Steps>
  <Step title="Find the NPC">
    Locate the trucking NPC on your map — a blip marks their position at the trucking depot. Walk up and interact using your configured target method (third-eye or proximity `[E]`).
  </Step>

  <Step title="Choose a tier">
    Select a job tier from the menu. Tiers you have not yet unlocked will be greyed out based on your current XP.
  </Step>

  <Step title="Collect your truck">
    A truck spawns nearby at the configured spawn point. For Medium and Big jobs, a trailer also spawns — hitch it before heading out.
  </Step>

  <Step title="Make the delivery">
    Follow the route marker to the delivery destination and drop off your load. The script validates arrival before marking the job complete.
  </Step>

  <Step title="Collect pay and XP">
    Return to the NPC to receive a randomised payment and XP within your tier's configured range. XP is saved to the database automatically.
  </Step>
</Steps>

## Configuration

All primary settings live in `shared/config.lua`.

```lua shared/config.lua theme={null}
Config.Framework   = 'qb'         -- 'qb', 'esx', 'nat', 'nd', 'standalone'
Config.Target      = 'qb'         -- 'qb', 'ox', or false (proximity key)
Config.Notify      = 'sh'         -- 'sh' (sh-notify) or 'custom'
Config.Fuel        = 'LegacyFuel' -- 'LegacyFuel', 'ps-fuel', 'bigdaddy', 'rhud'
Config.VehicleKeys = 'qb'         -- 'qb' or false

Config.NPC = {           -- Job NPC model and spawn position
    model   = 's_m_m_trucker_01',
    coords  = vector3(1197.06, -3253.35, 6.1),
    heading = 91.15
}

Config.JobVehicles = {   -- Vehicle models per tier
    Small  = 'boxville4',
    Medium = 'packer',
    Big    = 'packer',
}

Config.TrailerSpawn = {  -- Trailer models and spawn point
    MediumTrailer = 'trailers2',
    BigTrailer    = 'tr4',
    coords        = vector3(1145.21, -3253.71, 5.27),
    heading       = 265.0,
}

-- Pay and XP are randomised per delivery within these ranges
Config.JobPayments = {
    Small  = math.random(100, 200),
    Medium = math.random(200, 400),
    Big    = math.random(400, 800),
}

Config.JobXP = {
    Small  = math.random(100, 200),
    Medium = math.random(200, 400),
    Big    = math.random(400, 800),
}

Config.JobSizes = {      -- XP required to unlock each tier
    Medium = 5000,       -- Level 5 equivalent
    Big    = 10000,      -- Level 10 equivalent
}
```

<Accordion title="Supported frameworks and what each value means">
  * **`qb`** — QBCore; uses QBCore player object for payments and identity
  * **`esx`** — ESX Legacy; uses ESX player object
  * **`nat`** — NAT2K15 money system
  * **`nd`** — ND\_Core
  * **`standalone`** — No framework; payments are handled by the built-in cash drop method
</Accordion>

<Accordion title="Supported target systems">
  * **`'qb'`** — qb-target third-eye interaction
  * **`'ox'`** — ox\_target third-eye interaction
  * **`false`** — Proximity `[E]` key; no target resource needed
</Accordion>

<Accordion title="Supported fuel resources">
  * `LegacyFuel` — LegacyFuel by InZidiuZ
  * `ps-fuel` — ps-fuel by Project Sloth
  * `bigdaddy` — BigDaddy fuel
  * `rhud` — Renewed HUD integrated fuel
</Accordion>

## NPC Blip

The job NPC blip is visible on the map by default. You can adjust its appearance in `shared/config.lua` under the `Config.Blip` block — change the sprite number, colour index, and scale to match your server's UI style.

```lua shared/config.lua theme={null}
Config.Blip = {
    BlipEnabled = true,
    BlipName    = 'Trucking Job',
    BlipSprite  = 67,
    BlipColor   = 5,
    BlipScale   = 0.6,
}
```

<Tip>
  Spawned trucks are automatically filled to 100% fuel when the job starts, regardless of your server's fuel resource. Players never need to stop for fuel at the start of a run.
</Tip>
