CityRP Documentation Repository

cityrp.scoreboard

Scoreboard version selection. The server picks which scoreboard every client opens; sv_scoreboard.lua owns the writes and core/cl_scoreboard.lua dispatches on the result. Named for load order: the Register call below needs sh_network.lua first.

Functions

Servercityrp.acommands.scoreboard(ply, version) → boolean?Source ☍

Report or switch the server's scoreboard version.

Parameters

  • plyPlayerThe player running the command.
  • versionstring?The version to switch to. Omitted to report the current one.

Returns

  1. boolean?False when the command was rejected.
Sharedcityrp.scoreboard.CanHide(teamIndex) → booleanSource ☍

Whether a player on this team may hide on the scoreboard.

Parameters

  • teamIndexnumberThe team.

Returns

  1. boolean
Servercityrp.scoreboard.Command(ply, args) → boolean?Source ☍

/scoreboard hidden [title] and /scoreboard reset.

Parameters

  • plyPlayerThe player running the command.
  • argsstring[]The command's arguments.

Returns

  1. boolean?False when the command was rejected.
Servercityrp.scoreboard.ConfiguredDefault() → stringSource ☍

The version this server starts on, from the SCOREBOARD_VERSION environment variable. A missing or unrecognised value falls back to cityrp.scoreboard.DEFAULT_VERSION.

Returns

  1. stringOne of cityrp.scoreboard.VERSIONS.
Sharedcityrp.scoreboard.GetDisguise(target) → number?Source ☍

The team a player's clothing disguises them as, if it isn't their own.

Parameters

Returns

  1. number?
Sharedcityrp.scoreboard.GetTeamRule(teamIndex) → ScoreboardLookRule?Source ☍

The look rule set for a team.

Parameters

  • teamIndexnumberThe team.

Returns

  1. ScoreboardLookRule?
Sharedcityrp.scoreboard.GetTrueJobMarker(target, lookTeam, title) → string?Source ☍

The staff marker for a row whose look or title isn't the player's true job, e.g. "(Rebel: Bob's Shop)".

Parameters

  • targetPlayerThe player the row is for.
  • lookTeamnumberThe team the row shows as.
  • titlestringThe row's title.

Returns

  1. string?Nil when the row already shows the true team and title.
Sharedcityrp.scoreboard.GetVersion() → stringSource ☍

The scoreboard version the server has selected.

Returns

  1. stringOne of cityrp.scoreboard.VERSIONS.
Sharedcityrp.scoreboard.IsBefore(a, b) → booleanSource ☍

Whether one row sorts above another: by look in team registration order, then by rank, then by name. Nothing here reads a true team.

Parameters

  • a{ team: number, rank: number, name: string }
  • b{ team: number, rank: number, name: string }

Returns

  1. boolean
Sharedcityrp.scoreboard.IsVersion(value) → booleanSource ☍

Whether a value names a selectable scoreboard version.

Parameters

  • valueanyThe value to check.

Returns

  1. boolean
Sharedcityrp.scoreboard.ResolveLook(viewer, target) → number, string, boolean, number?Source ☍

A player's look as seen by a viewer. true team: the target themselves, or their faction.

Parameters

  • viewerPlayer?The player looking at the scoreboard.
  • targetPlayerThe player the row is for.

Returns

  1. 1numberThe team the row shows as.
  2. 2stringThe row's title.
  3. 3booleanTrue when the target is hidden or disguised but this viewer sees their
  4. 4number?What everyone else sees, when seen through; the row fades towards it.
Sharedcityrp.scoreboard.SetDisguise(itemID, teamIndex)Source ☍

Makes a clothing item disguise its wearer as a team on the scoreboard.

Parameters

  • itemIDstringThe clothing item.
  • teamIndexnumberThe team its wearer shows as.
Servercityrp.scoreboard.SetHidden(ply, hidden, title)Source ☍

Hides a player on the scoreboard as a Citizen, or shows them as themselves again.

Parameters

  • plyPlayerThe player.
  • hiddenbooleanWhether to hide them.
  • titlestring?The title to show while hidden; "Citizen" when nil or empty.
Sharedcityrp.scoreboard.SetTeamRule(teamIndex, rule)Source ☍

Sets how a team shows on the V2 scoreboard, replacing any rule it already had.

Parameters

Servercityrp.scoreboard.SetVersion(version) → booleanSource ☍

Selects the scoreboard version for every client. Clients pick it up the next time they open it.

Parameters

Returns

  1. booleanFalse, with nothing changed, when version is not a scoreboard version.

Tables

Sharedcityrp.scoreboard.CANNOT_HIDESource ☍

Teams that can never hide, as [team] = true. Filled in beside the team definitions.

Sharedcityrp.scoreboard.VERSIONSSource ☍

Every selectable scoreboard version, in wire order.

Classes

SharedScoreboardLookRuleSource ☍

How a team shows on the V2 scoreboard.

Fields

Sharedcityrp.scoreboardSource ☍
Sharedcityrp.scoreboard.DEFAULT_VERSIONSource ☍

The version used until the server sets one.

Sharedcityrp.scoreboard.disguiseModelsSource ☍
Sharedcityrp.scoreboard.disguisesSource ☍

Clothing that disguises its wearer as another team, as [item id] = team. Filled in beside the team definitions; set through SetDisguise so the model lookup is rebuilt.

Servercityrp.scoreboard.loggerSource ☍

A namespaced, level-filterable logger. Obtain instances via cityrp.logging.GetLogger rather than constructing directly.

Sharedcityrp.scoreboard.MAX_TITLE_LENGTHSource ☍

Longest override title, matching /job.

Sharedcityrp.scoreboard.NETVARSource ☍

The global network var carrying the active version.

Sharedcityrp.scoreboard.rulesSource ☍
SharedScoreboardLookRule.factionSource ☍

A viewer on a team of the same faction sees this team's players as their true team.