Module cityrp.acommands

Serverside Administration Core Module

Module Overview

Functions

cityrp.acommands.AddCommand(cmd, func[, args=1[, access=b[, emgr=false]]]) Add a command with a ! prefix.
cityrp.acommands.Deprecate(cmd[, msg]) Deprecate an admin command.
cityrp.acommands.HandleCommand(ply, _, args, aStr) Handle a cityrp_admin console command.
cityrp.acommands.luarun(ply, _, code) The callback to allow lua to be ran.
cityrp.acommands.parse(str) Parse a string into a command and a table of arguments, respecting quoting rules.
cityrp.acommands.getRankSteamID(steamid) Non-functional.
cityrp.acommands.precacheadmins() Prefill the admin / moderator cache, for fakename / hidden operations.
cityrp.acommands.isadmin(sid) Get an administrator's registered name from their Steam ID.
cityrp.acommands.ismoderator(sid) Get a moderator's registered name from their Steam ID.
cityrp.acommands.GetPlayerByName(name) Get a player by their Steam Name or UserID.
cityrp.acommands.GetPlayerBySteamID(steamid) Get a player by their SteamID
cityrp.acommands.adminHelp(ply, text) Send a message to moderator chat.
cityrp.acommands.adminChat(ply, text) Send a message to admin chat.
cityrp.acommands.adminOOCChat(ply, text) Sends a message to OOC, using the player's registered name if undercover.
cityrp.acommands.getModerators() Get a table of moderators.
cityrp.acommands.getAdmins() Get a table of administrators.
cityrp.acommands.chatcheck() Recall latest cross-server messages.
cityrp.acommands.popup(ply, text, tArg) Popup a message on a player's screen.
cityrp.acommands.FindPosition(ply) Find a position around an entity to be teleported to.
cityrp.acommands.GetPlayerObject(ply, searchTerm) Get a player by the given search-term.
cityrp.acommands.GetPlayerObjectSilent(ply, searchTerm) Get a player by the given search-term.
cityrp.acommands.GetTPPos(ply, from, to) Function to get the "landing" position when TPing from point to point.
cityrp.acommands.ProcessTPRestrictions(ply, ent) Function to process teleport restrictions.
cityrp.acommands.TPUser(ply, pos) Teleport a user
cityrp.acommands.phase(ply) Phase a player.
cityrp.acommands.unphase(ply) Unphase a player.
cityrp.acommands.SetRank(ply, rank) Set a player's rank, checking if the rank is a real rank.
PLUGIN.playerLoadout(ply) Called to set a player's physgun color.
PLUGIN.permaHC(ply) Called on data load to set a player's hidden commands.
cityrp.acommands.respond(ply, targ, msg, ...) Send an administrative response to a player.
cityrp.acommands.icIssue(ply, targ, msg, ...) Send an "IC Issue" response to a player.
cityrp.acommands.helpreply(ply, targ, msg, ...) Send a help response to a player.

Tables

console Console Pseudoplayer Definition.

Functions

cityrp.acommands.AddCommand(cmd, func[, args=1[, access=b[, emgr=false]]])
Add a command with a ! prefix. Used be only used for admin commands.

Parameters:

  • cmd string Command Name to add (minus prefix).
  • func func Function to call after access check OR Command Name to copy.
  • args number OPTIONAL: Number of arguments. (default 1)
  • access string Access tag letter(s) required by the user. (default b)
  • emgr bool OPTIONAL: Event Manager access bypasses main access. (default false)
cityrp.acommands.Deprecate(cmd[, msg])
Deprecate an admin command. This shows a warning to the user when used.

Parameters:

  • cmd string Command to deprecated
  • msg string Additional message to show. If this is a single word, this is assumed as a command. (optional)
cityrp.acommands.HandleCommand(ply, _, args, aStr)
Handle a cityrp_admin console command. Automatically called by the server when a console command is sent.

Parameters:

  • ply The player who called the command.
  • _ Unused.
  • args Tabulated list of arguments.
  • aStr A string containing all the arguments.
cityrp.acommands.luarun(ply, _, code)
The callback to allow lua to be ran.

Parameters:

  • ply The player running lua.
  • _ unused.
  • code The code string to be ran.
cityrp.acommands.parse(str)
Parse a string into a command and a table of arguments, respecting quoting rules.

Parameters:

  • str string Input string to parse.

Returns:

  1. string Command from the parsed string.
  2. table Arguments in table form.
  3. string Arguments in string form (for logging).
cityrp.acommands.getRankSteamID(steamid)
Non-functional.

Parameters:

  • steamid
cityrp.acommands.precacheadmins()
Prefill the admin / moderator cache, for fakename / hidden operations. Automatically called during bootstrap, no need to call again.
cityrp.acommands.isadmin(sid)
Get an administrator's registered name from their Steam ID.

Parameters:

  • sid SteamID to check.

Returns:

    [str || nil] Registered name, or nil if not registered.
cityrp.acommands.ismoderator(sid)
Get a moderator's registered name from their Steam ID.

Parameters:

  • sid SteamID to check.

Returns:

    [str || nil] Registered name, or nil if not registered.
