CityRP Documentation Repository

core.plugins.teamname.sv_init

Team Names & SOPs -- server-side state, application points, net handlers. Everything here is session-scoped, in-memory only (no DB table, no migration) -- it resets on server restart/map change, matching how the old /teamname command behaved. See docs/plugins.md and AGENTS.md footgun #16/#22 for the conventions this file follows.

Functions

Servercityrp.teamname.ApplyNameLive(teamIndex)Source ☍

Re-broadcast a team's resolved job title to every currently-connected member.

teamIndex:
    | `TEAM_PRESIDENT`
    | `TEAM_VP`
    | `TEAM_SSL`
    | `TEAM_SS`
    | `TEAM_GAL`
    | `TEAM_GA`
    | `TEAM_POLICECOMMANDER`
    | `TEAM_POLICEOFFICER`
    | `TEAM_FIRECHIEF`
    | `TEAM_RESCUE`
    | `TEAM_FIREMAN`
    | `TEAM_PARAMEDIC`
    | `TEAM_NEXUSDESK`
    | `TEAM_CITIZEN`
    | `TEAM_CHEF`
    | `TEAM_DOCTOR`
    | `TEAM_ARMSDEALER`
    | `TEAM_MECHANIC`
    | `TEAM_TAXI`
    | `TEAM_SECURITY`
    | `TEAM_REBEL`
    | `TEAM_REBELLEADER`
    | `TEAM_ANARCHIST`
    | `TEAM_BLACKMARKETDEALER`
    | `TEAM_MAFIABOSS`
    | `TEAM_MAFIA`
    | `TEAM_AFK`

Parameters

Servercityrp.teamname.BuildOpenMenuPayload(ply) → tableSource ☍

Build the full read/edit snapshot sent to a client opening (or after saving in) the menu.

Parameters

Returns

  1. table
Servercityrp.teamname.GetAllTeams() → table[]Source ☍

Every registered team, sorted by index.

Returns

  1. table[]cityrp.team.stored entries.
Servercityrp.teamname.GetOrCreateOverride(teamIndex) → tableSource ☍

Get (creating if necessary) a team's override record for writing.

teamIndex:
    | `TEAM_PRESIDENT`
    | `TEAM_VP`
    | `TEAM_SSL`
    | `TEAM_SS`
    | `TEAM_GAL`
    | `TEAM_GA`
    | `TEAM_POLICECOMMANDER`
    | `TEAM_POLICEOFFICER`
    | `TEAM_FIRECHIEF`
    | `TEAM_RESCUE`
    | `TEAM_FIREMAN`
    | `TEAM_PARAMEDIC`
    | `TEAM_NEXUSDESK`
    | `TEAM_CITIZEN`
    | `TEAM_CHEF`
    | `TEAM_DOCTOR`
    | `TEAM_ARMSDEALER`
    | `TEAM_MECHANIC`
    | `TEAM_TAXI`
    | `TEAM_SECURITY`
    | `TEAM_REBEL`
    | `TEAM_REBELLEADER`
    | `TEAM_ANARCHIST`
    | `TEAM_BLACKMARKETDEALER`
    | `TEAM_MAFIABOSS`
    | `TEAM_MAFIA`
    | `TEAM_AFK`

Parameters

Returns

  1. table
Servercityrp.teamname.GetOverride(teamIndex) → tableSource ☍

Get a team's override record, or a shared empty table if none exists. Never mutate the result -- use GetOrCreateOverride when writing.

