The Framework Bridge abstracts framework-specific logic into a common, easy-to-use API, allowing seamless interaction with multiple frameworks such as boii_core, qb-core, es_extended, and ox_core.
By consolidating functionality into a single bridge, developers can write framework-independent code, improving maintainability and scalability.
Addtional default support will be added for other frameworks as time progresses. If your framework is not currently covered and you would like it to be, reach out through discord.
Client Functions
get_data
Use the following function to retrieve the players client side across any covered framework.
Use the following function to check if a player has a specific job with an optional on duty check.
--- Specify job/slocal jobs = { 'police', 'fib' }--- If true player must be on duty to pass job checklocal require_on_duty =true--- Utils objectutils.fw.player_has_job(jobs, require_on_duty, function(has_job)if has_job thenprint('Player has job.')elseprint('Player does not have job.')endend)--- Direct exportexports.boii_utils:player_has_job(jobs, require_on_duty, function(has_job)if has_job thenprint('Player has job.')elseprint('Player does not have job.')endend)
get_player_job_grade
Use the following function to return the players grade for a specific job.
Use the following function to check if a player has a specified item and quantity.
--- Specify itemlocal item ='lockpick'--- Specify quantitylocal quantity =1--- Utils exportutils.fw.has_item(item, quantity, function(has_item)if has_item thenprint('Player has item.')elseprint('Player does not have item.')endend)--- Direct exportexports.boii_utils:has_item(item, quantity, function(has_item)if has_item thenprint('Player has item.')elseprint('Player does not have item.')endend)
Server Functions
get_players
Use the following to retrieve all framework players currently connected.
--- Utils objectlocal player = utils.fw.get_player(source)if player thenprint('Player exists!') end--- Direct exportlocal player = exports.boii_utils:get_player(source)
get_player_id
Use the following to retrieve the unique id for the character the player is using.
The unique id is the characters citizenidfor qb, stateIdfor ox, identifierfor esx and so on.
Use the following to adjust a players inventory.
This is a little different to the normal but allows for batch updating if required and saves some space when coding for multiple item transactions within a script.
The code example below has been commented to help guide this a little better.
--- Utils objectutils.fw.adjust_inventory(source, { items = { -- Items { item_id ='burger', -- Unique ID for the item action ='add', -- Action to perform 'add' or 'remove' quantity =3, -- Quantity to remove or add data = { quality =100 } -- Optional additional data if required }, { item_id ='water', action ='remove', quantity =1 }, }, validation_data = { -- Valdation data is optional this can be removed if not used location =vector3(100.0, 100.0, 20.0), -- Coordinates for the action e.g. shopkeeper distance =10.0, -- The distance player can be from the location drop_player =true-- Enable/disable kicking player if they are out of range }, note ='Received items.', -- Note if required for logging should_save =true-- Only relevant to boii_core as data can be force saved if required})--- Direct exportexports.boii_utils:adjust_inventory(source, { items = { { item_id ='burger', action ='add', quantity =3 } }, note ='Received items.', -- Note if required for logging should_save =true-- Only relevant to boii_core as data can be force saved if required})
update_item_data
Use the following to update the metadata of an item.
Use the following to adjust a players balances.
This is a little different to the normal but allows for batch updating if required and saves some space when coding for multiple balance transactions within a script.
The code example below has been commented to help guide this a little better.
--- Utils objectutils.fw.adjust_balance(source, { operations = { -- Operations { balance_type ='bank', -- Balance type to adjust action ='remove', -- Action to perform 'add' or 'remove' amount =1000-- Amount to add or remove }, { balance_type ='savings', action ='add', amount =1000 } }, validation_data = { -- Valdation data is optional this can be removed if not used location =vector3(100.0, 100.0, 20.0), -- Coordinates for the action e.g. shopkeeper distance =10.0, -- The distance player can be from the location drop_player =true-- Enable/disable kicking player if they are out of range }, note ='Made a transfer..', -- Note if required for logging should_save =true-- Only relevant to boii_core as data can be force saved if required})--- Direct exportexports.boii_utils:adjust_balance(source, { operations = { -- Operations { balance_type ='bank', action ='remove', amount =1000 }, { balance_type ='savings', action ='add', amount =1000 } }, note ='Made a transfer..', -- Note if required for logging should_save =true-- Only relevant to boii_core as data can be force saved if required})
get_player_jobs
Use the following to retrieve the players jobs.
This includes boii_core's roles & ox_core's groups.
Use the following to check if the player has one of the jobs specified.
You can specify as many different jobs you want, along with an optional on duty check.
--- Specify jobslocal jobs = { 'police', 'fib' }--- Specify if players should be on duty to countlocal on_duty_required =true--- Utils objectlocal has_job = utils.fw.player_has_job(source, jobs, on_duty_required)if has_job thenprint('Player has job!') end--- Direct exportlocal has_job = exports.boii_utils:player_has_job(source, jobs, on_duty_required)
get_player_job_grade
Use the following to retrieve the players grade/rank for a specified job.
Use the following to retrieve a count of players by specified job names.
This is useful for returning police counts, can optionally only check for players on duty.
--- Specify jobslocal jobs = { 'police', 'fib' }--- Specify if players should be on duty to countlocal on_duty_required =true--- Utils objectlocal total_with_job, total_on_duty = utils.fw.count_player_with_job(jobs, on_duty_required)--- Direct exportlocal total_with_job, total_on_duty = exports.boii_utils:count_player_with_job(jobs, on_duty_required)
get_player_job_name
Use the following to the first job name found for a player.