cityrp.limits
Per-player spawn and ownership limit overrides.
Each type is a cityrp.layers stack published to a cityrp.network var; every write lives in
sv_playerlimits.lua. Named for load order: the Register calls below need sh_network.lua first.
- Sharedcityrp.limits:CanSet(ply, name) → booleanSource ☍
-
Check whether a player is allowed to adjust a limit type on someone else. Moderator S2 and above get every type; Assistants and Event Managers only the
teamones. Server-side only:HasAccessis accurate on the client forLocalPlayeralone.Parameters
- plyPlayerThe player running the command.
- namestring|LIMIT_TYPEThe limit type, or its id/alias.
Returns
- booleanTrue if they may adjust this type.
- Sharedcityrp.limits:CanSpawn(ply, name, counter) → boolean, stringSource ☍
-
Check whether a player is under their limit of a given type, by its spawn counter.
Parameters
- plyPlayerThe player to check.
- namestring|LIMIT_TYPEThe limit type, or its id/alias.
- counterstring?The
Player:GetCountcounter to compare against. Defaults to the type's id.
Returns
- 1booleanTrue if they are below the limit.
- 2stringThe limit they were checked against, ready to show them.
- Servercityrp.limits:DefineLayer(limit)Source ☍
-
Define a limit type's layer stack, unless it brings its own (props) or already has one: the combine reads the type at call time, so a re-registration needs no new stack.
Parameters
- limitLIMIT_TYPEThe type to define a stack for.
- Sharedcityrp.limits:Describe(limit, value) → stringSource ☍
-
Describe a limit value the way it should be shown to a player.
Parameters
- limitLIMIT_TYPEThe limit type the value belongs to.
- valuenumberThe value to describe.
Returns
- stringEither "unlimited", or the value with the type's singular/plural name.
- Sharedcityrp.limits:Get(ply, name) → numberSource ☍
-
Get a player's current effective limit of a given type.
Parameters
- plyPlayerThe player to read the limit off.
- namestring|LIMIT_TYPEThe limit type, or its id/alias.
Returns
- numberThe effective limit;
cityrp.limits.UNLIMITEDwhen they have none.
- Sharedcityrp.limits:GetAll() → LIMIT_TYPE[]Source ☍
-
List every registered limit type, sorted by id.
Returns
- LIMIT_TYPE[]Every registered type.
- Sharedcityrp.limits:GetSettable(ply) → LIMIT_TYPE[]Source ☍
-
List the limit types a player is allowed to adjust, sorted by id.
Parameters
- plyPlayerThe player running the command.
Returns
- LIMIT_TYPE[]Every type they may adjust.
- Sharedcityrp.limits:IsUnlimited(ply, name) → booleanSource ☍
-
Check whether a player has been left with no limit of a given type.
Parameters
- plyPlayerThe player to read the limit off.
- namestring|LIMIT_TYPEThe limit type, or its id/alias.
Returns
- booleanTrue if the player may spawn/own as many as they like.
- Sharedcityrp.limits.PlayerCheckLimit(ply, counter) → boolean?Source ☍
-
Apply the
lightlimit to the sandbox light and lamp counters, where the tools actually check. Never lifts a counter above its ownsbox_max*: the two share one limit type, so a light override must not become a lamp allowance.Parameters
- plyPlayerThe player spawning a light or lamp.
- counterstringThe sandbox counter being checked.
Returns
- boolean?True/false to override the sandbox limit, nil to let it decide.
- Servercityrp.limits:RefreshDefaults(ply)Source ☍
-
Recompute every limit's base layer for a player. Call wherever an input to a default changes - rank, REP, membership, playtime, data load. An
!limitoverride sits above the layer this touches, so a refresh never discards one.Parameters
- plyPlayerThe player to recompute.
- Sharedcityrp.limits:Register(id, data) → LIMIT_TYPESource ☍
-
Register an adjustable limit type, and the network var its resolved value is published to.
Parameters
- idstringCanonical id, used as the
!limittype argument. - datatableThe type's definition.
aliasesis consumed here rather than stored on the type.
Returns
- LIMIT_TYPEThe registered type.
- idstringCanonical id, used as the
- Servercityrp.limits:Reset(ply, name) → booleanSource ☍
-
Clear a player's limit override, putting them back on the default for their rank/REP.
Parameters
- plyPlayerThe player to reset.
- namestring|LIMIT_TYPEThe limit type, or its id/alias.
Returns
- booleanFalse if the type isn't registered.
- Sharedcityrp.limits:Resolve(name) → LIMIT_TYPE?Source ☍
-
Resolve a player-supplied type name to its registered limit type.
Parameters
- namestring?The type name or alias to look up. Case insensitive.
Returns
- LIMIT_TYPE?The matching type, or nil if the name isn't a known limit.
- Servercityrp.limits:Set(ply, name, value) → booleanSource ☍
-
Set or clear a player's limit override.
Parameters
- plyPlayerThe player to adjust.
- namestring|LIMIT_TYPEThe limit type, or its id/alias.
- valuenumber?The new limit,
cityrp.limits.UNLIMITEDfor none, or nil to reset to the default.
Returns
- booleanFalse if the type isn't registered.
- Sharedcityrp.limits.LIGHT_COUNTERSSource ☍
-
Sandbox counters a
lightlimit applies to, each with the ConVar sandbox would have capped it by. The light and lamp tools are unlocked together (cityrp.BlockedTools,GM:CanTool), so they are limited together, but they keep their own sbox ceilings.
- Sharedcityrp.limitsSource ☍
- Sharedcityrp.limits.aliasesSource ☍
-
Alias lookup, mapping every accepted spelling (including each id itself) to a canonical id.
- Sharedcityrp.limits.DEFAULT_MAXSource ☍
-
Ceiling for a type that doesn't set its own
max. Nobody needs 200 boomboxes, and the network var's codec is sized off this, so it is a real bound rather than advice. - Sharedcityrp.limits.FULL_ACCESSSource ☍
-
Access flag required to adjust any limit type.
- Sharedcityrp.limits.LAYER_ADMINSource ☍
-
Layer holding the
!limitoverride. Absent unless one has been set. - Sharedcityrp.limits.LAYER_DEFAULTSource ☍
-
Layer holding the base limit for the player's rank/REP/configuration.
- Sharedcityrp.limits.loggerSource ☍
-
A namespaced, level-filterable logger. Obtain instances via cityrp.logging.GetLogger rather than constructing directly.
- Sharedcityrp.limits.TEAM_ACCESSSource ☍
-
Access flag required to adjust the types marked
team(Assistants and Event Managers). - Sharedcityrp.limits.typesSource ☍
-
Registered limit types, keyed by canonical id.
- Sharedcityrp.limits.UNLIMITEDSource ☍
-
Value meaning "no limit at all".
A single adjustable limit.
- SharedLIMIT_TYPE.defaultSource ☍
-
The base value pushed onto the
defaultlayer. Omitted by types whose stack builds its base from several layers of its own. - SharedLIMIT_TYPE.fallbackSource ☍
-
The limit before any layer has resolved, and this var's registered network default.
- SharedLIMIT_TYPE.idSource ☍
-
Canonical id, as registered. This is what
!limittakes as its type argument. - SharedLIMIT_TYPE.layerSource ☍
-
The
cityrp.layersattribute the limit stacks on. - SharedLIMIT_TYPE.maxSource ☍
-
Highest explicit value that may be set, and what the network codec is sized to.
- SharedLIMIT_TYPE.minSource ☍
-
Lowest explicit value that may be set.
- SharedLIMIT_TYPE.nameSource ☍
-
Singular display name.
- SharedLIMIT_TYPE.pluralSource ☍
-
Plural display name.
- SharedLIMIT_TYPE.refreshSource ☍
-
Recomputes this type's base layer(s) instead of the plain
defaultpush. Server only. - SharedLIMIT_TYPE.setSource ☍
-
Writes the
adminoverride instead of the plain layer write. Server only. - SharedLIMIT_TYPE.teamSource ☍
-
Whether Assistants/Event Managers may adjust it, rather than Moderator S2+ only.
- SharedLIMIT_TYPE.varSource ☍
-
The
cityrp.networkvar the resolved limit is published to.