CityRP Documentation Repository

cityrp.command

CityRP Commands Library.

Functions

Servercityrp.command.add(command, access, arguments, callback, category, help, tip, emgr)Source ☍

Add a new player command (/ prefix).

Parameters

  • commandstringCommand string to add.
  • accessstringAccess flag.
  • argumentsnumberNumber of arguments to require.
  • callbackfun(ply: Player, arguments: string[])Command callback.
  • categorystring?Category to add the command help under.
  • helpstring?Syntax string (e.g. "<player> <amount>").
  • tipstring?Command description shown in the F1 menu.
  • emgrboolean?Event Manager bypass.
Servercityrp.command.consoleCommand(player, command, arguments) → nilSource ☍

Handle a /-prefixed player command. This is the actual command dispatcher: it is bound to the cityrp console command, and is reached both by ConCommand("cityrp <cmd> <args>") calls and (per footgun #13 in AGENTS.md) by GM:PlayerSay re-quoting a say /x chat message and forwarding it here. Resolves aliases, checks access, runs PlayerCanUseCommand, validates argument count, warns on deprecated commands, then invokes the command's callback and logs the usage.

Parameters

  • playerPlayerPlayer running the command.
  • commandstringThe command name being run (without the / prefix).
  • argumentsstring[]Command arguments.

Returns

  1. nil
Servercityrp.command.deprecate(cmd, msg)Source ☍

Deprecate a command. Shows a warning to the player when the command is used. If msg is a single word (optionally prefixed with / or !), it is treated as a replacement command name.

Parameters

  • cmdstringCommand to deprecate.
  • msgstring?Additional message to show, or a replacement command name.
Servercityrp.command.notifyAcommandRedirect(ply, oldCmd, acommandName)Source ☍

Shared notification for staff commands that moved from / to !.

Parameters

  • plyPlayerThe player who typed the old command.
  • oldCmdstringThe old / command name.
  • acommandNamestringThe ! command to use instead.
Servercityrp.command.parseBoolean(ply, arg, message) → boolean?Source ☍

Parse a boolean command argument and notify on failure.

Parameters

  • plyPlayerThe player to notify.
  • argstringRaw argument string.
  • messagestring?Custom error message.

Returns

  1. boolean?boolean, or nil on failure.
Servercityrp.command.parseMoney(ply, arg, opts) → number?Source ☍

Parse a money amount argument and notify on failure. Money amounts are always integers; fractional values are rejected.

Parameters

  • plyPlayerThe player to notify.
  • argstringRaw argument string.
  • opts{ allowZero: boolean?, allowNegative: boolean? }?Options: allowZero, allowNegative.

Returns

  1. number?amount, or nil on failure.
Servercityrp.command.redirectToAcommand(oldCmd, acommandName)Source ☍

Register a non-executing / stub that tells the player to use an acommand instead. Used for hard cutover when a staff tool moves from / to !. Redirects are excluded from F1.

Parameters

  • oldCmdstringThe old / command name (without prefix).
  • acommandNamestring?The ! command to suggest (defaults to oldCmd).

Tables

Servercityrp.commandSource ☍
Servercityrp.command.aliasesSource ☍
Servercityrp.command.categoryAliasesSource ☍
Servercityrp.command.deprecatedSource ☍
Servercityrp.command.storedSource ☍