Page cover

😁Server Exports

These exports are available exclusively on the server-side!

ATTENTION

AllowedByPrevalence

Checks whether a gang meets the minimum required Prevalence Level to perform a specific restricted action.

local allowed = exports["cb-gangsystem"]:AllowedByPrevalence(gangID, action)

Parameters

  • gangID (number): The unique ID of the gang.

  • action (string): The action being checked (e.g., "gift", "drugs", "spray").

Returns

  • true: The gang’s prevalence is equal to or above the required threshold for the action.

  • false: The gang’s prevalence is below the required threshold or the action is not found in the config.

Example


AddEscrowToRivalry

Adds an escrow amount to an active gang rivalry in a specific turf zone. If no active rivalry exists for that gang in the zone, one is created and initialized with a default cost.

Parameters

  • gangID (number): The unique ID of the gang initiating or contributing to the rivalry.

  • zone (string): The turf zone where the rivalry is taking place.

  • escrowedAmount (number): The amount of money (or value) being added to the gang’s escrow in this rivalry.

Example


AddLoyaltyToZone

Increases a gang’s loyalty value in a specific turf zone. If the zone is not already tracked for that gang, it creates a new entry in GlobalState["GangZoneData"].

Parameters

  • gangID (number): The unique ID of the gang controlling the zone.

  • zone (string): The identifier of the turf zone.

  • increaseAmount (number): The amount of loyalty to be added to the zone for the gang.

Example


DecreaseLoyaltyInZone

Decreases the loyalty of a specific gang within a specific turf zone. If loyalty falls to zero or below, the turf is removed from GlobalState and the associated database record is deleted.

Parameters

  • gangID (number): The ID of the gang controlling the zone.

  • zone (string): The name of the turf zone.

  • amount (number): How much loyalty to subtract from the zone.

Behavior When Loyalty Hits Zero

Event
Action Taken

Loyalty drops to 0 or less

Turf is deleted from Database and GlobalState

Loyalty remains above 0

Turf remains with reduced loyalty

Example


IncreasePrevalence

Increases a gang’s prevalence value, which reflects their notoriety and influence in the Gang System. The export also notifies all online gang members of the prevalence change.

Parameters

  • gangID (number): The unique ID of the gang whose prevalence you want to increase.

  • increaseAmount (number): The numeric value to add to the gang’s current prevalence.

Example


DecreasePrevalence

Decreases a gang’s prevalence value, typically in response to negative behavior or penalties (e.g., vendettas, police kills, or administrative actions). The export also notifies all online gang members of the prevalence change.

Parameters

  • gangID (number): The unique identifier for the gang.

  • decreaseAmount (number): The amount by which to reduce the gang’s prevalence.

Example


AddLoyaltyToHomeTurf

Adds loyalty to a gang’s designated home turf. If no Home Turf is declared, loyalty is not added to any turf.

Parameters

  • gangID (number): The unique identifier of the gang.

  • increaseAmount (number): How much loyalty to add.

Example


RemoveLoyaltyFromHomeTurf

Removes loyalty from a gang’s designated home turf. If no Home Turf is declared, loyalty is not removed from any turf.

Parameters

  • gangID (number): The unique identifier of the gang.

  • amount (number): How much loyalty to remove

Example


ChangeHomeTurf

Updates a gang's home turf to a new zone, handling conflicts and notifying online members of the change or if their Home Turf was taken over.

Parameters

  • gangID (number): The ID of the gang declaring a new home turf.

  • zone (string): The zone name being set as the new home turf.

Zone Notification Behavior

Zone Value
Notification Title
Description
Type

None

Turf Removed

Turf has been unset/cleared

warning

Taken

Home Turf Taken

Another gang’s turf was overridden

success

Zone Name

Home Turf Changed

Turf set to the given zone

success

Example


SuccessfulHeist

Increases the prevalence of a gang as a result of a successful heist attempt (such as a store robbery, house robbery, etc.). Developers need to add this export to your heist script(s). It should execute whenever a player performs a successful heist but before they get the loot (i.e. when they complete the hack).

Parameters

  • source (number): The player ID of the person completing the heist

  • heistName (string): The heist, as it appears in Gang System config, that the player completed

Example


Last updated