Framework Bridge
The Core Bridge module provides a unified API across multiple frameworks for player data, identity, inventory, balances, jobs, and more. The examples below reflect the boii_core implementation, but the API remains consistent across all supported frameworks.
Accessing the Module
local CORE <const> = exports.boii_utils:get("bridges.framework")
Server
get_players()
Returns all players connected to the server.
Parameters
-
-
None
Example
local players = CORE.get_players()
get_player(source)
Retrieves player data by source ID.
Parameters
source
number
Player source ID
Example
local player = CORE.get_player(source)
get_id_params(source)
Generates identifier query and parameters.
Parameters
source
number
Player source ID
Example
local query, params = CORE.get_id_params(source)
get_player_id(source)
Returns the player's main identifier.
Parameters
source
number
Player source ID
Example
local id = CORE.get_player_id(source)
get_identity(source)
Returns a player's identity information.
Parameters
source
number
Player source ID
Example
local identity = CORE.get_identity(source)
get_inventory(source)
Gets a player's inventory.
Parameters
source
number
Player source ID
Example
local inventory = CORE.get_inventory(source)
get_item(source, item_name)
Gets a specific item from the player's inventory.
Parameters
source
number
Player source ID
item_name
string
Name of the item
Example
local item = CORE.get_item(source, "radio")
has_item(source, item_name, item_amount?)
Checks if a player has an item in their inventory.
Parameters
source
number
Player source ID
item_name
string
Name of the item
item_amount?
number
Optional quantity (default: 1)
Example
if CORE.has_item(source, "bandage", 2) then
-- has at least 2 bandages
end
add_item(source, item_id, amount, data?)
Adds an item to a player's inventory.
Parameters
source
number
Player source ID
item_id
string
ID of the item
amount
number
Quantity
data?
table
Optional metadata (e.g. ammo)
Example
CORE.add_item(source, "ammo_9mm", 50)
remove_item(source, item_id, amount)
Removes an item from a player's inventory.
Parameters
source
number
Player source ID
item_id
string
ID of the item
amount
number
Quantity to remove
Example
CORE.remove_item(source, "radio", 1)
update_item_data(source, item_id, updates)
Modifies an item entry (e.g. ammo or durability).
Parameters
source
number
Player source ID
item_id
string
ID of the item
updates
table
Data to apply (key/value)
Example
CORE.update_item_data(source, "weapon_pistol", { durability = 95 })
get_balances(source)
Returns all account balances.
Parameters
source
number
Player source ID
Example
local balances = CORE.get_balances(source)
get_balance_by_type(source, balance_type)
Gets a specific account balance.
Parameters
source
number
Player source ID
balance_type
string
Type: "cash", "bank"
Example
local cash = CORE.get_balance_by_type(source, "cash")
add_balance(source, balance_type, amount, sender?, note?)
Adds money to a player account.
Parameters
source
number
Player source ID
balance_type
string
Account type
amount
number
Amount to add
sender?
string
Optional sender description
note?
string
Optional transaction note
Example
CORE.add_balance(source, "bank", 1000, "ATM", "Paycheck")
remove_balance(source, balance_type, amount, recipient?, note?)
Removes money from a player account.
Parameters
source
number
Player source ID
balance_type
string
Account type
amount
number
Amount to remove
recipient?
string
Optional recipient name
note?
string
Optional transaction note
Example
CORE.remove_balance(source, "cash", 250)
get_player_jobs(source)
Returns a list of jobs the player currently holds.
Parameters
source
number
Player source identifier
Example
local jobs = CORE.get_player_jobs(source)
for _, job in pairs(jobs) do
print("Job:", job)
end
player_has_job(source, job_names, check_on_duty?)
Checks whether a player has one of the specified jobs. Optionally checks if they're on duty.
Parameters
source
number
Player source identifier
job_names
table
List of job names to check
check_on_duty
boolean?
Whether to require on-duty status
Example
local hasJob = CORE.player_has_job(source, { "police" }, true)
get_player_job_grade(source, job_id)
Returns the player's rank (grade) for the specified job.
Parameters
source
number
Player source identifier
job_id
string
Job ID to check
Example
local grade = CORE.get_player_job_grade(source, "police")
count_players_by_job(job_names, check_on_duty?)
Counts players with a specific job. Optionally checks duty status.
Parameters
job_names
table
List of job names to count
check_on_duty
boolean?
Whether to check for on-duty only
Example
local total, onduty = CORE.count_players_by_job({ "ambulance" }, true)
get_player_job_name(source)
Returns the first job name assigned to a player.
Parameters
source
number
Player source identifier
Example
local job = CORE.get_player_job_name(source)
adjust_statuses(source, statuses)
Applies status modifications to a player server-side.
Parameters
source
number
Player source identifier
statuses
table
Table of status values
Example
CORE.adjust_statuses(source, { hunger = -10, thirst = -5 })
register_item(item, cb)
Registers an item as usable and calls the callback on use.
Parameters
item
string
Name of the usable item
cb
function
Function to run on item usage
Example
CORE.register_item("joint", function(source)
print("Joint used by:", source)
end)
Client
get_data(key?)
Returns the full or partial player data table.
Parameters
key
string
(Optional) Specific key to get
Example
local data = CORE.get_data("identity")
get_identity()
Returns a structured identity object.
Example
local id = CORE.get_identity()
print("Name:", id.first_name, id.last_name)
get_player_id()
Returns the current player's unique identifier.
Example
local player_id = CORE.get_player_id()
Last updated