Frameworks

CLIENT & SERVER

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.

--- Utils object
local player_data = utils.fw.get_data()

print('Player Data:', json.encode(player_data))

--- Direct export
local player_data = exports.boii_utils:get_data()

print('Player Data:', json.encode(player_data))

get_identity

Use the following function to retrieve the players identity information.

--- Utils object
local identity = utils.fw.get_identity()

print('Identity:', json.encode(identity))

--- Direct export
local identity = exports.boii_utils:get_identity()

print('Identity:', json.encode(identity))

get_player_id

Use the following function to return the player characters unique identifier. ('passport', 'citizenid', 'stateId', 'identifier', ... )

--- Utils object
local unique_id = utils.fw.get_player_id()

print('Unique ID:', unique_id)

--- Direct export
local unique_id = exports.boii_utils:get_player_id()

print('Unique ID:', unique_id)

player_has_job

Use the following function to check if a player has a specific job with an optional on duty check.

 --- Specify job/s
local jobs = { 'police', 'fib' }
--- If true player must be on duty to pass job check
local require_on_duty = true

--- Utils object
utils.fw.player_has_job(jobs, require_on_duty, function(has_job)
    if has_job then
        print('Player has job.')
    else
        print('Player does not have job.')
    end
end)

--- Direct export
exports.boii_utils:player_has_job(jobs, require_on_duty, function(has_job)
    if has_job then
        print('Player has job.')
    else
        print('Player does not have job.')
    end
end)

get_player_job_grade

Use the following function to return the players grade for a specific job.

--- Specify job
local job = 'police'

--- Utils object
utils.fw.get_player_job_grade(job, function(job_grade)
    if job_grade then
        print('Players job grade: ', job_grade)
    else
        print('No grade found.')
    end
end)

--- Direct export
exports.boii_utils:get_player_job_grade(job, function(job_grade)
    if job_grade then
        print('Players job grade: ', job_grade)
    else
        print('No grade found.')
    end
end)

get_inventory

Use the following function to retrieve the players inventory data.

--- Utils object
utils.fw.get_inventory(function(inventory)
    if inventory then
        print('Players Inventory: ', json.encode(inventory))
    else
        print('No inventory found.')
    end
end)

--- Direct export
exports.boii_utils:get_inventory(function(inventory)
    if inventory then
        print('Players Inventory: ', json.encode(inventory))
    else
        print('No inventory found.')
    end
end)

get_item

Use the following function to retrieve data for a specific item in the players inventory.

--- Specify item
local item = 'lockpick'

--- Utils object
utils.fw.get_item(item, function(inv_item)
    if inv_item then
        print('Item:', json.encode(inv_item))
    else
        print('No item found.')
    end    
end)

--- Direct export
exports.boii_utils:get_item(item, function(inv_item)
    if inv_item then
        print('Item:', json.encode(inv_item))
    else
        print('No item found.')
    end    
end)

has_item

Use the following function to check if a player has a specified item and quantity.

--- Specify item
local item = 'lockpick'
--- Specify quantity
local quantity = 1

--- Utils export
utils.fw.has_item(item, quantity, function(has_item)
    if has_item then
        print('Player has item.')
    else
        print('Player does not have item.')
    end    
end)

--- Direct export
exports.boii_utils:has_item(item, quantity, function(has_item)
    if has_item then
        print('Player has item.')
    else
        print('Player does not have item.')
    end    
end)

Last updated