> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nexdevelopment.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Usage

> Running peacetime day to day: enabling with a duration and reason, editing restrictions live, and what players see.

## Opening the menu

Run `/ptmenu` in-game. The server checks your admin status **before** the menu opens — non-admins get a "You do not have permission to use this." toast and nothing else. See [Configuration → Admin access](/nex_peacetime/configuration#admin-access) for the ways to qualify.

The menu shows the current state (active or inactive), the player count, the enable/disable flow, and the restriction toggles. Close it with the close button or `Escape`.

## Enabling peacetime

1. Pick a duration — one of the preset chips (`15m`, `30m`, `1h`, `2h`, `∞`) or **Custom**, which takes any number of seconds, minutes, or hours.
2. Optionally type a **Reason**. It's broadcast to every player when peacetime starts and shown on the HUD indicator.
3. Click **Enable peacetime**.

Every player immediately gets a "Peacetime Active" toast, and the HUD indicator appears with a live countdown (or `Indefinite` for the `∞` preset).

## Ending peacetime

* **Manually** — open `/ptmenu` and click **Disable peacetime**.
* **Automatically** — when the chosen duration elapses, the server ends peacetime on its own. The auto-end check runs on the server clock every two seconds, so expiry lands within a couple of seconds of the scheduled time.

Either way, all players get a "Peacetime Ended" toast and the indicator disappears (unless you set `Config.UI.indicator.showWhenDisabled = true`).

## Restrictions

The menu lists seven toggles. Changes **save live** — flip a toggle and it applies to every connected player instantly, whether peacetime is currently active or not (inactive changes take effect the next time peacetime starts).

| Restriction     | What it blocks                                                      |
| --------------- | ------------------------------------------------------------------- |
| Firing          | Shooting any weapon (also disables player firing at the game level) |
| Aiming          | Aiming down sights                                                  |
| Weapon swap     | The weapon wheel and quick weapon-select keys                       |
| Melee           | Melee attacks (punches, kicks, melee weapon swings)                 |
| Vehicle weapons | Firing from or with vehicles, including turrets and drive-bys       |
| Throwables      | Throwing grenades, molotovs, and other projectiles                  |
| Detonation      | Detonating planted explosives                                       |

The exact control IDs behind each category are configurable — see [Configuration → Control groups](/nex_peacetime/configuration#control-groups).

### Quick presets

Three preset buttons apply a full restriction set with one click:

* **Full** — everything blocked.
* **Light** — firing, aiming, vehicle weapons, throwables, and detonation blocked; weapon swap and melee allowed.
* **Off** — nothing blocked.

Presets are defined in `Config.RestrictionPresets`, so you can rename them or add your own.

## What players see

* A toast notification when peacetime starts ("Peacetime Active") and ends ("Peacetime Ended"). The wording lives in `locales/en.json` under `notify`.
* A HUD indicator while peacetime is active, showing the status, a subtitle, the reason (if one was set), and the remaining time. Position and animation come from `Config.UI.indicator`.

Players don't need to do anything — restrictions are enforced automatically on their client while peacetime is active.

## For developers

The server keeps all state in OneSync GlobalState, so other resources can read it directly:

| Key                                 | Value                                                    |
| ----------------------------------- | -------------------------------------------------------- |
| `GlobalState.peacetime`             | `true` while peacetime is active                         |
| `GlobalState.peacetimeRestrictions` | Table of the seven restriction booleans                  |
| `GlobalState.peacetimeStartedAt`    | Server epoch time peacetime started, or `nil`            |
| `GlobalState.peacetimeEndsAt`       | Server epoch time it auto-ends, or `nil` when indefinite |
| `GlobalState.peacetimeReason`       | The broadcast reason string, or `nil`                    |

For example, a robbery script can bail out early with `if GlobalState.peacetime then return end`. The script exposes no exports — GlobalState is the supported read surface.
