# moh-zone — Commands & Database

### Commands

| Command                   | Who    | Description                                |
| ------------------------- | ------ | ------------------------------------------ |
| `/startzone`              | Admin  | Activate the Red Zone                      |
| `/stopzone`               | Admin  | Deactivate the Red Zone                    |
| `/checkcoins`             | Player | Check your own coin balance and kill count |
| `/setcoins [id] [amount]` | Admin  | Set a player's coins to an exact value     |
| `/addcoins [id] [amount]` | Admin  | Add coins to a player                      |
| `/redzoneadmin`           | Admin  | Open the NUI admin panel                   |

All command names can be changed in `Config.Commands` inside `config.lua`:

```
Config.Commands = {
    startZone  = 'startzone',
    stopZone   = 'stopzone',
    checkCoins = 'checkcoins',
    setCoins   = 'setcoins',
    addCoins   = 'addcoins',
    adminPanel = 'redzoneadmin',
}
```

### Admin Panel

Opening `/redzoneadmin` launches a NUI panel where admins can:

* Start or stop the zone
* Change the live kill reward amount
* View online players and their coin balances
* Manually add or set coins for any player

Access requires the player's license to be in `Config.AdminLicenses`, or the QBCore `admin` group depending on `Config.LicenseBypassQBPerm`.

### Database

#### Table: player\_coins

This table is shared between moh-zone and moh-shop. Create it once — both resources use `CREATE TABLE IF NOT EXISTS` so there is no conflict.

```
CREATE TABLE IF NOT EXISTS `player_coins` (
  `citizenid`   varchar(50)  NOT NULL,
  `coins`       int(11)      NOT NULL DEFAULT 0,
  `total_kills` int(11)      NOT NULL DEFAULT 0,
  PRIMARY KEY (`citizenid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
```

#### Column Reference

| Column        | Type        | Description                              |
| ------------- | ----------- | ---------------------------------------- |
| `citizenid`   | varchar(50) | QBCore citizen ID — primary key          |
| `coins`       | int         | Current spendable coin balance           |
| `total_kills` | int         | Lifetime kill count used for leaderboard |

#### Custom Column Names

If your database uses different column names, update these in `config.lua`:

```
Config.DBColumns = {
    citizenid   = 'citizenid',
    coins       = 'coins',
    total_kills = 'total_kills'
}
```


---

# 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://mohssins.gitbook.io/mohscriptsdocs/moh-redzone/moh-zone-commands-and-database.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.
