Skip to content

Exports & API

Core Gangs exposes exports for integration with other scripts.

Client Exports

clientexports['core_gangs']:getZoneFromPlayer()

Returns the zone ID the player is currently standing in.

Returns: number
Example
lua
local zoneId = exports['core_gangs']:getZoneFromPlayer()
print('Current zone:', zoneId)
clientexports['core_gangs']:getZoneFromCoords(x, y)

Returns the zone ID at the given map coordinates.

ParameterTypeDescription
xnumberX coordinate
ynumberY coordinate
Returns: number
Example
lua
local zoneId = exports['core_gangs']:getZoneFromCoords(732.12, -1088.83)
clientexports['core_gangs']:getCoordsFromZone(zoneId)

Returns the center coordinates of a zone.

ParameterTypeDescription
zoneIdnumberThe zone ID
Returns: number, number
Example
lua
local x, y = exports['core_gangs']:getCoordsFromZone(6740)
clientexports['core_gangs']:getPlayerOrganization()

Returns the name of the player's current organization, or nil if not in one.

Returns: string | nil
Example
lua
local org = exports['core_gangs']:getPlayerOrganization()
if org then
    print('Player is in:', org)
end
clientexports['core_gangs']:isPlayerInZone(zoneId)

Checks if the player is currently in the specified zone.

ParameterTypeDescription
zoneIdnumberThe zone ID to check
Returns: boolean
Example
lua
if exports['core_gangs']:isPlayerInZone(6740) then
    print('Player is in the weed zone')
end
clientexports['core_gangs']:isPlayerOrganizationZone(zoneId)

Checks if the specified zone belongs to the player's organization.

ParameterTypeDescription
zoneIdnumberThe zone ID to check
Returns: boolean
Example
lua
if exports['core_gangs']:isPlayerOrganizationZone(6740) then
    print('This is our territory')
end
clientexports['core_gangs']:isOrganizationZone(orgName, zoneId)

Checks if a zone belongs to a specific organization.

ParameterTypeDescription
orgNamestringOrganization name
zoneIdnumberThe zone ID to check
Returns: boolean
Example
lua
if exports['core_gangs']:isOrganizationZone('ballas', 7067) then
    print('Ballas own this zone')
end
clientexports['core_gangs']:inWarZone()

Checks if the player is currently in an active war zone.

Returns: boolean
Example
lua
if exports['core_gangs']:inWarZone() then
    print('War is active here!')
end

Controls Exports (Client)

clientexports['core_gangs']:IsRestrained()

Checks if the local player is currently restrained.

Returns: boolean
Example
lua
if exports['core_gangs']:IsRestrained() then
    print('Player is zip-tied')
end
clientexports['core_gangs']:IsEscorted()

Checks if the local player is being escorted.

Returns: boolean
Example
lua
local escorted = exports['core_gangs']:IsEscorted()
clientexports['core_gangs']:IsCarrying()

Checks if the local player is carrying someone.

Returns: boolean
Example
lua
local carrying = exports['core_gangs']:IsCarrying()
clientexports['core_gangs']:IsBeingCarried()

Checks if the local player is being carried by someone.

Returns: boolean
Example
lua
local beingCarried = exports['core_gangs']:IsBeingCarried()
clientexports['core_gangs']:IsInTrunk()

Checks if the local player is in a vehicle trunk.

Returns: boolean
Example
lua
local inTrunk = exports['core_gangs']:IsInTrunk()
clientexports['core_gangs']:IsHoldingHostage()

Checks if the local player is holding someone hostage.

Returns: boolean
Example
lua
local holding = exports['core_gangs']:IsHoldingHostage()
clientexports['core_gangs']:IsHostage()

Checks if the local player is being held hostage.

Returns: boolean
Example
lua
local hostage = exports['core_gangs']:IsHostage()
clientexports['core_gangs']:IsRopePulling()

Checks if the local player is rope-pulling someone.

Returns: boolean
Example
lua
local pulling = exports['core_gangs']:IsRopePulling()
clientexports['core_gangs']:IsBeingRopePulled()

Checks if the local player is being rope-pulled.

Returns: boolean
Example
lua
local pulled = exports['core_gangs']:IsBeingRopePulled()

Server Exports

Organization Management

serverexports['core_gangs']:getOrganization(identifier)

Returns the organization name of a player by their identifier or server ID.

ParameterTypeDescription
identifierstring | numberPlayer identifier (citizenid) or server ID
Returns: string | nil
Example
lua
local org = exports['core_gangs']:getOrganization(source)
serverexports['core_gangs']:createOrganization(playerSource, orgName, colorHex, source)

Creates a new organization. The player becomes the owner.

