qbcore-framework / qb-core

FiveM RP Framework Core :muscle:
GNU General Public License v3.0
582 stars 962 forks source link

Feat: Add statebag for instances #1079

Closed FjamZoo closed 7 months ago

FjamZoo commented 8 months ago

Description

Currently there's no way to tell whenever your client switched routing bucket, and a getter for which routing bucket you are in. Therefor this PR aims to add a feature which is already present in other frameworks this will help developers to easier support for qb-core throughout scripts, which requires this.

Usage

local playerId = PlayerId()

AddStateBagChangeHandler('instance', ('player:%s'):format(playerId), function(_, _, bucket)
    print("You just entered bucket", bucket)
end)

Checklist