# CAR WASH

| Feature                      | Description                                                                            |
| ---------------------------- | -------------------------------------------------------------------------------------- |
| **3 Wash Tiers**             | Basic ($50), Standard ($150), Premium ($350) — each with different dirt removal levels |
| **NPC Workers**              | Hire up to 3 NPC employees per location with levels, salaries, and happiness tracking  |
| **Pressure Washer Minigame** | Real players can work as car wash employees using an NPDS-style pressure gun           |
| **Business Management**      | Full boss panel with sales history, employee management, supplies, and activity feed   |
| **Supply System**            | Buy and manage supplies — NPCs need them to work and stay happy                        |
| **Revenue Split**            | Configurable company/worker split (default 80/20)                                      |
| **Cinematic Cameras**        | 8 smooth camera angles during the wash sequence                                        |
| **Multi-Language**           | English and Spanish included, easy to add more                                         |
| **ESX & QB-Core**            | Auto-detects your framework — just install and go                                      |
| **External Boss Menus**      | Optional integration with neon-bossmenu and multiple society bank systems              |

***

### 📦 Dependencies

| Dependency             | Required?      | Link                                                                                  |
| ---------------------- | -------------- | ------------------------------------------------------------------------------------- |
| **ox\_lib**            | ✅ Yes          | [GitHub](https://github.com/overextended/ox_lib)                                      |
| **mysql-async**        | ✅ Yes          | [GitHub](https://github.com/brouznouf/fivem-mysql-async)                              |
| **ox\_target**         | ❌ Optional     | [GitHub](https://github.com/overextended/ox_target) — only if you enable `TargetMode` |
| **ESX** or **QB-Core** | ✅ One required | Your framework of choice                                                              |

> **Note:** If you use `oxmysql` instead of `mysql-async`, it should work as a drop-in replacement — just make sure you have the `mysql-async` wrapper or update the `fxmanifest.lua` accordingly.

***

### 🏆 Credits

#### NPDS Pressure Washer Props

Awesome minigame for car wash employees powered by props from our friend <mark style="background-color:$warning;">**@NukePUG**</mark>, who has some amazing free props and assets available!

👉 **Nukepug Design's Discord:** <https://discord.gg/DXe7vZwN2A> 👏

The custom `npds_pressurgun` model and powerwash assets are used with permission for the worker minigame's realistic pressure washer experience.

#### CodeForge

Developed by **CodeForge** — building premium FiveM scripts with employee-based business systems.

***

### 🔧 Installation

#### Step 1: Download & Place the Resource

1. Download or clone this resource.
2. Place the folder in your server's `resources` directory.
3. Rename it if you want (e.g., `forge-carwash`).

#### Step 2: Add to Server Config

Open your `server.cfg` and add:

```cfg
ensure ox_lib
ensure forge-carwash
```

> Make sure `ox_lib` and your framework (`es_extended` or `qb-core`) start **before** this resource.

#### Step 3: Database Setup

The script **auto-creates** the database table on first start. You don't need to run any SQL manually.

If you prefer to create it manually, here's the table:

```sql
CREATE TABLE IF NOT EXISTS `forge_business` (
    `id`         VARCHAR(50)  NOT NULL PRIMARY KEY,
    `type`       VARCHAR(50)  DEFAULT 'car_wash',
    `owner`      MEDIUMTEXT   NULL,
    `employees`  LONGTEXT     DEFAULT '{}',
    `stock`      LONGTEXT     DEFAULT '{}',
    `data`       LONGTEXT     DEFAULT '{}',
    `orders`     LONGTEXT     DEFAULT '{}',
    `history`    LONGTEXT     DEFAULT '{}'
);
```

#### Step 4: Configure Your Locations

Open `config/shops.lua` and set up your car wash locations. The script comes with **3 pre-configured locations** ready to use.

#### Step 5: Set Up Jobs (Optional — for Business Mode)

If you want a location to be a **business** (with employee management), you need to create the job in your framework:

**For ESX:**

```sql
INSERT INTO `jobs` (`name`, `label`) VALUES ('carwash1', 'Car Wash');
INSERT INTO `job_grades` (`job_name`, `grade`, `name`, `label`, `salary`) VALUES
('carwash1', 0, 'employee', 'Employee', 50),
('carwash1', 1, 'boss', 'Boss', 100);
```

**For QB-Core:** Add the job to your `qb-core/shared/jobs.lua`.

#### Step 6: Restart Your Server

Restart or start the resource. The database table will be created automatically.

***

### 🗄️ Database

The script uses a single table: `forge_business`

| Column      | Purpose                                                   |
| ----------- | --------------------------------------------------------- |
| `id`        | Unique location key (e.g., `carwash_lsc`)                 |
| `type`      | Always `car_wash`                                         |
| `owner`     | Business owner identifier                                 |
| `employees` | JSON array of hired NPC employees                         |
| `stock`     | JSON object with supply levels `{current, max}`           |
| `data`      | JSON object with `{balance, totalCustomers, totalEarned}` |
| `orders`    | JSON array of notification feed entries                   |
| `history`   | JSON array of sales records                               |

Auto-migration is enabled by default (`Cfg.AutoMigrateDB = true`). Set it to `false` after your first start if you prefer.

***

### ⚙️ Configuration

All configuration is in `config/config.lua`. Here are the most important settings:

#### Framework

```lua
-- Auto-detected! No need to change unless you have a custom setup.
Cfg.Framework = "ESX"  -- or "QB-Core" (auto-detected)
```

#### Language

```lua
Cfg.Locale = 'en'  -- 'en' for English, 'es' for Spanish
```

#### Wash Tiers

```lua
Cfg.WashTiers = {
    ['poor'] = {
        label       = 'Basic Wash',
        price       = 50,
        dirtRemoval = 0.4,    -- removes 40% of current dirt
        duration    = 12000,   -- 12 seconds
        npcCount    = 1,       -- 1 NPC washes the car
    },
    ['standard'] = {
        price       = 150,
        dirtRemoval = 0.75,   -- removes 75% of current dirt
        duration    = 20000,
        npcCount    = 2,
    },
    ['premium'] = {
        price       = 350,
        dirtRemoval = 1.0,    -- 100% clean + repairs vehicle
        duration    = 30000,
        npcCount    = 3,
    },
}
```

> **How dirt removal works:** It removes a percentage of the vehicle's **current** dirt level. A car at dirt level 10 with a Basic Wash (40%) will end at 6.0 — still somewhat dirty. Premium always leaves it spotless.

#### Revenue Split

```lua
Cfg.CompanySharePercent = 80   -- goes to business balance
Cfg.WorkerSharePercent  = 20   -- goes to the on-duty player
```

#### NPC Employees

```lua
Cfg.MaxNPCEmployees    = 3     -- max per location
Cfg.NPCRotationMinutes = 120   -- available pool refreshes every 2 hours
Cfg.NPCSalaryPerLevel  = 120   -- $120/hr per level (Lv2 = $240/hr)
```

#### Supply System

```lua
Cfg.DefaultSupplyMax       = 100
Cfg.SupplyPerWash          = 2      -- consumed per wash
Cfg.SupplyUnitPrice        = 30     -- $30 per unit
Cfg.SupplyBuyIncrement     = 10     -- buy in batches of 10
Cfg.SupplyAngerThreshold   = 50     -- NPCs get unhappy below 50%
Cfg.SupplyCriticalThreshold = 10    -- critical warning below 10%
```

#### Interaction Mode

```lua
Cfg.TargetMode   = false          -- false = markers, true = ox_target
Cfg.TargetScript = 'ox_target'    -- which target script to use
```

#### UI Customization

```lua
Cfg.EnableBlur      = false
Cfg.EnableParticles = true
Cfg.UIVolume        = 0.4

Cfg.UIColors = {
    Accent     = { Primary = '#00ffc8', Muted = '#00b38a', Bright = '#33ffd6' },
    Background = { Deep = '#0a0f14', Card = '#141b22', Surface = '#1a222b' },
    -- ... full color customization available
}
```

***

### 📍 Car Wash Locations

Locations are configured in `config/shops.lua`. Each location can be either:

* **Free wash** (`isBusiness = false`) — anyone can use it, no management
* **Business** (`isBusiness = true`) — has management panel, employee system, supplies

Each location needs:

| Property       | Description                                     |
| -------------- | ----------------------------------------------- |
| `label`        | Display name                                    |
| `blipCoords`   | Map blip position                               |
| `washPoint`    | Where the vehicle parks for washing             |
| `npcPositions` | Where NPC workers spawn (up to 3)               |
| `dutyPoint`    | Where players toggle on/off duty                |
| `adminPoint`   | Where the boss opens the management panel       |
| `assignedJob`  | The framework job name for this location        |
| `isBusiness`   | `true` for full business, `false` for free wash |

The script comes with 3 ready-to-use locations.

***

### 🎮 How It Works

#### For Customers:

1. Drive your vehicle to a car wash location.
2. Walk to the wash point and interact (press E or use target).
3. Choose a wash tier (Basic, Standard, Premium).
4. Pay with cash or bank.
5. Watch the NPCs wash your car with cinematic cameras.
6. If a real player is on duty, they'll wash your car with the pressure washer minigame instead!

#### For Employees (Real Players):

1. Go to the duty point and toggle **on duty**.
2. When a customer pays, you'll get a notification.
3. Walk to the vehicle and press E to claim the job.
4. Use the pressure washer minigame to clean each zone of the car.
5. You earn your worker share (default 20%) of the wash price.

#### For Business Owners:

1. Go to the admin point and open the management panel.
2. **Home:** View sales, revenue, and activity.
3. **Employees:** Hire/fire NPC workers from the available pool.
4. **Supplies:** Buy supplies to keep operations running.

***

### 🔫 Worker Minigame

When a real player is on duty and a customer orders a wash, the player gets to wash the car themselves using a realistic **NPDS-style pressure washer**.

#### Controls:

* **Mouse** — aim the pressure washer
* **Left Click (hold)** — spray water
* **Walk freely** — move around the vehicle to reach all zones

#### How It Works:

* The vehicle is divided into **zones** (bones): chassis, hood, trunk, doors, wheels.
* Each tier unlocks a different number of zones to clean:
  * **Basic:** 5 zones
  * **Standard:** 8 zones
  * **Premium:** 11 zones (full car)
* Dirt markers appear on each zone — they shrink and fade as you clean.
* The crosshair turns **green** when you're hitting a dirty zone.
* Progress is tracked as the average cleanliness of all zones.
* When done, a success popup appears and the customer gets notified.

#### Visual Effects:

* Water jet particle from the nozzle
* Splash particles on the vehicle surface
* Vehicle dirt level updates in real-time

***

### 📊 Management Panel

The management panel is available at business locations for the job owner.

#### Home Tab

* Total revenue (all time + last 30 days)
* Number of employees
* Recent sales history with type badges (WASH, NPC, EXTRA, WORKER)

#### Employees Tab

* **Hired workers:** See level, earnings, and happiness status
* **Available workers:** Hire from a rotating pool of NPCs
* Fire underperforming employees
* ℹ️ A hint icon explains that this is for NPC employees only — hire real players through your Boss Menu

#### Supplies Tab

* Visual supply gauge
* Buy in portions or full stock
* Warnings when supplies are low or critical

#### Activity Feed

* Real-time notifications: hires, fires, sales, supply alerts
* Timestamps with relative time display

***

### 💬 Support & More Scripts

#### Need Help?

Join our Discord for support, updates, and feature requests:

👉 **CodeForge Discord:** <https://discord.gg/UTVssdrXRV>

#### More Scripts with Employee Systems

Love the employee/business system? Check out our other scripts with similar features:

👉 **CodeForge Employee Scripts Collection:** <https://codeforge.fragmentor.io/category/3024539>


---

# 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://codeforge.gitbook.io/codeforge/free/car-wash.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.