teamIndex:
    | `TEAM_PRESIDENT`
    | `TEAM_VP`
    | `TEAM_SSL`
    | `TEAM_SS`
    | `TEAM_GAL`
    | `TEAM_GA`
    | `TEAM_POLICECOMMANDER`
    | `TEAM_POLICEOFFICER`
    | `TEAM_FIRECHIEF`
    | `TEAM_RESCUE`
    | `TEAM_FIREMAN`
    | `TEAM_PARAMEDIC`
    | `TEAM_NEXUSDESK`
    | `TEAM_CITIZEN`
    | `TEAM_CHEF`
    | `TEAM_DOCTOR`
    | `TEAM_ARMSDEALER`
    | `TEAM_MECHANIC`
    | `TEAM_TAXI`
    | `TEAM_SECURITY`
    | `TEAM_REBEL`
    | `TEAM_REBELLEADER`
    | `TEAM_ANARCHIST`
    | `TEAM_BLACKMARKETDEALER`
    | `TEAM_MAFIABOSS`
    | `TEAM_MAFIA`
    | `TEAM_AFK`

Parameters

Returns

  1. table
Servercityrp.teamname.GetReferenceModel(teamIndex) → string?Source ☍

The model used to determine a team's skin-count for the menu's dropdown, and (absent a model override) the model actually used for pMeta:GetDefaultModel()'s skin math. Assistant+'s model_override, if set, takes priority over the hardcoded first male default model.

teamIndex:
    | `TEAM_PRESIDENT`
    | `TEAM_VP`
    | `TEAM_SSL`
    | `TEAM_SS`
    | `TEAM_GAL`
    | `TEAM_GA`
    | `TEAM_POLICECOMMANDER`
    | `TEAM_POLICEOFFICER`
    | `TEAM_FIRECHIEF`
    | `TEAM_RESCUE`
    | `TEAM_FIREMAN`
    | `TEAM_PARAMEDIC`
    | `TEAM_NEXUSDESK`
    | `TEAM_CITIZEN`
    | `TEAM_CHEF`
    | `TEAM_DOCTOR`
    | `TEAM_ARMSDEALER`
    | `TEAM_MECHANIC`
    | `TEAM_TAXI`
    | `TEAM_SECURITY`
    | `TEAM_REBEL`
    | `TEAM_REBELLEADER`
    | `TEAM_ANARCHIST`
    | `TEAM_BLACKMARKETDEALER`
    | `TEAM_MAFIABOSS`
    | `TEAM_MAFIA`
    | `TEAM_AFK`

Parameters

Returns

  1. string?
Servercityrp.teamname.GetSkinCount(modelPath) → integerSource ☍

@return skinCount — At least 1.

Parameters

  • modelPathstring?

Returns

  1. integerAt least 1.
Servercityrp.teamname.GiveExtraWeapons(ply, teamIndex)Source ☍

Give a player their team's Assistant+-configured extra weapons; ammo reserve is only force-set the first time, so repeat calls don't clobber a scaled locker grant.

teamIndex:
    | `TEAM_PRESIDENT`
    | `TEAM_VP`
    | `TEAM_SSL`
    | `TEAM_SS`
    | `TEAM_GAL`
    | `TEAM_GA`
    | `TEAM_POLICECOMMANDER`
    | `TEAM_POLICEOFFICER`
    | `TEAM_FIRECHIEF`
    | `TEAM_RESCUE`
    | `TEAM_FIREMAN`
    | `TEAM_PARAMEDIC`
    | `TEAM_NEXUSDESK`
    | `TEAM_CITIZEN`
    | `TEAM_CHEF`
    | `TEAM_DOCTOR`
    | `TEAM_ARMSDEALER`
    | `TEAM_MECHANIC`
    | `TEAM_TAXI`
    | `TEAM_SECURITY`
    | `TEAM_REBEL`
    | `TEAM_REBELLEADER`
    | `TEAM_ANARCHIST`
    | `TEAM_BLACKMARKETDEALER`
    | `TEAM_MAFIABOSS`
    | `TEAM_MAFIA`
    | `TEAM_AFK`

Parameters

Servercityrp.teamname.HasModelOverride(teamIndex) → booleanSource ☍

Whether a team has one or more Assistant+ default models configured.

