Framework
Universal framework compatibility layer that provides consistent access to player data, jobs, and framework-specific functions across various frameworks. This is the foundation module that enables cross-framework development.
Client Functions
GetResourceName
Returns the name of the underlying framework resource being used.
local resourceName = dBridge.Framework.GetResourceName()| Returned Data | Type | Description |
|---|---|---|
resourceName | string | The name of the framework resource (e.g., "es_extended"). |
IsPlayerLoaded
Returns whether the player has fully loaded into the server.
local isLoaded = dBridge.Framework.IsPlayerLoaded()| Returned Data | Type | Description |
|---|---|---|
isLoaded | boolean | True if the player is loaded. |
GetPlayerData
Returns the player's core data (identifier, job, etc.).
local playerData = dBridge.Framework.GetPlayerData()| Returned Data | Type | Description |
|---|---|---|
playerData | table | The player data object. |
GetPlayerIdentifier
Returns the player's identifier (citizenid).
local identifier = dBridge.Framework.GetPlayerIdentifier()| Returned Data | Type | Description |
|---|---|---|
identifier | string | nil | The player identifier. |
GetPlayerName
Returns player's name.
local name = dBridge.Framework.GetPlayerName()| Returned Data | Type | Description |
|---|---|---|
name | {fullName: string, firstName: string, lastName: string} | Table containing full, first, and last names. |
GetPlayerGender
Returns the player's gender.
local gender = dBridge.Framework.GetPlayerGender()| Returned Data | Type | Description |
|---|---|---|
name | 'male' | 'female' | nil | The player gender. |
GetPlayerDob
Returns the player's date of birth.
local dob = dBridge.Framework.GetPlayerDob()| Returned Data | Type | Description |
|---|---|---|
dob | string | Date of birth string. |
IsPlayerDead
Returns whether the player is currently dead or in a last-stand state.
local isDead = dBridge.Framework.IsPlayerDead()| Returned Data | Type | Description |
|---|---|---|
isDead | boolean | True if the player is dead. |
GetPlayerJob
Returns the player's job.
local job = dBridge.Framework.GetPlayerJob()| Returned Data | Type | Description |
|---|---|---|
job | {name: string, label: string, grade: number, gradeLabel: string} | Job details. |
PlayerHasJob
Checks if the player has a specific job.
local hasJob = dBridge.Framework.PlayerHasJob('police', 2)| Argument | Type | Description |
|---|---|---|
jobName | string | The name of the job. |
jobGrade? | number | The job grade (optional). |
| Returned Data | Type | Description |
|---|---|---|
hasJob | boolean | True if player has the job. |
GetPlayerGroup
Returns the player's permission group.
local group = dBridge.Framework.GetPlayerGroup()| Returned Data | Type | Description |
|---|---|---|
group | string | nil | The player group. |
GetClosestPlayer
Returns the closest player and distance.
local playerId, distance = dBridge.Framework.GetClosestPlayer()| Returned Data | Type | Description |
|---|---|---|
playerId | number | The server ID of the closest player. |
distance | number | Distance to the player. |
GetClosestVehicle
Returns the closest vehicle and distance.
local vehicleId, distance = dBridge.Framework.GetClosestVehicle()| Returned Data | Type | Description |
|---|---|---|
vehicleId | number | The entity ID of the closest vehicle. |
distance | number | Distance to the vehicle. |
Notify
Sends a notification to the player.
dBridge.Framework.Notify('Hello World', 'success', 5000)| Argument | Type | Description |
|---|---|---|
message | string | The notification message. |
type? | 'success' | 'error' | 'info' | 'warning' | The type of notification. |
duration? | number | Duration in milliseconds. |
ShowTextUI
Displays a text UI (help text) on the screen.
dBridge.Framework.ShowTextUI('Press [E] to interact')| Argument | Type | Description |
|---|---|---|
text | string | Text to display. |
HideTextUI
Hide the currently active TextUI.
dBridge.Framework.HideTextUI()GetAccountBalance
Returns the balance of a specific account.
local balance = dBridge.Framework.GetAccountBalance('bank')| Argument | Type | Description |
|---|---|---|
accountType | 'money' | 'bank' | 'cash' | Type of account. |
| Returned Data | Type | Description |
|---|---|---|
balance | number | The account balance. |
GetItemCount ESX QBCore
Returns the count of a specific item.
local count = dBridge.Framework.GetItemCount('water')| Argument | Type | Description |
|---|---|---|
items | string | string[] | Item name or list of names. |
| Returned Data | Type | Description |
|---|---|---|
count | number | Count of the item(s). |
HasItem ESX QBCore
Checks if the player has a specific item.
local hasItem = dBridge.Framework.HasItem('water', 1)| Argument | Type | Description |
|---|---|---|
items | string | string[] | Item name or list of names. |
itemCount | number | Quantity required. |
| Returned Data | Type | Description |
|---|---|---|
hasItem | boolean | True if player has the item(s). |
GetPlayerInventory ESX QBCore
Returns the player's full inventory.
local inventory = dBridge.Framework.GetPlayerInventory()| Returned Data | Type | Description |
|---|---|---|
inventory | table | The inventory table. |
Server Functions
GetResourceName
Returns the name of the underlying framework resource being used.
local resourceName = dBridge.Framework.GetResourceName()| Returned Data | Type | Description |
|---|---|---|
resourceName | string | The name of the framework resource (e.g., "es_extended"). |
GetPlayerFromId
Returns player data from player ID.
local player = dBridge.Framework.GetPlayerFromId(source)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
| Returned Data | Type | Description |
|---|---|---|
player | table | nil | The player data object. |
GetPlayerFromIdentifier
Returns player data from player identifier.
local player = dBridge.Framework.GetPlayerFromIdentifier(identifier)| Argument | Type | Description |
|---|---|---|
identifier | string | The player identifier (e.g., citizenid). |
| Returned Data | Type | Description |
|---|---|---|
player | table | nil | The player data object. |
GetPlayerIdentifier
Returns the player's identifier (citizenid).
local identifier = dBridge.Framework.GetPlayerIdentifier(source)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
| Returned Data | Type | Description |
|---|---|---|
identifier | string | nil | The player identifier. |
GetPlayerName
Returns the player's name.
local name = dBridge.Framework.GetPlayerName(source)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
| Returned Data | Type | Description |
|---|---|---|
name | {fullName: string, firstName: string, lastName: string} | Table containing full, first, and last names. |
GetPlayerGender
Returns the player's gender.
local gender = dBridge.Framework.GetPlayerGender(source)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
| Returned Data | Type | Description |
|---|---|---|
gender | 'male' | 'female' | nil | The player gender. |
GetPlayerDob
Returns the player's date of birth.
local dob = dBridge.Framework.GetPlayerDob(source)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
| Returned Data | Type | Description |
|---|---|---|
dob | string | Date of birth string. |
GetPlayerJob
Returns the player's job.
local job = dBridge.Framework.GetPlayerJob(source)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
| Returned Data | Type | Description |
|---|---|---|
job | {name: string, label: string, grade: number, gradeLabel: string} | Job details. |
GetJobCount
Returns the number of players with a specific job.
local count = dBridge.Framework.GetJobCount('police')| Argument | Type | Description |
|---|---|---|
jobName | string | The name of the job. |
| Returned Data | Type | Description |
|---|---|---|
count | number | Number of players with the job. |
GetAllPlayers
Returns a table of all logged-in players.
local players = dBridge.Framework.GetAllPlayers()| Returned Data | Type | Description |
|---|---|---|
players | table | List of players. |
GetFrameworkJobs
Returns the jobs registered in the framework.
local jobs = dBridge.Framework.GetFrameworkJobs()
print(json.encode(jobs, { indent = true }))SetPlayerJob
Sets the player's job.
local success = dBridge.Framework.SetPlayerJob(source, 'police', 0)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
jobName | string | The name of the job. |
jobGrade? | number | The job grade (optional). |
| Returned Data | Type | Description |
|---|---|---|
success | boolean | Whether the operation was successful. |
PlayerHasJob
Checks if the player has a specific job.
local hasJob = dBridge.Framework.PlayerHasJob(source, 'police', 2)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
jobName | string | The name of the job. |
jobGrade? | number | The job grade (optional). |
| Returned Data | Type | Description |
|---|---|---|
hasJob | boolean | True if player has the job. |
GetAccountBalance
Returns the balance of a specific account.
local balance = dBridge.Framework.GetAccountBalance(source, 'bank')| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
accountType | 'money' | 'bank' | 'cash' | Type of account. |
| Returned Data | Type | Description |
|---|---|---|
balance | number | The account balance. |
AddAccountBalance
Adds money to a specific account.
local success = dBridge.Framework.AddAccountBalance(source, 'bank', 1000)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
accountType | 'money' | 'bank' | 'cash' | Type of account. |
amount | number | Amount to add. |
| Returned Data | Type | Description |
|---|---|---|
success | boolean | Whether the operation was successful. |
RemoveAccountBalance
Removes money from a specific account.
local success = dBridge.Framework.RemoveAccountBalance(source, 'bank', 500)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
accountType | 'money' | 'bank' | 'cash' | Type of account. |
amount | number | Amount to remove. |
| Returned Data | Type | Description |
|---|---|---|
success | boolean | Whether the operation was successful. |
RegisterUsableItem
Registers a callback for a usable item.
dBridge.Framework.RegisterUsableItem('bandage', function(source, item)
print('Used bandage')
end)| Argument | Type | Description |
|---|---|---|
itemName | string | Name of the item. |
cb | function | Callback function to execute. |
AddItem ESX QBCore
Adds an item to the player's inventory.
local success = dBridge.Framework.AddItem(source, 'water', 1)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
itemName | string | Name of the item. |
itemCount | number | Quantity to add. |
metadata? | table | Item metadata (optional). |
slot? | number | Specific slot (optional). |
| Returned Data | Type | Description |
|---|---|---|
success | boolean | Whether the operation was successful. |
RemoveItem ESX QBCore
Removes an item from the player's inventory.
local success = dBridge.Framework.RemoveItem(source, 'water', 1)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
itemName | string | Name of the item. |
itemCount | number | Quantity to remove. |
metadata? | table | Item metadata (optional). |
slot? | number | Specific slot (optional). |
| Returned Data | Type | Description |
|---|---|---|
success | boolean | Whether the operation was successful. |
GetItemCount ESX QBCore
Returns the count of a specific item.
local count = dBridge.Framework.GetItemCount(source, 'water')| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
items | string | string[] | Item name or list of names. |
| Returned Data | Type | Description |
|---|---|---|
count | number | Count of the item(s). |
HasItem ESX QBCore
Checks if the player has a specific item.
local hasItem = dBridge.Framework.HasItem(source, 'water', 1)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
items | string | string[] | Item name or list of names. |
itemCount | number | Quantity required. |
| Returned Data | Type | Description |
|---|---|---|
hasItem | boolean | True if player has the item(s). |
GetItemData ESX QBCore
Returns item data by name or slot.
local item = dBridge.Framework.GetItemData(source, 'water')| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
itemName | string | Name of the item. |
metadata? | table | Item metadata (optional). |
slot? | number | Specific slot (optional). |
| Returned Data | Type | Description |
|---|---|---|
item | table | The item data. |
GetItemByName ESX QBCore
Returns item data by name.
local item = dBridge.Framework.GetItemByName(source, 'water')| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
itemName | string | Name of the item. |
metadata? | table | Item metadata (optional). |
slot? | number | Specific slot (optional). |
| Returned Data | Type | Description |
|---|---|---|
item | table | The item data. |
GetItemBySlot QBCore
Returns item data by slot.
local item = dBridge.Framework.GetItemBySlot(source, 1)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
slot | number | The slot number. |
| Returned Data | Type | Description |
|---|---|---|
item | table | The item data. |
SetMetadata QBCore
Sets metadata for an item in a specific slot.
dBridge.Framework.SetMetadata(source, 1, { durability = 100 })| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
slot | number | The slot number. |
metadata | table | The metadata table. |
GetPlayerInventory ESX QBCore
Returns the player's full inventory.
local inventory = dBridge.Framework.GetPlayerInventory(source)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
| Returned Data | Type | Description |
|---|---|---|
inventory | table | The inventory table. |
ClearPlayerInventory ESX QBCore
Clears the player's inventory.
dBridge.Framework.ClearPlayerInventory(source)| Argument | Type | Description |
|---|---|---|
source | number | The player ID (source). |
GetItemlabel ESX QBCore
Returns the label of an item.
local label = dBridge.Framework.GetItemlabel('water')| Argument | Type | Description |
|---|---|---|
itemName | string | Name of the item. |
| Returned Data | Type | Description |
|---|---|---|
label | string | The item label. |
Items ESX QBCore
Returns a list of all items or a specific item definition.
local items = dBridge.Framework.Items()| Argument | Type | Description |
|---|---|---|
itemName? | string | Name of the item (optional). |
| Returned Data | Type | Description |
|---|---|---|
items | table | The items table. |