Moves a player into a bucket. The vehicle they are sitting in moves with them, including the other players in that vehicle and any non-player peds in its seats. Objects attached to the ped move too.
Replicates oldBucket, currentBucket, and currentBucketName on that player. currentBucketName is the registered name, or nil for buckets 0 and 1.
local ok = exports.sleepless_routing:addPlayerToBucket(playerId, bucket, force)
local bucketId = exports.sleepless_routing:requestBucketId('apartment_4b', false)if not bucketId then return endexports.sleepless_routing:addPlayerToBucket(source, bucketId, true)
Registers a new named bucket. If the name already exists, the existing id is returned and the population and lockdown arguments are ignored.
Population and lockdown apply only on the first create. An omitted population value defaults to false. An omitted lockdown leaves FiveM's default, inactive.
local bucketId = exports.sleepless_routing:createBucketId(name, population, lockdown)
local quiet = exports.sleepless_routing:createBucketId('intro', false, 'strict')local city = exports.sleepless_routing:createBucketId('public_event', true)
Changes population, lockdown, or both on a bucket that already exists. Pass a bucket id or a registered name. Bucket 0 and bucket 1 accept a numeric id.
local ok = exports.sleepless_routing:setBucketOptions(bucket, options)
Returns the server ids of players whose live routing bucket matches. This reads GetPlayerRoutingBucket, so it includes players moved by another resource.
local playerIds = exports.sleepless_routing:getPlayersInBucket(bucket)
local playerIds = exports.sleepless_routing:getPlayersInBucket(('house_%s'):format(propertyId)) or {}for i = 1, #playerIds do exports.sleepless_routing:routePlayerToGlobalBucket(playerIds[i])end
Sends one client event to every player currently in the bucket. This wraps lib.triggerClientEvent, so the payload is packed once and delivered to each player in that bucket.
The argument order matches lib.triggerClientEvent: event name, then the target, then the payload. The target is a bucket id or a registered name instead of a server id.
local sent = exports.sleepless_routing:triggerClientEventForBucket(eventName, bucket, ...)
true when the bucket resolved and the event was handed to lib.triggerClientEvent. An empty bucket still returns true. false when the event name is empty, the name is not registered, or the id is invalid