teamIndex:
    | `TEAM_PRESIDENT`
    | `TEAM_VP`
    | `TEAM_SSL`
    | `TEAM_SS`
    | `TEAM_GAL`
    | `TEAM_GA`
    | `TEAM_POLICECOMMANDER`
    | `TEAM_POLICEOFFICER`
    | `TEAM_FIRECHIEF`
    | `TEAM_RESCUE`
    | `TEAM_FIREMAN`
    | `TEAM_PARAMEDIC`
    | `TEAM_NEXUSDESK`
    | `TEAM_CITIZEN`
    | `TEAM_CHEF`
    | `TEAM_DOCTOR`
    | `TEAM_ARMSDEALER`
    | `TEAM_MECHANIC`
    | `TEAM_TAXI`
    | `TEAM_SECURITY`
    | `TEAM_REBEL`
    | `TEAM_REBELLEADER`
    | `TEAM_ANARCHIST`
    | `TEAM_BLACKMARKETDEALER`
    | `TEAM_MAFIABOSS`
    | `TEAM_MAFIA`
    | `TEAM_AFK`

Parameters

Returns

  1. boolean
Servercityrp.teamname.NotifyGroupSopChanged(group, excludePly)Source ☍

Notify every player currently playing a leader or member job in a Job Group that its SOPs changed, prompting them to check /sop -- excludes the player who made the change, if any.

Parameters

  • grouptable
  • excludePlyPlayer?
Servercityrp.teamname.PickOverrideModel(teamIndex) → string?Source ☍

Pick this spawn's model from a team's Assistant+ default-model list (one entry picked at random when more than one is configured), or nil if none is set.

teamIndex:
    | `TEAM_PRESIDENT`
    | `TEAM_VP`
    | `TEAM_SSL`
    | `TEAM_SS`
    | `TEAM_GAL`
    | `TEAM_GA`
    | `TEAM_POLICECOMMANDER`
    | `TEAM_POLICEOFFICER`
    | `TEAM_FIRECHIEF`
    | `TEAM_RESCUE`
    | `TEAM_FIREMAN`
    | `TEAM_PARAMEDIC`
    | `TEAM_NEXUSDESK`
    | `TEAM_CITIZEN`
    | `TEAM_CHEF`
    | `TEAM_DOCTOR`
    | `TEAM_ARMSDEALER`
    | `TEAM_MECHANIC`
    | `TEAM_TAXI`
    | `TEAM_SECURITY`
    | `TEAM_REBEL`
    | `TEAM_REBELLEADER`
    | `TEAM_ANARCHIST`
    | `TEAM_BLACKMARKETDEALER`
    | `TEAM_MAFIABOSS`
    | `TEAM_MAFIA`
    | `TEAM_AFK`

Parameters

Returns

  1. string?
Servercityrp.teamname.ResetAllJobs()Source ☍

Reset every job in the gamemode.

Servercityrp.teamname.ResetGroupSergeantTier(groupId)Source ☍

Clear a Job Group's Sergeant-tier data (SOP, livery, unlocked members' name/skin) to hardcoded defaults, on the "Reset this group" button and on a leadership handoff (sv_team.lua); Assistant+-locked members are left untouched.

Parameters

  • groupIdstring
Servercityrp.teamname.ResetJob(teamIndex)Source ☍

Fully reset one job's override record (both tiers) and clear its Assistant+ lock.

