a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Server / Bucket
Represents a population-aware routing bucket, also known as a ‘dimension’ or ‘virtual world’.
In the context of a FiveM server, routing buckets are used to segregate entities and players into different logical spaces that can operate independently. These buckets allow you to control entity routing, player visibility, and interaction within the game world, with the added capability of managing population awareness.
new Bucket(
bucketName
,bucketId
,bucketPopulation
?,bucketEntityLockdownMode
?):Bucket
Creates a new instance of the Bucket
class.
• bucketName: string
The name of the bucket.
• bucketId: number
The unique identifier for the bucket.
• bucketPopulation?: boolean
(Optional) A flag to enable or disable population within the bucket. Defaults to false
.
• bucketEntityLockdownMode?: BucketLockdownMode
(Optional) The mode controlling entity access within the bucket. Defaults to BucketLockdownMode.Relaxed
.
get
BucketEntityLockdownMode():BucketLockdownMode
Retrieves the current lockdown mode of the bucket entity.
set
BucketEntityLockdownMode(mode
):void
Sets the lockdown mode for the bucket entity.
• mode: BucketLockdownMode
The lockdown mode to be set for the bucket entity.
The current lockdown mode of the bucket entity.
get
BucketId():number
Gets the unique ID of the bucket.
number
The unique identifier of the bucket.
get
BucketName():string
Gets the name of the bucket.
string
The name of the bucket.
get
BucketPopulation():boolean
Retrieves the current population status of the bucket.
set
BucketPopulation(enabled
):void
Sets the bucket population state for this instance and updates the corresponding routing bucket.
• enabled: boolean
A boolean flag indicating whether the bucket population should be enabled (true) or disabled (false).
boolean
The population status of the bucket.
get
Entities():number
[]
Gets a list of entity IDs currently assigned to the bucket.
number
[]
An array of entity IDs.
get
Players():string
[]
Gets a list of player IDs currently assigned to the bucket.
string
[]
An array of player IDs.
addEntity(
entityId
):boolean
Adds an entity to the bucket if it is not already present.
• entityId: number
The ID of the entity to add.
boolean
true
if the entity was successfully added; false
if the entity was already present.
addPlayer(
playerId
):boolean
Adds a player to the bucket if they are not already present.
• playerId: string
The ID of the player to add.
boolean
true
if the player was successfully added; false
if the player was already present.