CityRP Documentation Repository

cityrp.team

Team / Job handling.

Functions

Sharedcityrp.team.add(name, color, males, females, description, salary, limitmin, oneper, access, blacklist, canmake, radio) → numberSource ☍

Add a new team. This is the main function which creates a team, including calling team.SetUp, along with all other data.

Parameters

  • namestringThe name of the job.
  • colorColorThe team colour.
  • males(string|string[])?Male job model(s). Wrapped in a table if a single string is given. Defaults to the configured male citizen models.
  • females(string|string[])?Female job model(s). Wrapped in a table if a single string is given. Defaults to the configured female citizen models.
  • descriptionstring?The job description. Defaults to "N/A.".
  • salarynumberThe default salary.
  • limitminnumber?The minimum number of slots. Defaults to the server's max players.
  • onepernumber?The number of players on the server required to add an additional slot. Defaults to 0.
  • accessstring?The access required to join the job. Defaults to "b".
  • blacklistboolean?Stored on the team's data; not otherwise read by this library.
  • canmakestring[]?The list of item categories that can be made in that job. Defaults to cityrp.team.buildCanMake().
  • radioboolean?If the team has a radio. Defaults to false.

Returns

  1. numberThe new team index.
Sharedcityrp.team.buildCanMake(add, remove) → string[]Source ☍

Build a canmake category list for a job, starting from cityrp.team.defaultCanMake and cityrp.team.defaultSubCategories.

Parameters

  • addstring[]?Extra categories only this job should be able to purchase/manufacture.
  • removestring[]?Default (or default sub-) categories this job should NOT have access to.

Returns

  1. string[]The resulting list of categories to pass as canmake to cityrp.team.add.
Servercityrp.team.canChange(ply, teamName) → boolean, string|tableSource ☍

Check if a player can change into a job.

Parameters

  • plyPlayerThe player to change.
  • teamNamestring|numberThe name or ID of the team they're attempting to change into.

Returns

  1. 1booleanIf the change is allowed.
  2. 2string|tableIf change disallowed, string reason. If allowed, then team data table.
Sharedcityrp.team.countLawEnforcement() → integerSource ☍

Count the number of players currently in a Law Enforcement team group.

Returns

  1. integerThe number of Law Enforcement players.
Sharedcityrp.team.get(name) → table|false|nilSource ☍

Get a team from a name or index.

team:
    | false

Parameters

  • namestring|numberThe name or index of the team.

Returns

  1. table|false|nilThe team table, false if no name was given, or nil if not found.
Sharedcityrp.team.getGovernment() → Player[]Source ☍

Get players in the Government team group.

Returns

  1. Player[]List of players.
Sharedcityrp.team.getLawenforcement() → Player[]Source ☍

Get players in the Law Enforcement team group.

Returns

  1. Player[]List of players.
Sharedcityrp.team.getlimit(key) → integerSource ☍

Get the current team limit.

Parameters

  • keystring|numberThe name or index of the team to query.

Returns

  1. integerThe team limit.
Sharedcityrp.team.getMafia() → Player[]Source ☍

Get players in the Mafia team group.

Returns

  1. Player[]List of players.
Sharedcityrp.team.getPresident() → Player[]Source ☍

Get players in the Presidential team group.

Returns

  1. Player[]List of players.
Sharedcityrp.team.getPresidentAdministration() → Player[]Source ☍

Get players in the Presidential Administration team group.

Returns

  1. Player[]List of players.
Sharedcityrp.team.getRebels() → Player[]Source ☍

Get players in the Rebel (anarchist) team group.

Returns

  1. Player[]List of players.
Sharedcityrp.team.getRescue() → Player[]Source ☍

Get players in the Rescue (FD) team group.

Returns

  1. Player[]List of players.
Servercityrp.team.make(ply, name) → boolean, stringSource ☍

Make a player a member of a team.

Parameters

  • plyPlayerThe player attempting to change.
  • namestring|numberThe name or ID of the team the player wishes to change to.

Returns

  1. 1booleanIf the change was allowed.
  2. 2stringDenial reason.
Servercityrp.team.makeSilent(ply, name) → boolean, stringSource ☍

Silently change a player's team (no respawns). See: cityrp.team.make

Parameters

  • plyPlayerThe player attempting to change.
  • namestring|numberThe name or ID of the team the player wishes to change to.

Returns

  1. 1booleanIf the change was allowed.
  2. 2stringDenial reason.
Sharedcityrp.team.query(name, key, default) → anySource ☍

Query a variable from a team.

Parameters

  • namestring|numberThe name or index of the team to query.
  • keystringThe name of the variable to query.
  • defaultanyThe default value to return if the team or key is not found.

Returns

  1. anyThe queried value, or default.

Tables

Sharedcityrp.teamSource ☍
Sharedcityrp.team.defaultCanMakeSource ☍

The list of (top-level) item categories every job can purchase and manufacture from by default. Jobs that need extra restricted categories (or need to lose one of these) should use cityrp.team.buildCanMake rather than writing out a full category list by hand.

Sharedcityrp.team.defaultSubCategoriesSource ☍

The list of sub-categories (e.g. "Parent - Sub" entries) every job gets by default, kept separate from cityrp.team.defaultCanMake so sub-categories can be added/removed here without touching the top-level list.

Sharedcityrp.team.storedSource ☍

Fields

Sharedcityrp.team.indexSource ☍