teamIndex:
    | `TEAM_PRESIDENT`
    | `TEAM_VP`
    | `TEAM_SSL`
    | `TEAM_SS`
    | `TEAM_GAL`
    | `TEAM_GA`
    | `TEAM_POLICECOMMANDER`
    | `TEAM_POLICEOFFICER`
    | `TEAM_FIRECHIEF`
    | `TEAM_RESCUE`
    | `TEAM_FIREMAN`
    | `TEAM_PARAMEDIC`
    | `TEAM_NEXUSDESK`
    | `TEAM_CITIZEN`
    | `TEAM_CHEF`
    | `TEAM_DOCTOR`
    | `TEAM_ARMSDEALER`
    | `TEAM_MECHANIC`
    | `TEAM_TAXI`
    | `TEAM_SECURITY`
    | `TEAM_REBEL`
    | `TEAM_REBELLEADER`
    | `TEAM_ANARCHIST`
    | `TEAM_BLACKMARKETDEALER`
    | `TEAM_MAFIABOSS`
    | `TEAM_MAFIA`
    | `TEAM_AFK`

Parameters

Servercityrp.teamname.ResolveJobName(teamIndex, ply) → stringSource ☍

Resolve a team's currently-effective job title (override or hardcoded), with %mid substituted.

teamIndex:
    | `TEAM_PRESIDENT`
    | `TEAM_VP`
    | `TEAM_SSL`
    | `TEAM_SS`
    | `TEAM_GAL`
    | `TEAM_GA`
    | `TEAM_POLICECOMMANDER`
    | `TEAM_POLICEOFFICER`
    | `TEAM_FIRECHIEF`
    | `TEAM_RESCUE`
    | `TEAM_FIREMAN`
    | `TEAM_PARAMEDIC`
    | `TEAM_NEXUSDESK`
    | `TEAM_CITIZEN`
    | `TEAM_CHEF`
    | `TEAM_DOCTOR`
    | `TEAM_ARMSDEALER`
    | `TEAM_MECHANIC`
    | `TEAM_TAXI`
    | `TEAM_SECURITY`
    | `TEAM_REBEL`
    | `TEAM_REBELLEADER`
    | `TEAM_ANARCHIST`
    | `TEAM_BLACKMARKETDEALER`
    | `TEAM_MAFIABOSS`
    | `TEAM_MAFIA`
    | `TEAM_AFK`

Parameters

Returns

  1. string
Servercityrp.teamname.SendResult(ply, ok, message)Source ☍

Parameters

  • plyPlayer
  • okboolean
  • messagestring
Servercityrp.teamname.SendSopDisplay(ply, force)Source ☍

Show a player their Job Group's read-only SOP display: /sop always shows it (force = true), the automatic respawn check only when it differs from what they've seen this session (force = false).

Parameters

Servercityrp.teamname.ShouldClearDefaultLoadout(teamIndex) → booleanSource ☍

Whether an Assistant+ has configured this job to skip its default kit entirely, in favour of only the loadouts baseline plus GiveExtraWeapons.

teamIndex:
    | `TEAM_PRESIDENT`
    | `TEAM_VP`
    | `TEAM_SSL`
    | `TEAM_SS`
    | `TEAM_GAL`
    | `TEAM_GA`
    | `TEAM_POLICECOMMANDER`
    | `TEAM_POLICEOFFICER`
    | `TEAM_FIRECHIEF`
    | `TEAM_RESCUE`
    | `TEAM_FIREMAN`
    | `TEAM_PARAMEDIC`
    | `TEAM_NEXUSDESK`
    | `TEAM_CITIZEN`
    | `TEAM_CHEF`
    | `TEAM_DOCTOR`
    | `TEAM_ARMSDEALER`
    | `TEAM_MECHANIC`
    | `TEAM_TAXI`
    | `TEAM_SECURITY`
    | `TEAM_REBEL`
    | `TEAM_REBELLEADER`
    | `TEAM_ANARCHIST`
    | `TEAM_BLACKMARKETDEALER`
    | `TEAM_MAFIABOSS`
    | `TEAM_MAFIA`
    | `TEAM_AFK`

Parameters

Returns

  1. boolean

Fields

Servercityrp.teamname.groupsSource ☍

Per-Job-Group override records, keyed by group id.

Servercityrp.teamname.overridesSource ☍

Per-job override records, keyed by TEAM_*. A missing key means "use hardcoded defaults".