πServer Exports
These exports are available exclusively on the server-side!
ATTENTION
These server-side exports do not include any built-in security. It's your responsibility to implement proper security measures when using them in your custom resources.
That said, the events and functions within our resource that utilize these exports are secured appropriately.
What do we mean by this?
Here's an example: If you plan to use the IncreasePrevalence export inside one of your Net Events, you should first verify that the player is actually a member of a gang. Then, ensure the player legitimately performed the required action that justifies increasing their prevalence.
This is the kind of validation we're referring to when we say you need to implement your own security.
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
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
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 heistheistName(string): The heist, as it appears in Gang System config, that the player completed
Example
Last updated
