World and buckets
cobalt_core exports: world and buckets.
| Export | Side | What it does |
|---|---|---|
GetVehicles | Client | Every vehicle the client has loaded. |
GetObjects | Client | Every object the client has loaded. |
GetPeds | Client | Every ped the client has loaded, except the ones listed in ignoreList. |
GetStreetNameAtCoords | Client | The street and cross street at a position. |
GetZoneAtCoords | Client | The display name of the map zone at a position, such as Legion Square. |
GetGroundHash | Client | Casts a capsule down through the entity and returns the material it lands on, with the raw shape test results. |
GetBucketObjects | Server | The routing bucket of every player and entity that cobalt_core has moved out of bucket 0. |
SetPlayerBucket | Server | Moves a player to a routing bucket. |
SetEntityBucket | Server | Moves an entity to a routing bucket. |
GetPlayersInBucket | Server | The players in a routing bucket, or false when there are none. |
GetEntitiesInBucket | Server | The entities in a routing bucket, or false when there are none. |
GetVehicles
ClientEvery vehicle the client has loaded.
exports.cobalt_core:GetVehicles()| Returns | Description |
|---|---|
integer[] |
local vehicles = exports.cobalt_core:GetVehicles()GetObjects
ClientEvery object the client has loaded.
exports.cobalt_core:GetObjects()| Returns | Description |
|---|---|
integer[] |
local objects = exports.cobalt_core:GetObjects()GetPeds
ClientEvery ped the client has loaded, except the ones listed in ignoreList.
exports.cobalt_core:GetPeds(ignoreList)| Parameter | Type | Optional | Description |
|---|---|---|---|
ignoreList | integer[] | Yes |
| Returns | Description |
|---|---|
integer[] |
local peds = exports.cobalt_core:GetPeds({ cache.ped })GetStreetNameAtCoords
ClientThe street and cross street at a position.
exports.cobalt_core:GetStreetNameAtCoords(coords)| Parameter | Type | Optional | Description |
|---|---|---|---|
coords | vector3 | No |
| Returns | Description |
|---|---|
StreetName |
local name = exports.cobalt_core:GetStreetNameAtCoords(vector3(215.8, -810.1, 30.7))GetZoneAtCoords
ClientThe display name of the map zone at a position, such as Legion Square.
exports.cobalt_core:GetZoneAtCoords(coords)| Parameter | Type | Optional | Description |
|---|---|---|---|
coords | vector3 | No |
| Returns | Description |
|---|---|
string |
local zoneAtCoords = exports.cobalt_core:GetZoneAtCoords(vector3(215.8, -810.1, 30.7))GetGroundHash
ClientCasts a capsule down through the entity and returns the material it lands on, with the raw shape test results.
exports.cobalt_core:GetGroundHash(entity)| Parameter | Type | Optional | Description |
|---|---|---|---|
entity | integer | No |
| Returns | Description |
|---|---|
integer | materialHash |
integer | entityHit |
vector3 | surfaceNormal |
vector3 | endCoords |
boolean | success |
integer | retval |
local materialHash, entityHit, surfaceNormal, endCoords, success, retval = exports.cobalt_core:GetGroundHash(
vehicle
)GetBucketObjects
ServerThe routing bucket of every player and entity that cobalt_core has moved out of bucket 0.
exports.cobalt_core:GetBucketObjects()| Returns | Description |
|---|---|
table<integer, { id: integer, bucket: integer }> | players |
table<integer, { id: integer, bucket: integer }> | entities |
local players, entities = exports.cobalt_core:GetBucketObjects()SetPlayerBucket
ServerMoves a player to a routing bucket.
exports.cobalt_core:SetPlayerBucket(source, bucket)| Parameter | Type | Optional | Description |
|---|---|---|---|
source | integer | No | |
bucket | integer | No |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_core:SetPlayerBucket(source, 1)SetEntityBucket
ServerMoves an entity to a routing bucket.
exports.cobalt_core:SetEntityBucket(entity, bucket)| Parameter | Type | Optional | Description |
|---|---|---|---|
entity | integer | No | |
bucket | integer | No |
| Returns | Description |
|---|---|
boolean |
local ok = exports.cobalt_core:SetEntityBucket(vehicle, 1)GetPlayersInBucket
ServerThe players in a routing bucket, or false when there are none.
exports.cobalt_core:GetPlayersInBucket(bucket)| Parameter | Type | Optional | Description |
|---|---|---|---|
bucket | integer | No |
| Returns | Description |
|---|---|
integer[] | false |
local playersInBucket = exports.cobalt_core:GetPlayersInBucket(1)GetEntitiesInBucket
ServerThe entities in a routing bucket, or false when there are none.
exports.cobalt_core:GetEntitiesInBucket(bucket)| Parameter | Type | Optional | Description |
|---|---|---|---|
bucket | integer | No |
| Returns | Description |
|---|---|
integer[] | false |
local entitiesInBucket = exports.cobalt_core:GetEntitiesInBucket(1)