Documentation
  • 👋Introduction
  • 📚Guides
    • Useful Links
  • 🆓boii_utils
    • Installation
    • Configuration
    • Modules
    • API
      • Callbacks
      • Characters
      • Commands
      • Cooldowns
      • Debugging
      • Entities
      • Environment
      • Framework Bridge
      • Geometry
      • Items
      • Keys
      • Licences
      • Maths
      • Methods
      • Player
      • Requests
      • Strings
      • Tables
      • Timestamps
      • UI Bridges
      • Vehicles
      • Version
      • XP
      • UI Elements
Powered by GitBook
On this page
  • Accessing the Module
  • Server
  • get_players()
  • get_player(source)
  • get_id_params(source)
  • get_player_id(source)
  • get_identity(source)
  • get_inventory(source)
  • get_item(source, item_name)
  • has_item(source, item_name, item_amount?)
  • add_item(source, item_id, amount, data?)
  • remove_item(source, item_id, amount)
  • update_item_data(source, item_id, updates)
  • get_balances(source)
  • get_balance_by_type(source, balance_type)
  • add_balance(source, balance_type, amount, sender?, note?)
  • remove_balance(source, balance_type, amount, recipient?, note?)
  • get_player_jobs(source)
  • player_has_job(source, job_names, check_on_duty?)
  • get_player_job_grade(source, job_id)
  • count_players_by_job(job_names, check_on_duty?)
  • get_player_job_name(source)
  • adjust_statuses(source, statuses)
  • register_item(item, cb)
  • Client
  • get_data(key?)
  • get_identity()
  • get_player_id()
  1. boii_utils
  2. API

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

Name
Type
Description

-

-

None

Example

local players = CORE.get_players()

get_player(source)

Retrieves player data by source ID.

Parameters

Name
Type
Description

source

number

Player source ID

Example

local player = CORE.get_player(source)

get_id_params(source)

Generates identifier query and parameters.

Parameters

Name
Type
Description

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

Name
Type
Description

source

number

Player source ID

Example

local id = CORE.get_player_id(source)

get_identity(source)

Returns a player's identity information.

Parameters

Name
Type
Description

source

number

Player source ID

Example

local identity = CORE.get_identity(source)

get_inventory(source)

Gets a player's inventory.

Parameters

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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()
PreviousEnvironmentNextGeometry

Last updated 1 month ago

🆓