Commands
All built-in ESX Legacy chat and console commands with arguments, aliases and default permissions, plus how to change who can use them and add your own.
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.
Overview
| Fact | Value |
|---|---|
| Defined in | es_extended/server/modules/commands/registrations/*.lua |
| Permissions | Config.CommandPermissions in shared/config/main.lua |
| 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
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.
Config.CommandPermissions = {
["car"] = { "owner", "admin", "mod" }, -- let the "mod" group spawn cars
["clear"] = { "user", "admin", "owner" },
-- ...
}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.
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
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
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. |
/setcoords -1037.5 -2737.6 20.2
/goto 12
/setbucket me 5Player 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. |
/setjob 4 police 2
/setgroup 4 adminMoney
| 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. |
/giveaccountmoney 4 bank 25000
/setaccountmoney me money 0Use positive amounts. 0 or negative values make the underlying xPlayer method throw an error in the server console. See xPlayer money functions.
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. |
/giveitem me bread 5
/giveweapon 4 weapon_pistol 120
/giveweaponcomponent 4 weapon_pistol flashlightWeapon names are not case-sensitive in commands. Component names come from Config.Weapons.
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
| 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
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. |
resetmigrations | Marks all ESX database migrations as not run, so they run again on the next start. |
Add your own command
Use ESX.RegisterCommand. It handles permissions, argument parsing and chat suggestions:
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
- "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.CommandPermissionsand restart es_extended. /giveweaponerrors with an invalid name: the weapon must exist inConfig.Weapons. An unknown name fails the internal lookup./tpmor/noclipdo nothing for a custom staff group: besides the command permission, the client asks theesx:isUserAdmincallback. That only passes for players with the ACEcommandor a group inConfig.AdminGroups.- Everyone is admin on a local test server: with
sv_lan "true",xPlayer.isAdmin()returnstruefor every player.
Related
Frequently asked questions
Independent documentation
Last updated on
PlayerData
What ESX Legacy stores about a character and where to read it. Every field of ESX.PlayerData on the client and the xPlayer object on the server, with types.
Main Config
Every key in es_extended shared/config/main.lua for ESX Legacy 1.16.4 with type, default value and effect. Accounts, spawns, paychecks, permissions and convars.