# WASH MACHINE

<figure><img src="/files/wU25X1Gc9uAdxm71PTD2" alt=""><figcaption></figcaption></figure>

### 📖 Introduction

**Wash Machine** is an advanced FiveM script that allows players to launder their black money into clean money. The script features an interactive washing machine system with a modern user interface and animations.

#### 🎯 What is this script for?

This script allows players to:

* **Launder black money** : Convert black money into clean money with variable fees
* **Progressive tax system** : The more money you launder, the lower the fees
* **Random location system** : Washing machines appear at random locations for increased realism
* **Modern user interface** : A smooth and intuitive HTML/CSS/JS interface
* **Multi-framework support** : Compatible with ESX and QBCore

***

### ✨ Features

#### 🎮 Game System

* **Interactive NPCs** : Talk to NPCs to get information about washing machines
* **GPS system** : A random waypoint is added to your GPS after talking to the NPC
* **Washing machines** : Interact with machines at random locations
* **Animation** : Automatic animation during laundering (DPEmote support)
* **Real-time timer** : Display of remaining time during the laundering process

#### 💰 Economic System

* **Progressive fees** :
  * **Fee 1** : 30% for amounts < $500,000
  * **Fee 2** : 25% for amounts between $500,000 and $1,500,000
  * **Fee 3** : 20% for amounts > $1,500,000
* **Laundering time** : Configurable (default 10 seconds)
* **Time restriction** : Option to limit laundering to certain hours (18:30 - 04:00)

#### 🎨 User Interface

* **Modern design** : HTML/CSS interface with animations
* **Sounds** : Washing machine and error sounds
* **Notifications** : Built-in notification system (ESX/QBCore) or custom
* **Multi-language** : All texts are configurable in the config

***

### 🚀 Installation

#### Prerequisites

* FiveM server with ESX **OR** QBCore
* Resource compatible with your framework

#### Installation Steps

1. **Download** the script from your purchase source
2. **Place** the `washmachine` folder in your `resources` folder
3. **Add** to your `server.cfg` :

   ```cfg
   ensure washmachine
   ```
4. **Configure** the framework in `shared/config.lua` (see Configuration section)
5. **Restart** your server

***

### ⚙️ Configuration

#### Framework Selection

The script supports **ESX** and **QBCore**. To change the framework, modify this line in `shared/config.lua` :

```lua
WashClient.Framework = "esx" -- Change to "qb" for QBCore
```

**ESX Configuration**

For ESX, no additional configuration is required. The script automatically uses:

* The `black_money` account for black money
* `addMoney()` to add clean money

**QBCore Configuration**

For QBCore, the script supports two black money systems:

1. **Markedbills** (recommended) : Uses the `markedbills` item with a `worth` metadata
2. **Black Money** : Uses the `black_money` item with a quantity

The script automatically detects the system used. If you use a custom system, modify the `Framework.GetBlackMoney()` and `Framework.RemoveBlackMoney()` functions in `shared/framework.lua`.

***

### 📝 Detailed Configuration

#### Basic Configuration

```lua
-- Laundering time in seconds
WashClient.Time = 10

-- Enable time restriction
WashClient.VeriftimeActivate = false

-- NPC models
WashClient.Ped1 = "a_m_y_smartcaspat_01"
WashClient.Ped2 = "a_m_y_smartcaspat_01"
```

#### NPC Positions

Add as many positions as you want for information NPCs:

```lua
WashClient.Config.pedPosition = {
    vector4(19.743, 337.902, 110.485, 154.953), -- x, y, z, heading
    vector4(x, y, z, heading), -- Add more positions here
}
```

#### Tax Configuration

```lua
WashClient.Config.configuration = {
    money1 = 500000,   -- Threshold 1 : < $500,000 = taxe1
    money2 = 1500000,  -- Threshold 2 : between 500k and 1.5M = taxe2, > 1.5M = taxe3
    taxe1 = 30,        -- 30% fee
    taxe2 = 25,        -- 25% fee
    taxe3 = 20,        -- 20% fee
}
```

#### Washing Machine Positions

The positions where machines can appear (random):

```lua
WashClient.Config.randomWashing = {
    vector4(-290.052, 2543.105, 74.415, 8.655),
    vector4(1591.427, 6575.425, 12.642, 213.186),
    -- Add more positions here
}
```

#### Text Customization

Modify all texts in `WashClient.Translate` and `WashClient.TranslateNotif`:

```lua
WashClient.Translate = {
    WashTitle = "Dirty money",
    WashText = "Clean your dirty money",
    -- ... other texts
}
```

#### Custom Notifications

To use your own notification system:

```lua
WashClient.Notifications = {
    useCustom = true, -- Enable custom notifications
    customNotificationClient = function(message)
        -- Your client notification code here
        TriggerEvent('your-custom-notification', message)
    end,
    customNotificationServer = function(source, message)
        -- Your server notification code here
        TriggerClientEvent('your-custom-notification', source, message)
    end,
}
```

#### Animations

```lua
WashClient.DPEmote = {
    Active = true,                    -- Use DPEmote
    Animation = "e makeitrain",        -- DPEmote command
    -- If DPEmote disabled :
    Dictionnary = "anim@mp_player_intupperraining_cash",
    Anim = "idle_a"
}
```

***

### 🎮 Usage

#### For Players

1. **Find an NPC** : Go to one of the configured NPC positions
2. **Talk to the NPC** : Press `E` to talk to the NPC
3. **Get the location** : The NPC will give you a random GPS waypoint
4. **Go to the machine** : Go to the indicated location
5. **Interact** : Press `E` on the washing machine
6. **Launder** : Select the amount to launder in the interface
7. **Wait** : The process takes a few seconds (configurable)
8. **Collect** : Click "Get the money back" once finished

#### Restrictions

* **One active machine** : Only one player can use a washing machine at a time
* **No black money** : If you don't have black money, you cannot use the machine
* **Time restriction** : If enabled, laundering is limited to configured hours (18:30 - 04:00)

***

### 🔧 Troubleshooting

#### The script doesn't work

1. **Check the framework** : Make sure `WashClient.Framework` is correctly configured
2. **Check dependencies** : The script must be loaded after your framework
3. **Check the console** : Look for errors in the F8 console

#### Money is not being removed (QBCore)

1. **Check the black money system** : Make sure you're using `markedbills` or `black_money`
2. **Modify the wrapper** : If you use a different system, modify `Framework.GetBlackMoney()` in `shared/framework.lua`

#### NPCs don't appear

1. **Check positions** : Make sure coordinates are correct
2. **Check models** : Ped models must be valid

**Enjoy the game ! 🚀**


---

# 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://rex-studio.gitbook.io/rex-studio-docs/fivem-low-cost/wash-machine.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.
