Exports & API
Core Gangs exposes exports for integration with other scripts.
Client Exports
client
exports['core_gangs']:getZoneFromPlayer()Returns the zone ID the player is currently standing in.
Returns:
numberExample
lua
local zoneId = exports['core_gangs']:getZoneFromPlayer()
print('Current zone:', zoneId)client
exports['core_gangs']:getZoneFromCoords(x, y)Returns the zone ID at the given map coordinates.
| Parameter | Type | Description |
|---|---|---|
x | number | X coordinate |
y | number | Y coordinate |
Returns:
numberExample
lua
local zoneId = exports['core_gangs']:getZoneFromCoords(732.12, -1088.83)client
exports['core_gangs']:getCoordsFromZone(zoneId)Returns the center coordinates of a zone.
| Parameter | Type | Description |
|---|---|---|
zoneId | number | The zone ID |
Returns:
number, numberExample
lua
local x, y = exports['core_gangs']:getCoordsFromZone(6740)client
exports['core_gangs']:getPlayerOrganization()Returns the name of the player's current organization, or nil if not in one.
Returns:
string | nilExample
lua
local org = exports['core_gangs']:getPlayerOrganization()
if org then
print('Player is in:', org)
endclient
exports['core_gangs']:isPlayerInZone(zoneId)Checks if the player is currently in the specified zone.
| Parameter | Type | Description |
|---|---|---|
zoneId | number | The zone ID to check |
Returns:
booleanExample
lua
if exports['core_gangs']:isPlayerInZone(6740) then
print('Player is in the weed zone')
endclient
exports['core_gangs']:isPlayerOrganizationZone(zoneId)Checks if the specified zone belongs to the player's organization.
| Parameter | Type | Description |
|---|---|---|
zoneId | number | The zone ID to check |
Returns:
booleanExample
lua
if exports['core_gangs']:isPlayerOrganizationZone(6740) then
print('This is our territory')
endclient
exports['core_gangs']:isOrganizationZone(orgName, zoneId)Checks if a zone belongs to a specific organization.
| Parameter | Type | Description |
|---|---|---|
orgName | string | Organization name |
zoneId | number | The zone ID to check |
Returns:
booleanExample
lua
if exports['core_gangs']:isOrganizationZone('ballas', 7067) then
print('Ballas own this zone')
endclient
exports['core_gangs']:inWarZone()Checks if the player is currently in an active war zone.
Returns:
booleanExample
lua
if exports['core_gangs']:inWarZone() then
print('War is active here!')
endControls Exports (Client)
client
exports['core_gangs']:IsRestrained()Checks if the local player is currently restrained.
Returns:
booleanExample
lua
if exports['core_gangs']:IsRestrained() then
print('Player is zip-tied')
endclient
exports['core_gangs']:IsEscorted()Checks if the local player is being escorted.
Returns:
booleanExample
lua
local escorted = exports['core_gangs']:IsEscorted()client
exports['core_gangs']:IsCarrying()Checks if the local player is carrying someone.
Returns:
booleanExample
lua
local carrying = exports['core_gangs']:IsCarrying()client
exports['core_gangs']:IsBeingCarried()Checks if the local player is being carried by someone.
Returns:
booleanExample
lua
local beingCarried = exports['core_gangs']:IsBeingCarried()client
exports['core_gangs']:IsInTrunk()Checks if the local player is in a vehicle trunk.
Returns:
booleanExample
lua
local inTrunk = exports['core_gangs']:IsInTrunk()client
exports['core_gangs']:IsHoldingHostage()Checks if the local player is holding someone hostage.
Returns:
booleanExample
lua
local holding = exports['core_gangs']:IsHoldingHostage()client
exports['core_gangs']:IsHostage()Checks if the local player is being held hostage.
Returns:
booleanExample
lua
local hostage = exports['core_gangs']:IsHostage()client
exports['core_gangs']:IsRopePulling()Checks if the local player is rope-pulling someone.
Returns:
booleanExample
lua
local pulling = exports['core_gangs']:IsRopePulling()client
exports['core_gangs']:IsBeingRopePulled()Checks if the local player is being rope-pulled.
Returns:
booleanExample
lua
local pulled = exports['core_gangs']:IsBeingRopePulled()Server Exports
Organization Management
server
exports['core_gangs']:getOrganization(identifier)Returns the organization name of a player by their identifier or server ID.
| Parameter | Type | Description |
|---|---|---|
identifier | string | number | Player identifier (citizenid) or server ID |
Returns:
string | nilExample
lua
local org = exports['core_gangs']:getOrganization(source)server
exports['core_gangs']:createOrganization(playerSource, orgName, colorHex, source)Creates a new organization. The player becomes the owner.
| Parameter | Type | Description |
|---|---|---|
playerSource | number | string | Player server ID or identifier |
orgName | string | Organization name |
colorHex | string | Hex color (e.g. #FF0000) |
source | number | Admin source (optional) |
Example
lua
exports['core_gangs']:createOrganization(source, 'NewGang', '#FF5500')server
exports['core_gangs']:deleteOrganization(orgName, source)Deletes an organization and removes all members from it.
| Parameter | Type | Description |
|---|---|---|
orgName | string | Organization name to delete |
source | number | Admin source (optional) |
Example
lua
exports['core_gangs']:deleteOrganization('OldGang')server
exports['core_gangs']:setPlayerToOrg(source, orgName)Adds a player to an organization.
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID |
orgName | string | Organization name |
Example
lua
exports['core_gangs']:setPlayerToOrg(source, 'vagos')server
exports['core_gangs']:setPlayerAsOrgOwner(source, orgName)Sets a player as the owner of an organization.
| Parameter | Type | Description |
|---|---|---|
source | number | Player server ID |
orgName | string | Organization name |
Example
lua
exports['core_gangs']:setPlayerAsOrgOwner(source, 'vagos')server
exports['core_gangs']:removePlayerFromOrganization(identifier)Removes a player from their organization by identifier.
| Parameter | Type | Description |
|---|---|---|
identifier | string | Player identifier (citizenid) |
Example
lua
exports['core_gangs']:removePlayerFromOrganization('ABC12345')Zone Management
server
exports['core_gangs']:getZoneOrganization(zoneId)Returns the organization name that owns a zone, or nil if unowned.
| Parameter | Type | Description |
|---|---|---|
zoneId | number | The zone ID |
Returns:
string | nilExample
lua
local owner = exports['core_gangs']:getZoneOrganization(6740)server
exports['core_gangs']:getOrganizationZones(orgName)Returns a table of zone IDs owned by the specified organization.
| Parameter | Type | Description |
|---|---|---|
orgName | string | Organization name |
Returns:
table | nilExample
lua
local zones = exports['core_gangs']:getOrganizationZones('vagos')
if zones then
for _, zoneId in ipairs(zones) do
print('Zone:', zoneId)
end
endserver
exports['core_gangs']:isOrganizationZone(orgName, zoneId)Checks if a zone belongs to a specific organization.
| Parameter | Type | Description |
|---|---|---|
orgName | string | Organization name |
zoneId | number | The zone ID |
Returns:
booleanExample
lua
if exports['core_gangs']:isOrganizationZone('ballas', 7067) then
print('Ballas own this zone')
endserver
exports['core_gangs']:isPlayerOrganizationZone(identifier, zoneId)Checks if a zone belongs to the player's organization.
| Parameter | Type | Description |
|---|---|---|
identifier | string | Player identifier (citizenid) |
zoneId | number | The zone ID |
Returns:
booleanExample
lua
if exports['core_gangs']:isPlayerOrganizationZone(identifier, 6740) then
print('This zone belongs to the player\\'s org')
endserver
exports['core_gangs']:setZoneToOrg(zoneId, orgName)Assigns a zone to an organization without war.
| Parameter | Type | Description |
|---|---|---|
zoneId | number | The zone ID |
orgName | string | Organization name |
Example
lua
exports['core_gangs']:setZoneToOrg(7067, 'ballas')server
exports['core_gangs']:removeZoneOwner(zoneId)Removes ownership from a zone, making it neutral.
| Parameter | Type | Description |
|---|---|---|
zoneId | number | The zone ID |
Example
lua
exports['core_gangs']:removeZoneOwner(7067)War System
server
exports['core_gangs']:isWarInProgress(zoneId)Checks if a war is currently active in the specified zone.
| Parameter | Type | Description |
|---|---|---|
zoneId | number | The zone ID |
Returns:
booleanExample
lua
if exports['core_gangs']:isWarInProgress(6740) then
print('War is active in zone 6740')
endserver
exports['core_gangs']:startWar(zoneId)Programmatically starts a war in the specified zone.
| Parameter | Type | Description |
|---|---|---|
zoneId | number | The zone ID to start war in |
Example
lua
exports['core_gangs']:startWar(6740)NPC Selling
server
exports['core_gangs']:getZoneStreetRep(zoneId)Returns the current street reputation value for a zone.
| Parameter | Type | Description |
|---|---|---|
zoneId | number | The zone ID |
Returns:
numberExample
lua
local rep = exports['core_gangs']:getZoneStreetRep(6740)
print('Street rep:', rep) -- 0-100server
exports['core_gangs']:getZoneHeat(zoneId)Returns the current heat level for a zone (decays over time).
| Parameter | Type | Description |
|---|---|---|
zoneId | number | The zone ID |
Returns:
numberExample
lua
local heat = exports['core_gangs']:getZoneHeat(6740)
print('Zone heat:', heat) -- 0-100server
exports['core_gangs']:getPlayerSellCooldown(identifier)Returns the remaining sell cooldown in seconds for a player.
| Parameter | Type | Description |
|---|---|---|
identifier | string | Player identifier |
Returns:
numberExample
lua
local cooldown = exports['core_gangs']:getPlayerSellCooldown(identifier)Controls
server
exports['core_gangs']:IsPlayerRestrained(src)Checks if a player is restrained.
| Parameter | Type | Description |
|---|---|---|
src | number | Player server ID |
Returns:
booleanExample
lua
if exports['core_gangs']:IsPlayerRestrained(targetSrc) then
print('Player is restrained')
endserver
exports['core_gangs']:IsPlayerEscorted(src)Checks if a player is being escorted.
| Parameter | Type | Description |
|---|---|---|
src | number | Player server ID |
Returns:
booleanExample
lua
local escorted = exports['core_gangs']:IsPlayerEscorted(targetSrc)server
exports['core_gangs']:GetRestrainedPlayers()Returns a table of all currently restrained players.
Returns:
tableExample
lua
local restrained = exports['core_gangs']:GetRestrainedPlayers()
for targetSrc, cufferSrc in pairs(restrained) do
print(targetSrc, 'restrained by', cufferSrc)
endserver
exports['core_gangs']:IsPlayerCarrying(src)Checks if a player is carrying someone.
| Parameter | Type | Description |
|---|---|---|
src | number | Player server ID |
Returns:
booleanExample
lua
local carrying = exports['core_gangs']:IsPlayerCarrying(source)server
exports['core_gangs']:IsPlayerBeingCarried(src)Checks if a player is being carried.
| Parameter | Type | Description |
|---|---|---|
src | number | Player server ID |
Returns:
booleanExample
lua
local beingCarried = exports['core_gangs']:IsPlayerBeingCarried(targetSrc)server
exports['core_gangs']:IsPlayerInTrunk(src)Checks if a player is in a vehicle trunk.
| Parameter | Type | Description |
|---|---|---|
src | number | Player server ID |
Returns:
booleanExample
lua
local inTrunk = exports['core_gangs']:IsPlayerInTrunk(targetSrc)server
exports['core_gangs']:IsPlayerHoldingHostage(src)Checks if a player is holding someone hostage.
| Parameter | Type | Description |
|---|---|---|
src | number | Player server ID |
Returns:
booleanExample
lua
local holding = exports['core_gangs']:IsPlayerHoldingHostage(source)server
exports['core_gangs']:IsPlayerHostage(src)Checks if a player is being held hostage.
| Parameter | Type | Description |
|---|---|---|
src | number | Player server ID |
Returns:
booleanExample
lua
local hostage = exports['core_gangs']:IsPlayerHostage(targetSrc)server
exports['core_gangs']:IsPlayerRopePulling(src)Checks if a player is rope-pulling someone.
| Parameter | Type | Description |
|---|---|---|
src | number | Player server ID |
Returns:
booleanExample
lua
local pulling = exports['core_gangs']:IsPlayerRopePulling(source)server
exports['core_gangs']:IsPlayerBeingRopePulled(src)Checks if a player is being rope-pulled.
| Parameter | Type | Description |
|---|---|---|
src | number | Player server ID |
Returns:
booleanExample
lua
local pulled = exports['core_gangs']:IsPlayerBeingRopePulled(targetSrc)Fields
server
exports['core_gangs']:getFieldPlants(zoneId)Returns plants in a zone. Pass nil to get all plants across all zones.
| Parameter | Type | Description |
|---|---|---|
zoneId | number | nil | Zone ID, or nil for all zones |
Returns:
tableExample
lua
local plants = exports['core_gangs']:getFieldPlants(6740)
local allPlants = exports['core_gangs']:getFieldPlants(nil)Data Refresh
Force refresh data on all connected clients:
server
exports['core_gangs']:refreshOrganizationOnAllClient()Refreshes organization data on all connected clients.
Example
lua
exports['core_gangs']:refreshOrganizationOnAllClient()server
exports['core_gangs']:refreshZoneOnAllClient()Refreshes zone data on all connected clients.
Example
lua
exports['core_gangs']:refreshZoneOnAllClient()server
exports['core_gangs']:refreshCriminalOnAllClient()Refreshes criminal profile data on all connected clients.
Example
lua
exports['core_gangs']:refreshCriminalOnAllClient()server
exports['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 } }
endINFO
The playersInvolved table maps player identifiers to their individual scores during the war.
