Entity
Server-side API for managing entity routing buckets.
rw_buckets Server API — Entity Functions
Server-side API for managing routing buckets for any networked entity — vehicles, peds, objects, anything with a server-side entity handle.
exports.rw_buckets:setEntityBucket(entityId, key)
Associates an entity with a specified bucket. Automatically removes the entity from any bucket it's currently in first.
exports.rw_buckets:setEntityBucket(entityId, 'mission_alpha')- entityId:
number— Server-side entity handle (e.g. fromNetworkGetEntityFromNetworkIdcalled server-side) — not a client entity ID, and not a network ID. - key:
string— The bucket key to associate the entity with.
This export does not return a value, and silently does nothing if the entity doesn't exist.
exports.rw_buckets:removeEntityFromBucket(entityId)
Removes an entity from its current bucket, routing it back to bucket 0.
exports.rw_buckets:removeEntityFromBucket(entityId)- entityId:
number— Server-side entity handle.
This export does not return a value, and silently does nothing if the entity doesn't exist.
exports.rw_buckets:getEntityBucketKey(entityId)
Retrieves the bucket key associated with an entity.
local bucket = exports.rw_buckets:getEntityBucketKey(entityId)
print(bucket)- entityId:
number— Server-side entity handle.
Returns: string | nil — The bucket key associated with the entity, or nil if not assigned.