Usage
In this section, we will explain how to use the core functions and features of dr-bridge for both client-side and server-side scripts.
Client-side API
The client-side API provides several functions that allow you to interact with the player's data, display UI elements, and manage player interactions. Here are some key client-side functions available in dr-bridge
:
GetPlayerData()
Returns the player’s data such as job, money, items, etc.
GetJob()
Returns the player's current job data.
GetMoney(account)
Returns the player's balance for the specified account (cash by default).
HasItem(item, count)
Checks if the player has a specific item with a specified count.
Notify(text, type)
Displays a notification to the player (supports different types).
IsDead()
Checks if the player is dead.
GetCoords()
Returns the player's current coordinates.
IsInVehicle()
Checks if the player is in a vehicle.
GetPed()
Returns the player's Ped ID (useful for animations, actions).
Server-side API
The server-side API allows you to manage player data, economy, jobs, items, and more. Below are some of the core server-side functions available in dr-bridge
:
GetPlayer(source)
Returns the player data for the specified source.
GetJob(source)
Returns the player's job for the specified source.
SetJob(source, job, grade)
Sets the player's job and grade.
GetMoney(source, account)
Retrieves the player's balance for the specified account.
AddMoney(source, amount, account)
Adds the specified amount of money to the player's account.
RemoveMoney(source, amount, account)
Removes the specified amount of money from the player's account.
AddItem(source, item, count, slot, metadata)
Adds an item to the player's inventory.
RemoveItem(source, item, count, slot)
Removes an item from the player's inventory.
HasItem(source, item, count)
Checks if the player has a specific item with a given count.
Calling Exports
You can call client-side or server-side functions using exports. This allows you to access dr-bridge
functions in other scripts.
Client-side Example:
To call a function from the client-side, you can use the following:
Server-side Example:
To call a function from the server-side, you can use:
You can also use exports to call any client or server function directly from another script, ensuring that dr-bridge
's functionality is available across your entire project.
Last updated