Page cover

✴️Global States

Global States are created or modified on the server and read by the client! We use Global States for most of our Gang Data in Gang System V2

GangData

GlobalState["GangData"] is a globally accessible table that contains information about all gangs currently loaded from the database. Each gang is keyed by its unique gang ID and contains detailed attributes for logic, display, and gameplay mechanics. This data is automatically populated and refreshed when the resource starts!

local gangData = GlobalState["GangData"]

Structure

GlobalState["GangData"] = {
    [gangID] = {
        id = number,                -- Unique ID of the gang
        name = string,              -- Full name of the gang (e.g., "Grim Reapers")
        tag = string,               -- Short tag used to identify the gang (e.g., "TES")
        type = string,              -- Type of gang (e.g., "mob", "crew", "community")
        home_turf = string,         -- Turf zone code that the gang owns (e.g., "MORN")
        last_blueprint = number,    -- Unix timestamp (seconds) of last blueprint event
        last_home_turf = number,    -- Unix timestamp (seconds) of last home turf claim
        last_gift = number,         -- Unix timestamp (seconds) of last gift received
        last_bm_shop = number,      -- Unix timestamp (seconds) of last black market shop use
        color = number,             -- Color ID for UI elements (e.g., map, HUD)
        prevalence = number,        -- Influence value used in turf control logic
        dirty_cash = number,        -- Amount of unlaundered money the gang has
        clean_cash = number,        -- Amount of laundered money the gang has
        penalty = number,           -- Penalty status (used for timeouts or bans from actions)
        last_active = number,       -- Last activity time in milliseconds (epoch)
        created_at = number         -- Gang creation time in milliseconds (epoch)
    },
    ...
}
  • id (number) - Unique ID of the Gang

  • name (string), β€” Full name of the gang (e.g. "Grim Reapers")

Example


GangPermissions

GlobalState["GangPermissions"] is a server-side global table that defines rank-based permissions for each gang. It is structured by gang ID and then by rank index, mapping what actions members of each rank are allowed to perform. This table is populated when the resource starts, which pulls data from the gang_perms SQL table.

Structure

Example


GangMembers

Description

GlobalState["GangMembers"] is a lookup table that maps each gang member (by citizen_id) to their gang ID and rank. This is populated by querying your gang_members SQL table.

Structure

Example


Last updated