> ## 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.

# Commands & exports

> Commands & exports — NEX Drugs Creator.

## Chat commands

| Command         | Who     | What it does                                                       |
| --------------- | ------- | ------------------------------------------------------------------ |
| `/drugscreator` | Admins  | Opens the creator panel.                                           |
| `/selldrugs`    | Players | Toggles street selling mode.                                       |
| `/cornersell`   | Players | Toggles corner selling mode.                                       |
| `/trapphone`    | Players | Opens the trap phone (also opened by using the `trap_phone` item). |
| `/pocketcraft`  | Players | Opens the pocket crafting menu.                                    |

Where the names come from:

* `/drugscreator` — `Config.Command` in `config.lua`.
* `/pocketcraft` — `Config.World.PocketCraftCommand` in `config.lua`.
* `/selldrugs`, `/cornersell`, `/trapphone` — defaults from the world settings, renameable live from the panel's **Settings** and config tabs. The trap phone item name (`trap_phone` by default) is editable there too.

## Server exports

```lua theme={null}
exports.nex_drugscreator:UseDrug(source, 'joint')
-- Triggers a configured drug for a player as if they used the item.
-- Returns true when the item is a saved drug, false otherwise.

exports.nex_drugscreator:GiveTerritoryPoints(territoryId, factionName, points)
-- Adds territory-war points to a faction in a territory and syncs all clients.

exports.nex_drugscreator:ResetTerritoryPoints(territoryId)
-- Clears all faction points (and earnings accumulators) for one territory.
```

<Info>
  `UseDrug` still runs the full server-side flow — required-item gate, item removal, anti-spam, and effect application.
</Info>

## Dispatch hook

`Config.PoliceAlert` in `config.lua` is called server-side whenever a sale alerts the police, so you can wire ps-dispatch, cd\_dispatch, qs-dispatch, or anything else:

```lua theme={null}
Config.PoliceAlert = function(source, coords)
    exports['ps-dispatch']:DrugSale(source)
end
```

Independent of the hook, on-duty police (jobs in `Config.PoliceJobs`) always receive the built-in alert blip for `Config.PoliceBlipTime` seconds (default `120`).