cityrp.acommands.GetPlayerByName(name)
Get a player by their Steam Name or UserID.

Parameters:

  • name Name/UserID.

Returns:

    [table || entity || nil] Table of entities if multiple found, entity object if single found, nil if none found.
cityrp.acommands.GetPlayerBySteamID(steamid)
Get a player by their SteamID

Parameters:

  • steamid (Partial) SteamID.

Returns:

    [table || entity] Table of entities if multiple found, entity object if single found, empty table.
cityrp.acommands.adminHelp(ply, text)
Send a message to moderator chat. Also adds the message to cross-server chat.

Parameters:

  • ply Player / Pseudoplayer sending the message.
  • text The message to be sent.
cityrp.acommands.adminChat(ply, text)
Send a message to admin chat. Also adds the message to cross-server chat.

Parameters:

  • ply Player / Pseudoplayer sending the message.
  • text The message to be sent.
cityrp.acommands.adminOOCChat(ply, text)
Sends a message to OOC, using the player's registered name if undercover.

Parameters:

  • ply Player / Pseudoplayer sending the message.
  • text The message to be sent.
cityrp.acommands.getModerators()
Get a table of moderators.

Returns:

    [table] List of player entities.
cityrp.acommands.getAdmins()
Get a table of administrators.

Returns:

    [table] List of player entities.
cityrp.acommands.chatcheck()
Recall latest cross-server messages. Automatically called.
cityrp.acommands.popup(ply, text, tArg)
Popup a message on a player's screen.

Parameters:

  • ply Player The player sending the popup.
  • text string The text for the popup.
  • tArg string or false Player to send to, or false for global.
cityrp.acommands.FindPosition(ply)
Find a position around an entity to be teleported to.

Parameters:

  • ply The entity to be teleported to.

Returns:

    [Vector || False] The position to be placed at, or false if not found.
cityrp.acommands.GetPlayerObject(ply, searchTerm)
Get a player by the given search-term. Automatically notifies the calling player on failure.

Parameters:

  • ply Player Player requesting the player.
  • searchTerm string UserID, Name or SteamID to search for.

Returns:

    optional entity nil on failure, entity on succcess.
cityrp.acommands.GetPlayerObjectSilent(ply, searchTerm)
Get a player by the given search-term. Doesn't notify the player on failure.

Parameters:

  • ply Player requesting the player.
  • searchTerm UserID, Name or SteamID to search for.

Returns:

    [nil || entity] nil on failure, entity on succcess.
cityrp.acommands.GetTPPos(ply, from, to)
Function to get the "landing" position when TPing from point to point.

Parameters:

  • ply The player attempting the TP (who gets error messages).
  • from The entity that is being moved.
  • to The entity being moved to.

Returns:

    [vector || nil] Vector when a position is found, nil on failure.
cityrp.acommands.ProcessTPRestrictions(ply, ent)
Function to process teleport restrictions.

Parameters:

  • ply The player attempting to teleport.
  • ent The entity being teleported to.

Returns:

    [bool] Truthy or Falsy value, depending if the TP is allowed or barred.
cityrp.acommands.TPUser(ply, pos)
Teleport a user

Parameters:

  • ply The player to be teleported.
  • pos The position to teleport them to.
cityrp.acommands.phase(ply)
Phase a player.

Parameters:

  • ply The player to phase.
cityrp.acommands.unphase(ply)
Unphase a player.

Parameters:

  • ply The player to unphase.
cityrp.acommands.SetRank(ply, rank)
Set a player's rank, checking if the rank is a real rank.

Parameters:

  • ply The player to set a rank for.
  • rank The rank to set.
PLUGIN.playerLoadout(ply)
Called to set a player's physgun color.

Parameters:

  • ply The player to set physgun colour for.
PLUGIN.permaHC(ply)
Called on data load to set a player's hidden commands.

Parameters:

  • ply The player to check perma HC.
cityrp.acommands.respond(ply, targ, msg, ...)
Send an administrative response to a player.

Parameters:

  • ply The player sending the message.
  • targ The search param for the player to send a message to.
  • msg The first part of the message to send.
  • ... The remainder of the message.
cityrp.acommands.icIssue(ply, targ, msg, ...)
Send an "IC Issue" response to a player.

Parameters:

  • ply The player sending the message.
  • targ The search param for the player to send a message to.
  • msg The first part of the message to send.
  • ... The remainder of the message.
cityrp.acommands.helpreply(ply, targ, msg, ...)
Send a help response to a player.

Parameters:

  • ply The player sending the message.
  • targ The search param for the player to send a message to.
  • msg The first part of the message to send.
  • ... The remainder of the message.

Tables

console
Console Pseudoplayer Definition. Whilst this table can be used in place of a regular player, it will fail for most regular player operations.

Fields:

  • Name [Metafunction] Returns the fake player's name.
  • IsValid [Metafunction] Proves the validity of the pseduoplayer.
  • SteamID [Metafunction] Returns the pseduoplayer's SteamID.
  • IsAdmin [Metafunction] Returns the pseduoplayer's admin status.
  • IsSuperAdmin [Metafunction] Returns the pseduoplayer's superadmin status.