CityRP Documentation Repository

cityrp.acommands

Serverside Administration Core Module

Functions

Servercityrp.acommands.AddCommand(cmd, func, args, access, emgr, category, help, tip)Source ☍

Add a command with a ! prefix. Must only be used for admin/staff commands.

Parameters

  • cmdstringCommand name to add (minus prefix).
  • funcfun(ply: Player, ...any):anyFunction to call after access check, or command name to alias.
  • argsnumber?Number of arguments required. Defaults to 1.
  • accessstring?Access tag letter(s) required by the user. Defaults to "b".
  • emgrboolean?Event Manager access bypasses main access. Defaults to false.
  • categorystring?Help/F1 category key (see cityrp.command.categoryAliases).
  • helpstring?Syntax string (e.g. "<player> <reason>").
  • tipstring?Short description shown in the F1 commands menu.
Servercityrp.acommands.Deprecate(cmd, msg)Source ☍

Deprecate an admin command. Shows a warning to the user when the command is used.

Parameters

  • cmdstringCommand to deprecate.
  • msgstring?Additional message to show. If this is a single word, it is treated as a command.
Servercityrp.acommands.HandleCommand(ply, _, args, aStr) → string?Source ☍

Handle a !-prefixed staff command. This is the actual command dispatcher for the privileged (!) command system, bound to the cityrp_admin/ulx console commands. Resolves aliases, checks argument count and access, warns on deprecated commands, then invokes the command's callback. suppress default console command output; nil if args was empty.

Parameters

  • plyPlayerThe player who called the command.
  • _stringUnused.
  • argsstring[]Tabulated list of arguments.
  • aStrstringA string containing all the arguments.

Returns

  1. string?An empty string when the command was handled (valid or not) so as to
Servercityrp.acommands.luarun(ply, _, _, code)Source ☍

Runs arbitrary Lua code, restricted to the SteamIDs in access_luarun.

Parameters

  • plyPlayerThe player running the code (or CONSOLE).
  • _anyUnused.
  • _any
  • codestringThe Lua code to run. A leading = runs it as an expression and prints/chats the result.
Servercityrp.acommands.parse(str) → string, string[], stringSource ☍

Parse a !-prefixed string into a command and a table of arguments, respecting quoting rules.

Parameters

  • strstringInput string to parse, including the leading !.

Returns

  1. 1stringThe command name parsed from the string.
  2. 2string[]Arguments in table form.
  3. 3stringArguments in string form (for logging).
Servercityrp.acommands.ReasonSyntax() → stringSource ☍

The <reason> fragment of a command's syntax string, bracketed to match the realm.

Returns

  1. string"[reason]" where a reason is optional, "<reason>" otherwise.
Servercityrp.acommands.ResolveReason(reason) → string?Source ☍

Resolve the reason a command was given into the one it should act on.

Parameters

  • reasonstring?The reason as typed, if any.

Returns

  1. string?The reason to use, or nil when one is required here and none was given.

Tables

Serveraccess_luarunSource ☍
Servercityrp.acommandsSource ☍
Servercityrp.acommands.aliasesSource ☍
Servercityrp.acommands.commandsSource ☍
Servercityrp.acommands.deprecatedSource ☍

Fields

Servercityrp.acommands.defaultReasonSource ☍
Servercityrp.acommands.reasonOptionalSource ☍