# How to Change the Black Money Name

## How to Customize the Black Money Name (Old & New Script Versions)

In our scripts, black money is typically referred to as `markedbills`. However, you can easily rename it to `black_money`, `dirtymoney`, or anything else depending on your framework or preference. This guide walks you through the customization steps for both **old** and **new script versions**, including examples for **QBCore** and **ESX** frameworks.

***

## Newer Scripts

In newer versions of our scripts, black money behavior is centralized in configuration and logic files such as `shared/config.lua` and `editable_server.lua`.

### **Step 1: Configure `shared/config.lua`**

Navigate to `shared/config.lua` and locate the following configuration block:

```lua
lConfig.moneyOptions = {
    blackMoney = false,
    blackMoneyName = "markedbills", -- if you are using ESX use "black_money", for QBCore use "markedbills"
    blackMoneyIsItem = true,
    useMetadataForBlackMoney = true,
    moneyName = "money",
    moneyIsItem = false,
}
```

**Edit the following keys:**

* `blackMoneyName`: Change this to `"black_money"`, `"dirtymoney"`, or your preferred name.
* `blackMoneyIsItem`: Set to `false` if you're using an account-based system (like ESX), or `true` if it's an item (like QBCore).
* `useMetadataForBlackMoney`: Set to `true` only if you're using metadata-based tracking.

### **Step 2: Update Logic in `editable_server.lua`**

Locate and modify the `addBlackMoney` function. Below are examples for both frameworks:

&#x20;**QBCore Example**

```lua
self.addBlackMoney = function(amount)
    Player.Functions.AddItem('black_money', amount)
end
```

### **ESX Example**

```lua
self.addBlackMoney = function(amount)
    return Player.addAccountMoney("black_money", amount)
end
```

> 💡 Make sure the blackMoney-related config options match the logic used here (item vs. account).

***

## Older Scripts

In older versions, black money handling is directly embedded inside the `server.lua` file.

### **Step 1: Open `server.lua`**

Open your older script folder and locate `server.lua`.

### **Step 2: QBCore Integration**

Search for code that looks like this:

```lua
local info = {
    worth = count
}
player.Functions.AddItem('markedbills', 1, false, info)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['markedbills'], "add")
```

Replace with:

```lua
player.Functions.AddItem('black_money', count)
```

> 🧹 You can remove the `info` table and `TriggerClientEvent` line if you’re not using metadata or item boxes.

### **Step 3: ESX Integration**

Search for:

```lua
Player.addAccountMoney("black_money", count)
```

If you want to rename `black_money` to something else (e.g., `dirtymoney`), simply update this line:

```lua
Player.addAccountMoney("dirtymoney", count)
```

Be sure to use this name consistently across all functions and config files.

***

#### Final Checklist

* 🔁 Restart your server after making changes.
* 🧪 Test black money creation (e.g., drug sale or robbery reward).
* 📦 Ensure the new item or account name is recognized in your inventory or UI.
* 🗂 Use consistent naming across all scripts, configs, and notifications.

***

#### 🛠 Troubleshooting

| Problem                  | Solution                                                            |
| ------------------------ | ------------------------------------------------------------------- |
| Black money not updating | Check all instances where the original name was used.               |
| Inventory errors         | Make sure `blackMoneyIsItem` and `blackMoneyName` are properly set. |
| Console warnings         | Verify syntax and correct function usage per your framework.        |


---

# 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.rainmad.com/development-guide/how-to-change-the-black-money-name.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.
