> For the complete documentation index, see [llms.txt](https://fetchq-store.gitbook.io/fetchq-store-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fetchq-store.gitbook.io/fetchq-store-docs/fivem-pops-and-bangs-script-exhaust-flames-sound-and-engine-swap-or-qbcore-qbox-and-esx.md).

# FiveM Pops & Bangs Script – Exhaust Flames, Sound & Engine Swap | QBCore, QBOX & ESX

FiveM Pops & Bangs Script – Exhaust Flames, Sound & Engine Swap | QBCore, QBOX & ESX

## Pops & Bangs

### 🔥 FetchQ Pops & Bangs

A synced exhaust backfire system for FiveM servers. Every vehicle gets pops, bangs and flames that the driver tunes from an in-game tablet: flame style, colour, position, sound set and engine note. Everything is saved per vehicle and everyone around the car sees and hears the same thing.

### 🌟 Overview

FetchQ Pops & Bangs turns every car meet into a show. A driver opens the tablet, picks a flame style and colour, decides where the flames come out, chooses a backfire sound and even swaps the engine note for one from another vehicle. The settings are written onto the vehicle itself, so a change made in one car shows up on that car only, for every player, including those who join later. Six triggers fire the flames: lift-off, gear shifts, rev limiter, 2-step launch control, turbo anti-lag and engine startup.

### ✨ Features

#### 🎛️ Tablet Tuning

* **In-Game Tablet:** Dark/light tablet with live preview, test button and a draggable window. Opens with `F7` by default.
* **Per-Vehicle Settings:** Every setting is saved per plate in the database and survives restarts.
* **True Sync:** Settings are attached to the vehicle entity as a state bag. Two cars with the same plate can still look and sound different.
* **One-Key Toggle:** `Page Up` turns the whole system on or off for your car.

#### 🔥 Flames

* **Four Styles:** Crackle, Street, Race and Flamethrower, each with its own shot count, spacing and size.
* **12 Colours:** Default game flame, 10 colour presets, a rainbow cycle and a custom picker with separate body and core colours.
* **Real Light:** Coloured flames cast light on the road and nearby objects.
* **Size & Intensity Sliders:** Flame size from 0.3× to 2.5×, flames per burst from 0.3× to 2×.

#### 📍 Flame Position

* **Six Mount Points:** Exhaust tips (all `exhaust` to `exhaust_16` bones are detected), hood, underbody, side pipes, roof stacks or custom.
* **In-World Editor:** Move, raise, tilt and mirror the flames live on the car with the arrow keys and save the result per vehicle.
* **Fallbacks:** Add-on cars without exhaust bones get a sensible rear position automatically.

#### 🔊 Sound

* **3D Backfire Audio:** Five recorded sound sets with distance roll-off, muffling inside a closed car and an overload limiter.
* **Custom Sounds:** Drop `.wav`, `.ogg` or `.mp3` files into `web/sounds/` and list them in the config.
* **Engine Sound Swap:** 23 engine notes from the game's own audio banks. Nothing is streamed. Clicking a name blips the throttle so you hear it before you save.

#### 🚀 Triggers

| Trigger     | What fires it                                              | Per-vehicle switch    |
| ----------- | ---------------------------------------------------------- | --------------------- |
| Lift-off    | Releasing the throttle at high rpm                         | Off-throttle pops     |
| Gear shift  | Every gear change above the minimum rpm                    | Gear shift pops       |
| Rev limiter | Bouncing off the limiter                                   | Rev limiter pops      |
| 2-Step      | Brake + throttle while stationary, launch burst on release | 2-Step launch control |
| Anti-lag    | Off-throttle while moving, needs the turbo mod             | Anti-lag (turbo)      |
| Startup     | One backfire when the engine starts                        | Server-wide only      |

#### ⚙️ System & Administration

* **Framework Auto-Detection:** Works with QBCore, Qbox and ESX. Standalone mode works without a framework.
* **Access Modes:** Everyone, plate owner only, mechanic jobs only or "keys" mode. Admin groups always have access.
* **Job Gate:** Optional job check with minimum grades and on-duty requirement on top of the access mode.
* **Model Blacklist:** Keep the system off emergency vehicles or anything else you list.
* **Network Safe:** Pops are batched and rate limited on client and server. Flames can never set a car on fire.
* **Multi-language:** English, German, French and Russian included.

### 📦 Requirements

* `ox_lib`
* `oxmysql`
* `qb-core`, `qbx_core` or `es_extended` (optional, standalone works without them)
* OneSync enabled

### 🚀 Installation & Configuration

#### 1. Resource Setup

Put the `fetchq-popbang` folder in your `resources` directory and start it after `ox_lib` and `oxmysql`.

```
ensure ox_lib
ensure oxmysql
ensure fetchq-popbang
```

#### 2. Database Setup (SQL)

The script creates the table automatically on first start. If needed, you can run this manually in your database:

```
CREATE TABLE IF NOT EXISTS `fetchq_popbang_vehicles` (
    `plate` VARCHAR(12) NOT NULL,
    `settings` LONGTEXT NOT NULL,
    `saved_by` VARCHAR(64) DEFAULT NULL,
    `updated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`plate`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```

Owner and keys access modes read your framework's `player_vehicles` table. No other table is needed.

#### 3. Items

No inventory items are required. Every vehicle has the system from the moment it spawns, and access is controlled by `Config.Access`.

#### 4. Usage

1. Get behind the wheel of any vehicle.
2. Press `F7` to open the tablet.
3. Pick a flame style, colour, position, sound set and engine note. Use **Preview** or **Test** to check it.
4. Press **Save and apply**. Everyone around the car now sees and hears your setup.

**Position editor:** On the Position tab press **Fine tune position**. Arrow keys move the flame, `Left Ctrl` switches between move, height and angle, `M` mirrors, `R` resets, `Enter` saves, `Backspace` cancels.

**2-Step:** Stand still, hold brake and throttle. The rpm is pinned and the exhaust crackles until you release the brake. If `Config.Triggers.TwoStep.HoldKey` is on, `Left Alt` must be held as well.

#### 5. Keys & Commands

| Key        | Action                                              |
| ---------- | --------------------------------------------------- |
| `F7`       | Open / close the tablet                             |
| `Page Up`  | Turn the system on or off for your car              |
| `Left Alt` | Hold for 2-step (only when `TwoStep.HoldKey` is on) |

| Command           | Description                |
| ----------------- | -------------------------- |
| `/popbang`        | Opens or closes the tablet |
| `/popbang_toggle` | Turns the system on or off |

Keys are rebindable by every player in *Settings → Key Bindings → FiveM*. Default keys can be changed in `Config.Keys`.

### 🛠️ Customization (`config.lua`)

You can customize almost every part of the script in `config.lua`:

* **Framework:** `Config.Framework` (`auto`, `qbx`, `qb`, `esx`, `standalone`).
* **Language:** `Config.Locale` (`en`, `de`, `fr`, `ru`).
* **Access:** Mode, mechanic jobs, admin groups, driver-seat requirement, engine requirement, model blacklist and the optional job gate in `Config.Access`.
* **Keys:** Default key bindings in `Config.Keys`.
* **Triggers:** Rpm thresholds, speeds, cooldowns and power per trigger in `Config.Triggers`.
* **Flame Styles:** Shots, spacing, size and particle layers in `Config.Profiles` and `Config.ProfileOrder`.
* **Flame Renderer:** Length, width, life, opacity, draw distance and flame cap in `Config.FlameRenderer`.
* **Colours:** Add or change RGB presets in `Config.Colors`. `Config.ColorJitter` and `Config.RainbowSpeed` tune the look.
* **Mount Points:** Bones, offsets, angles and fallbacks in `Config.Mounts`. Editor step size in `Config.EditorStep`.
* **Extras:** Flame light, camera shake, smoke and engine wear in `Config.Extras`.
* **Sound:** Sets, files, durations, order, hearing distance, master volume and the anti-lag burble set in `Config.Sound`.
* **Engine Sounds:** The engine list and the audition blip in `Config.EngineSound`.
* **Sync:** Sync distance, batch interval, rate limits and save cooldown in `Config.Sync`.
* **Defaults:** What a vehicle looks like before anybody tunes it in `Config.Defaults`.
* **UI:** Theme, accent colour, draggable window and remembered position in `Config.UI`.

#### Custom Sounds

Drop the files into `web/sounds/` and add a set to `Config.Sound.Sets`:

```
mypack = { label = 'My Pack', files = { 'my_pop_1.wav', 'my_pop_2.wav' } },
```

Add the id to `Config.Sound.Order` so it shows in the tablet. Use short mono transients (0.1 to 0.5 seconds) with a clean attack and a faded tail. For files that already contain a full limiter rattle, set `sequence = true` and add the file length in seconds to `Config.Sound.Durations` so phrases never overlap.

#### Custom Engine Sounds

Any vehicle spawn name works. Add it to `Config.EngineSound.List`:

```
{ id = 'MYCAR', label = 'My Custom V8' },
```

A name that does not exist in the game simply leaves the original sound in place.

#### Custom Colours

```
{ id = 'lime', label = 'Lime', body = { 160, 255, 40 }, core = { 230, 255, 200 } },
```

`body` is the flame itself, `core` is the hot centre.

### 🔌 Exports

Client:

```
exports['fetchq-popbang']:GetTune(plate)          -- stored settings for a plate
exports['fetchq-popbang']:GetVehicleTune(vehicle) -- what that vehicle runs with right now
exports['fetchq-popbang']:Pop(vehicle, power)     -- fire one burst, power 0.2 to 1.6
exports['fetchq-popbang']:IsTwoStepActive()
```

Server:

```
exports['fetchq-popbang']:GetTune(plate)
exports['fetchq-popbang']:GetVehicleTune(vehicle)
exports['fetchq-popbang']:SetTune(plate, tune)          -- every spawned car with that plate
exports['fetchq-popbang']:SetVehicleTune(vehicle, tune) -- this one car, saved under its plate
exports['fetchq-popbang']:ResetTune(plate)
```

A `tune` table uses the same keys as `Config.Defaults` (`profile`, `color`, `custom`, `mount`, `scale`, `intensity`, `sound`, `volume`, `engine`, `decel`, `shift`, `revlimit`, `twostep`, `twostepRpm`, `antilag`, `enabled`). Missing keys fall back to the defaults.

### ❓ Troubleshooting

| Problem                                           | Fix                                                                                                                                    |
| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| Other players do not see flames                   | OneSync must be enabled. Check `Config.Sync.Distance`.                                                                                 |
| "You are not allowed to tune this vehicle"        | Check `Config.Access.Mode`. Owner and keys modes need the plate in `player_vehicles`.                                                  |
| No sound at all                                   | Press any key or click once after joining; the browser audio engine needs one input to unlock. Check the files exist in `web/sounds/`. |
| Engine sound does not change                      | The id must be a valid vehicle spawn name. Unknown names keep the stock sound.                                                         |
| Flames appear in the wrong place on an add-on car | Use the position editor, or adjust the `fallback` of that mount in `Config.Mounts`.                                                    |
| Anti-lag never fires                              | The vehicle needs the turbo mod, or set `AntiLag.RequireTurbo = false`.                                                                |
| Settings reset after restart                      | The database was not ready on first start. Check the `oxmysql` connection and that the table exists.                                   |
| Tablet does not open                              | The engine must be running when `Config.Access.EngineMustRun` is on. The model may be in `BlacklistModels`.                            |

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://fetchq-store.gitbook.io/fetchq-store-docs/fivem-pops-and-bangs-script-exhaust-flames-sound-and-engine-swap-or-qbcore-qbox-and-esx.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
