Skip to Content
Cobalt

World and buckets

cobalt_core exports: world and buckets.

ExportSideWhat it does
GetVehiclesClientEvery vehicle the client has loaded.
GetObjectsClientEvery object the client has loaded.
GetPedsClientEvery ped the client has loaded, except the ones listed in ignoreList.
GetStreetNameAtCoordsClientThe street and cross street at a position.
GetZoneAtCoordsClientThe display name of the map zone at a position, such as Legion Square.
GetGroundHashClientCasts a capsule down through the entity and returns the material it lands on, with the raw shape test results.
GetBucketObjectsServerThe routing bucket of every player and entity that cobalt_core has moved out of bucket 0.
SetPlayerBucketServerMoves a player to a routing bucket.
SetEntityBucketServerMoves an entity to a routing bucket.
GetPlayersInBucketServerThe players in a routing bucket, or false when there are none.
GetEntitiesInBucketServerThe entities in a routing bucket, or false when there are none.

GetVehicles

Client

Every vehicle the client has loaded.

exports.cobalt_core:GetVehicles()
ReturnsDescription
integer[]
Example
local vehicles = exports.cobalt_core:GetVehicles()

GetObjects

Client

Every object the client has loaded.

exports.cobalt_core:GetObjects()
ReturnsDescription
integer[]
Example
local objects = exports.cobalt_core:GetObjects()

GetPeds

Client

Every ped the client has loaded, except the ones listed in ignoreList.

exports.cobalt_core:GetPeds(ignoreList)
ParameterTypeOptionalDescription
ignoreListinteger[]Yes
ReturnsDescription
integer[]
Example
local peds = exports.cobalt_core:GetPeds({ cache.ped })

GetStreetNameAtCoords

Client

The street and cross street at a position.

exports.cobalt_core:GetStreetNameAtCoords(coords)
ParameterTypeOptionalDescription
coordsvector3No
ReturnsDescription
StreetName
Example
local name = exports.cobalt_core:GetStreetNameAtCoords(vector3(215.8, -810.1, 30.7))

GetZoneAtCoords

Client

The display name of the map zone at a position, such as Legion Square.

exports.cobalt_core:GetZoneAtCoords(coords)
ParameterTypeOptionalDescription
coordsvector3No
ReturnsDescription
string
Example
local zoneAtCoords = exports.cobalt_core:GetZoneAtCoords(vector3(215.8, -810.1, 30.7))

GetGroundHash

Client

Casts a capsule down through the entity and returns the material it lands on, with the raw shape test results.

exports.cobalt_core:GetGroundHash(entity)
ParameterTypeOptionalDescription
entityintegerNo
ReturnsDescription
integermaterialHash
integerentityHit
vector3surfaceNormal
vector3endCoords
booleansuccess
integerretval
Example
local materialHash, entityHit, surfaceNormal, endCoords, success, retval = exports.cobalt_core:GetGroundHash(
    vehicle
)

GetBucketObjects

Server

The routing bucket of every player and entity that cobalt_core has moved out of bucket 0.

exports.cobalt_core:GetBucketObjects()
ReturnsDescription
table<integer, { id: integer, bucket: integer }>players
table<integer, { id: integer, bucket: integer }>entities
Example
local players, entities = exports.cobalt_core:GetBucketObjects()

SetPlayerBucket

Server

Moves a player to a routing bucket.

exports.cobalt_core:SetPlayerBucket(source, bucket)
ParameterTypeOptionalDescription
sourceintegerNo
bucketintegerNo
ReturnsDescription
boolean
Example
local ok = exports.cobalt_core:SetPlayerBucket(source, 1)

SetEntityBucket

Server

Moves an entity to a routing bucket.

exports.cobalt_core:SetEntityBucket(entity, bucket)
ParameterTypeOptionalDescription
entityintegerNo
bucketintegerNo
ReturnsDescription
boolean
Example
local ok = exports.cobalt_core:SetEntityBucket(vehicle, 1)

GetPlayersInBucket

Server

The players in a routing bucket, or false when there are none.

exports.cobalt_core:GetPlayersInBucket(bucket)
ParameterTypeOptionalDescription
bucketintegerNo
ReturnsDescription
integer[] | false
Example
local playersInBucket = exports.cobalt_core:GetPlayersInBucket(1)

GetEntitiesInBucket

Server

The entities in a routing bucket, or false when there are none.

exports.cobalt_core:GetEntitiesInBucket(bucket)
ParameterTypeOptionalDescription
bucketintegerNo
ReturnsDescription
integer[] | false
Example
local entitiesInBucket = exports.cobalt_core:GetEntitiesInBucket(1)

On this page