# Commands (/docs/es_extended/commands)

es_extended registers a set of chat commands for staff and players. Admin commands handle teleporting, money, items, jobs and groups. A few player commands show information about your character. Who may run each command is set in `Config.CommandPermissions`, and every command is registered through [`ESX.RegisterCommand`](/docs/es_extended/server/functions#registercommand).

## Overview [#overview]

| Fact | Value |
| --- | --- |
| Defined in | `es_extended/server/modules/commands/registrations/*.lua` |
| Permissions | `Config.CommandPermissions` in [shared/config/main.lua](/docs/es_extended/config#commandpermissions) |
| Default admin groups | `owner`, `admin` |
| Player target | Server ID, or `me` for yourself |
| Logging | Most admin commands log to the `UserActions` webhook when `Config.AdminLogging = true` |

## How permissions work [#how-permissions-work]

When a command is registered, ESX runs `add_ace group.<group> command.<name> allow` for every group in its `Config.CommandPermissions` entry. Every loaded player gets the principal `identifier.<license>` → `group.<their group>`, so a player in group `admin` may run all commands that list `admin`.

```lua title="shared/config/main.lua"
Config.CommandPermissions = {
    ["car"] = { "owner", "admin", "mod" }, -- let the "mod" group spawn cars
    ["clear"] = { "user", "admin", "owner" },
    -- ...
}
```

<Callout type="warn">
A command whose key is missing from `Config.CommandPermissions` falls back to `admin` only and prints a warning. Aliases share the permission of the main name, for example `/tp` uses the `setcoords` entry.
</Callout>

Arguments marked "player" accept a server ID of an online player or `me`. When an argument has the wrong type, ESX shows an error notification (or prints it in the console) and does not run the command.

## Player commands [#player-commands]

Default permission: `user`, `admin`, `owner`.

| Command | Aliases | Arguments | Console | What it does |
| --- | --- | --- | --- | --- |
| `/clear` | `/cls` | none | No | Clears your own chat. |
| `/group` | | none | No | Prints your name and group to the **server console**. |
| `/job` | | none | No | Prints your job name, grade label and duty state to the server console. |
| `/info` | | none | No | Prints your server ID, name, group and job name to the server console. |
| `/playtime` | | none | No | Prints the total playtime of your character in days, hours and minutes to the server console. |

## Teleport and movement [#teleport-and-movement]

Default permission: `owner`, `admin`.

| Command | Aliases | Arguments | Console | What it does |
| --- | --- | --- | --- | --- |
| `/setcoords` | `/tp` | `x` `y` `z` (coordinates) | No | Teleports you to the coordinates. Commas are ignored, so `/tp 215.7, -810.1, 30.7` works. |
| `/tpm` | | none | No | Teleports you to your map waypoint. |
| `/goto` | | `playerId` (player) | No | Teleports you to the player and moves you into their routing bucket. |
| `/bring` | | `playerId` (player) | No | Teleports the player to you and moves them into your routing bucket. |
| `/noclip` | | none | No | Toggles noclip for yourself. |
| `/coords` | | none | No | Prints your position as `vector3` and `vector4` to the server console. |
| `/setdim` | `/setbucket` | `playerId` (player), `dimension` (number) | Yes | Sets the player's routing bucket. Bucket `0` is the default world. |

```txt
/setcoords -1037.5 -2737.6 20.2
/goto 12
/setbucket me 5
```

## Player control [#player-control]

| Command | Arguments | Console | What it does |
| --- | --- | --- | --- |
| `/kill` | `playerId` (player) | Yes | Kills the player. |
| `/freeze` | `playerId` (player) | Yes | Freezes the player in place. |
| `/unfreeze` | `playerId` (player) | Yes | Unfreezes the player. |
| `/setjob` | `playerId` (player), `job` (string), `grade` (number) | Yes | Sets job and grade. Fails with an error if the job or grade does not exist. Duty uses `Config.DefaultJobDuty`. |
| `/setgroup` | `playerId` (player), `group` (string) | Yes | Sets the permission group. `superadmin` is changed to `admin`. |
| `/save` | `playerId` (player) | Yes | Saves the player to the database now. |
| `/saveall` | none | Yes | Saves all online players. |
| `/players` | none | Yes | Prints ID, name, group and identifier of every online player to the console. |

```txt
/setjob 4 police 2
/setgroup 4 admin
```

## Money [#money]

| Command | Arguments | Console | What it does |
| --- | --- | --- | --- |
| `/setaccountmoney` | `playerId` (player), `account` (string), `amount` (number) | Yes | Sets the balance of an account (`money`, `bank`, `black_money` or a custom one). |
| `/giveaccountmoney` | `playerId` (player), `account` (string), `amount` (number) | Yes | Adds money to the account. |
| `/removeaccountmoney` | `playerId` (player), `account` (string), `amount` (number) | Yes | Removes money from the account. The balance never goes below `0`. |

```txt
/giveaccountmoney 4 bank 25000
/setaccountmoney me money 0
```

<Callout type="info">
Use positive amounts. `0` or negative values make the underlying xPlayer method throw an error in the server console. See [xPlayer money functions](/docs/es_extended/server/xplayer#money-and-accounts).
</Callout>

## Items and weapons [#items-and-weapons]

These commands only exist with the default ESX inventory. With ox_inventory they are not registered.

| Command | Arguments | Console | What it does |
| --- | --- | --- | --- |
| `/giveitem` | `playerId` (player), `item` (item), `count` (number above 0) | Yes | Adds items. Does not check the weight limit. |
| `/giveweapon` | `playerId` (player), `weapon` (weapon), `ammo` (number) | Yes | Gives a weapon. Fails if the player already has it. |
| `/giveammo` | `playerId` (player), `weapon` (weapon), `ammo` (number above 0) | Yes | Adds ammo to a weapon the player has. |
| `/giveweaponcomponent` | `playerId` (player), `weaponName` (weapon), `componentName` (string) | Yes | Attaches a component. Uses ESX component names such as `suppressor` or `clip_extended`. |
| `/clearinventory` | `playerId` (player) | Yes | Removes all items. Fires `esx:playerInventoryCleared`. |
| `/clearloadout` | `playerId` (player) | Yes | Removes all weapons. Fires `esx:playerLoadoutCleared`. |
| `/refreshitems` | none | Yes | Reloads the `items` table and reports how many items were loaded. |

```txt
/giveitem me bread 5
/giveweapon 4 weapon_pistol 120
/giveweaponcomponent 4 weapon_pistol flashlight
```

Weapon names are not case-sensitive in commands. Component names come from [`Config.Weapons`](/docs/es_extended/config/weapons).

## Vehicles [#vehicles]

| Command | Aliases | Arguments | Console | What it does |
| --- | --- | --- | --- | --- |
| `/car` | | `car` (model, optional) | No | Deletes the vehicle you sit in, spawns the model (default `adder`) server-side and puts you in the driver seat. |
| `/cardel` | `/dv` | `radius` (number, optional) | No | Deletes the vehicle you are in and every vehicle within `radius` (default `5`). |
| `/fix` | `/repair` | `playerId` (player) | Yes | Repairs the vehicle the player is driving. The target must be in the driver seat. Use `/fix me` for yourself. |

## Server and chat [#server-and-chat]

| Command | Aliases | Arguments | Console | What it does |
| --- | --- | --- | --- | --- |
| `/clearall` | `/clsall` | none | Yes | Clears the chat for every player. |
| `/refreshjobs` | | none | Yes | Reloads all jobs and grades from the database. |

## Console-only commands [#console-only-commands]

These are plain FiveM commands that only work in the server console.

| Command | What it does |
| --- | --- |
| `clearvehicletypes` | Clears the cached vehicle types used by [`ESX.GetVehicleType`](/docs/es_extended/server/functions#getvehicletype). |
| `resetmigrations` | Marks all ESX database migrations as not run, so they run again on the next start. |

## Add your own command [#add-your-own-command]

Use [`ESX.RegisterCommand`](/docs/es_extended/server/functions#registercommand). It handles permissions, argument parsing and chat suggestions:

```lua title="server/commands.lua"
ESX.RegisterCommand("heal", { "admin", "owner" }, function(xPlayer, args, showError)
    local target = args.playerId
    target.triggerEvent("myadmin:client:heal")
    showError(("Healed %s"):format(target.getName()))
end, true, {
    help = "Heal a player",
    validate = true,
    arguments = {
        { name = "playerId", help = "Player ID or me", type = "player" },
    },
})
```

Use a table for the group to keep it in line with `Config.CommandPermissions`. If you register a name that already exists (for example `car`), your handler replaces the built-in one.

## Common issues [#common-issues]

- **"Command Cannot be executed from console"**: the command needs a player (for example `/car`, `/tp`, `/noclip`).
- **Nothing happens for players in a custom group**: add the group to the command in `Config.CommandPermissions` and restart es_extended.
- **`/giveweapon` errors with an invalid name**: the weapon must exist in `Config.Weapons`. An unknown name fails the internal lookup.
- **`/tpm` or `/noclip` do nothing for a custom staff group**: besides the command permission, the client asks the `esx:isUserAdmin` callback. That only passes for players with the ACE `command` or a group in `Config.AdminGroups`.
- **Everyone is admin on a local test server**: with `sv_lan "true"`, `xPlayer.isAdmin()` returns `true` for every player.

## Related [#related]

- [Admin permissions guide](/docs/guides/admin-permissions)
- [Main config](/docs/es_extended/config)
- [Server functions](/docs/es_extended/server/functions)
- [xPlayer](/docs/es_extended/server/xplayer)
