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)
print('Zone at coords:', zoneId)
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

Server Exports

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)
if org then
    print('Player org:', org)
end
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
local identifier = 'ABC12345'
if exports['core_gangs']:isPlayerOrganizationZone(identifier, 6740) then
    print('This zone belongs to the player\\'s org')
end
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']: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')
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)
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)

Refresh Exports

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()