Client-side Exports
dr-bridge provides a variety of client-side exports that can be accessed and used in other scripts. Below is a detailed breakdown of all the available exports, including input formats, return values,
Core Exports
GetPlayerData()
Description: Returns the player's data, including their job, money, items, etc.
Input: None.
Output: Returns a table containing:
GetJob()
Description: Returns the player's current job.
Input: None.
Output: Returns a table:
GetMoney(account)
Description: Returns the player's balance for a specific account (default is "cash").
Input:
account
(string, optional) - the account type (e.g.,"cash"
,"bank"
).Output: Returns a number representing the player's balance for the specified account.
HasItem(item, count)
Description: Checks if the player has a specific item and quantity.
Input:
item
(string): Item name (e.g.,"water"
,"weapon_pistol"
).count
(number, optional): Item count. Default is1
.
Output: Returns boolean (
true
orfalse
).
Notify(text, type)
Description: Displays a notification to the player.
Input:
text
(string): The text to display.type
(string, optional): Notification type (e.g.,"info"
,"success"
,"error"
). Default is"info"
.
Output: None (displays a notification).
IsDead()
Description: Checks if the player is dead.
Input: None.
Output: Returns boolean (
true
if the player is dead,false
otherwise).
GetCoords()
Description: Returns the player's current coordinates.
Input: None.
Output: Returns a vector3:
IsInVehicle()
Description: Checks if the player is in a vehicle.
Input: None.
Output: Returns boolean (
true
if the player is in a vehicle,false
otherwise).
GetPed()
Description: Returns the player's Ped ID.
Input: None.
Output: Returns a number (the player's Ped ID).
TriggerCallback(name, cb, ...)
Description: Triggers a server callback and returns the result to the client callback function. Works with both QBCore and ESX viadr-bridge
. Input:name
(string): The name of the server callback to trigger.cb
(function): A function that receives the result from the server....
(any): Additional arguments passed to the server callback.
Output: None (calls the callback function with the result).
Example:
Extras
Show3DText(coords, text, scale)
Description: Displays 3D text at the given coordinates.
Input:
coords
(vector3): Coordinates where the text will appear.text
(string): The text to display.scale
(number, optional): The scale of the text. Default is0.35
.
Output: None (displays the text).
AddBlip(coords, sprite, color, scale, label)
Description: Adds a blip to the map at the specified coordinates.
Input:
coords
(vector3): The position of the blip.sprite
(number): The sprite ID for the blip.color
(number): The color of the blip.scale
(number, optional): The scale of the blip. Default is0.8
.label
(string): The label text of the blip.
Output: Returns a number (blip ID).
DrawMarker(coords, type, scale, color)
Description: Draws a marker at the specified coordinates.
Input:
coords
(vector3): Coordinates of the marker.type
(number, optional): Type of the marker (default is1
).scale
(vector3): The scale of the marker.color
(table): The color of the marker in{r, g, b, a}
format.
Output: None (draws the marker).
PlayAnim(dict, anim, flag)
Description: Plays an animation on the player.
Input:
dict
(string): The animation dictionary.anim
(string): The animation name.flag
(number, optional): The animation flag (default is1
).
Output: None (plays the animation).
ShowHelpNotification(text)
Description: Shows a help notification on the screen.
Input:
text
(string): The text to display in the notification.
Output: None (displays the help notification).
ShowNotification(text)
Description: Shows a basic notification at the top of the screen.
Input:
text
(string): The text to display.
Output: None (displays the notification).
Interaction
AddTargetEntity(entity, options)
Description: Adds a target interaction to a specific entity.
Input:
entity
(number): The entity ID.options
(table): Options for the interaction.
Output: None (adds the interaction).
AddTargetModel(model, options)
Description: Adds a target interaction to a specific model.
Input:
model
(number): The model ID.options
(table): Options for the interaction.
Output: None (adds the interaction).
AddTargetZone(zone, options)
Description: Adds a target interaction to a specific zone.
Input:
zone
(table): The zone's coordinates and dimensions.options
(table): Options for the interaction.
Output: None (adds the interaction).
RemoveTargetEntity(entity)
Description: Removes a target interaction from a specific entity.
Input:
entity
(number): The entity ID.
Output: None (removes the interaction).
RemoveTargetModel(model)
Description: Removes a target interaction from a specific model.
Input:
model
(number): The model ID.
Output: None (removes the interaction).
RemoveTargetZone(zone)
Description: Removes a target interaction from a specific zone.
Input:
zone
(table): The zone's coordinates and dimensions.
Output: None (removes the interaction).
UpdateTargetOptions(options)
Description: Updates the options for target interactions.
Input:
options
(table): New options for the interaction.
Output: None (updates the options).
UI
ShowTextUI(text, position)
Description: Displays text UI at a specified position on the screen.
Input:
text
(string): The text to display.position
(string, optional): The position of the text (default is"left"
).
Output: None (displays the text).
HideTextUI()
Description: Hides the displayed text UI.
Input: None.
Output: None (hides the text).
Shared Utils
DebugPrint(message)
Description: Prints a debug message to the console if debug mode is enabled.
Input:
message
(string): The message to print.
Output: None (prints the message to the console).
TableHasValue(table, value)
Description: Checks if a table contains a specific value.
Input:
table
(table): The table to search in.value
(any): The value to search for.
Output: Returns boolean (
true
if the value exists,false
otherwise).
DeepCopy(table)
Description: Creates a deep copy of a table.
Input:
table
(table): The table to copy.
Output: Returns a new table that is a deep copy of the input table.
Round(number, decimals)
Description: Rounds a number to a specified number of decimal places.
Input:
number
(number): The number to round.decimals
(number, optional): The number of decimal places to round to. Default is0
.
Output: Returns a number (rounded value).
IsTable(value)
Description: Checks if the given value is a table.
Input:
value
(any): The value to check.
Output: Returns boolean (
true
if the value is a table,false
otherwise).
WaitForCondition(condition)
Description: Waits until a specified condition is met.
Input:
condition
(function): The condition to check (should returntrue
when met).
Output: None (waits for the condition).
Last updated