ParameterTypeDescription
playerSourcenumber | stringPlayer server ID or identifier
orgNamestringOrganization name
colorHexstringHex color (e.g. #FF0000)
sourcenumberAdmin source (optional)
Example
lua
exports['core_gangs']:createOrganization(source, 'NewGang', '#FF5500')
serverexports['core_gangs']:deleteOrganization(orgName, source)

Deletes an organization and removes all members from it.

ParameterTypeDescription
orgNamestringOrganization name to delete
sourcenumberAdmin source (optional)
Example
lua
exports['core_gangs']:deleteOrganization('OldGang')
serverexports['core_gangs']:setPlayerToOrg(source, orgName)

Adds a player to an organization.

ParameterTypeDescription
sourcenumberPlayer server ID
orgNamestringOrganization name
Example
lua
exports['core_gangs']:setPlayerToOrg(source, 'vagos')
serverexports['core_gangs']:setPlayerAsOrgOwner(source, orgName)

Sets a player as the owner of an organization.

ParameterTypeDescription
sourcenumberPlayer server ID
orgNamestringOrganization name
Example
lua
exports['core_gangs']:setPlayerAsOrgOwner(source, 'vagos')
serverexports['core_gangs']:removePlayerFromOrganization(identifier)

Removes a player from their organization by identifier.

ParameterTypeDescription
identifierstringPlayer identifier (citizenid)
Example
lua
exports['core_gangs']:removePlayerFromOrganization('ABC12345')

Zone Management

serverexports['core_gangs']:getZoneOrganization(zoneId)

Returns the organization name that owns a zone, or nil if unowned.

ParameterTypeDescription
zoneIdnumberThe zone ID
Returns: string | nil
Example
lua
local owner = exports['core_gangs']:getZoneOrganization(6740)
serverexports['core_gangs']:getOrganizationZones(orgName)

Returns a table of zone IDs owned by the specified organization.

ParameterTypeDescription
orgNamestringOrganization name
Returns: table | nil
Example
lua
local zones = exports['core_gangs']:getOrganizationZones('vagos')
if zones then
    for _, zoneId in ipairs(zones) do
        print('Zone:', zoneId)
    end
end
serverexports['core_gangs']:isOrganizationZone(orgName, zoneId)

Checks if a zone belongs to a specific organization.

ParameterTypeDescription
orgNamestringOrganization name
zoneIdnumberThe zone ID
Returns: boolean
Example
lua
if exports['core_gangs']:isOrganizationZone('ballas', 7067) then
    print('Ballas own this zone')
end
serverexports['core_gangs']:isPlayerOrganizationZone(identifier, zoneId)

Checks if a zone belongs to the player's organization.

ParameterTypeDescription
identifierstringPlayer identifier (citizenid)
zoneIdnumberThe zone ID
Returns: boolean
Example
lua
if exports['core_gangs']:isPlayerOrganizationZone(identifier, 6740) then
    print('This zone belongs to the player\\'s org')
end
serverexports['core_gangs']:setZoneToOrg(zoneId, orgName)

Assigns a zone to an organization without war.

ParameterTypeDescription
zoneIdnumberThe zone ID
orgNamestringOrganization name
Example
lua
exports['core_gangs']:setZoneToOrg(7067, 'ballas')
serverexports['core_gangs']:removeZoneOwner(zoneId)

Removes ownership from a zone, making it neutral.

ParameterTypeDescription
zoneIdnumberThe zone ID
Example
lua
exports['core_gangs']:removeZoneOwner(7067)

War System

serverexports['core_gangs']:isWarInProgress(zoneId)

Checks if a war is currently active in the specified zone.

ParameterTypeDescription
zoneIdnumberThe zone ID
Returns: boolean
Example
lua
if exports['core_gangs']:isWarInProgress(6740) then
    print('War is active in zone 6740')
end
serverexports['core_gangs']:startWar(zoneId)

Programmatically starts a war in the specified zone.

ParameterTypeDescription
zoneIdnumberThe zone ID to start war in
Example
lua
exports['core_gangs']:startWar(6740)

NPC Selling

serverexports['core_gangs']:getZoneStreetRep(zoneId)

Returns the current street reputation value for a zone.

ParameterTypeDescription
zoneIdnumberThe zone ID
Returns: number
Example
lua
local rep = exports['core_gangs']:getZoneStreetRep(6740)
print('Street rep:', rep) -- 0-100
serverexports['core_gangs']:getZoneHeat(zoneId)

Returns the current heat level for a zone (decays over time).

ParameterTypeDescription
zoneIdnumberThe zone ID
Returns: number
Example
lua
local heat = exports['core_gangs']:getZoneHeat(6740)
print('Zone heat:', heat) -- 0-100
serverexports['core_gangs']:getPlayerSellCooldown(identifier)

Returns the remaining sell cooldown in seconds for a player.

ParameterTypeDescription
identifierstringPlayer identifier
Returns: number
Example
lua
local cooldown = exports['core_gangs']:getPlayerSellCooldown(identifier)

Controls

serverexports['core_gangs']:IsPlayerRestrained(src)

Checks if a player is restrained.

ParameterTypeDescription
srcnumberPlayer server ID
Returns: boolean
Example
lua
if exports['core_gangs']:IsPlayerRestrained(targetSrc) then
    print('Player is restrained')
end
serverexports['core_gangs']:IsPlayerEscorted(src)

Checks if a player is being escorted.

ParameterTypeDescription
srcnumberPlayer server ID
Returns: boolean
Example
lua
local escorted = exports['core_gangs']:IsPlayerEscorted(targetSrc)
serverexports['core_gangs']:GetRestrainedPlayers()

Returns a table of all currently restrained players.

Returns: table
Example
lua
local restrained = exports['core_gangs']:GetRestrainedPlayers()
for targetSrc, cufferSrc in pairs(restrained) do
    print(targetSrc, 'restrained by', cufferSrc)
end
serverexports['core_gangs']:IsPlayerCarrying(src)

Checks if a player is carrying someone.

ParameterTypeDescription
srcnumberPlayer server ID
Returns: boolean
Example
lua
local carrying = exports['core_gangs']:IsPlayerCarrying(source)
serverexports['core_gangs']:IsPlayerBeingCarried(src)

Checks if a player is being carried.

ParameterTypeDescription
srcnumberPlayer server ID
Returns: boolean
Example
lua
local beingCarried = exports['core_gangs']:IsPlayerBeingCarried(targetSrc)
serverexports['core_gangs']:IsPlayerInTrunk(src)

Checks if a player is in a vehicle trunk.

ParameterTypeDescription
srcnumberPlayer server ID
Returns: boolean
Example
lua
local inTrunk = exports['core_gangs']:IsPlayerInTrunk(targetSrc)
serverexports['core_gangs']:IsPlayerHoldingHostage(src)

Checks if a player is holding someone hostage.

ParameterTypeDescription
srcnumberPlayer server ID
Returns: boolean
Example
lua
local holding = exports['core_gangs']:IsPlayerHoldingHostage(source)
serverexports['core_gangs']:IsPlayerHostage(src)

Checks if a player is being held hostage.

ParameterTypeDescription
srcnumberPlayer server ID
Returns: boolean
Example
lua
local hostage = exports['core_gangs']:IsPlayerHostage(targetSrc)
serverexports['core_gangs']:IsPlayerRopePulling(src)

Checks if a player is rope-pulling someone.

ParameterTypeDescription
srcnumberPlayer server ID
Returns: boolean
Example
lua
local pulling = exports['core_gangs']:IsPlayerRopePulling(source)
serverexports['core_gangs']:IsPlayerBeingRopePulled(src)

Checks if a player is being rope-pulled.

ParameterTypeDescription
srcnumberPlayer server ID
Returns: boolean
Example
lua
local pulled = exports['core_gangs']:IsPlayerBeingRopePulled(targetSrc)

Fields

serverexports['core_gangs']:getFieldPlants(zoneId)

Returns plants in a zone. Pass nil to get all plants across all zones.

ParameterTypeDescription
zoneIdnumber | nilZone ID, or nil for all zones
Returns: table
Example
lua
local plants = exports['core_gangs']:getFieldPlants(6740)
local allPlants = exports['core_gangs']:getFieldPlants(nil)

Data Refresh

Force refresh data on all connected clients:

serverexports['core_gangs']:refreshOrganizationOnAllClient()

Refreshes organization data on all connected clients.

Example
lua
exports['core_gangs']:refreshOrganizationOnAllClient()
serverexports['core_gangs']:refreshZoneOnAllClient()

Refreshes zone data on all connected clients.

Example
lua
exports['core_gangs']:refreshZoneOnAllClient()
serverexports['core_gangs']:refreshCriminalOnAllClient()

Refreshes criminal profile data on all connected clients.

Example
lua
exports['core_gangs']:refreshCriminalOnAllClient()
serverexports['core_gangs']:refreshBountyOnAllClient()

Refreshes bounty data on all connected clients.

Example
lua
exports['core_gangs']:refreshBountyOnAllClient()

Integration Callbacks

Core Gangs provides an onWarEnd callback in server/integration_main.lua for hooking into war results:

lua
function onWarEnd(winnerInfo, loserInfo)
    -- winnerInfo: { organization, score, playersInvolved }
    -- loserInfo: { [orgName] = { organization, score, playersInvolved } }
end

INFO

The playersInvolved table maps player identifiers to their individual scores during the war.