cityrp.command
CityRP Commands Library.
- 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 thecityrpconsole command, and is reached both byConCommand("cityrp <cmd> <args>")calls and (per footgun #13 in AGENTS.md) byGM:PlayerSayre-quoting asay /xchat message and forwarding it here. Resolves aliases, checks access, runsPlayerCanUseCommand, 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
- nil
- Servercityrp.command.deprecate(cmd, msg)Source ☍
-
Deprecate a command. Shows a warning to the player when the command is used. If
msgis 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
- 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
- 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).
- oldCmdstringThe old