Client
Make sure to check the qb.lua and esx.lua files for examples on how to implement the phone for your framework. They are always up to date with the latest changes.
Step 1: Check Framework Compatibility
At the top of the file, add a check for Config.Framework. If it's not set to your framework, return to prevent it from loading.
if Config.Framework ~= "your-framework" then
return
endStep 2: Wait for Player to Fully Load
Next, you need to wait for the player to load. How this is done depends on your framework. Once the player's character has loaded, set loaded = true. This lets the phone know that your framework has loaded, and is ready to be used.
while not ESX.PlayerLoaded do
Wait(500)
endStep 3: Required Framework Functions
You need to implement the following functions for the phone to work with your framework.
FreamworkNotification
Used to display notifications
GetClosestPlayer
Finds nearest players
GetVehiclesInArea
Returns vehicles in the specified area
GetClosestVehicle
Returns the closest vehicle to the player
GetPlayersInArea
This function gets all players in the given radius.
GetPlayerBankBalance
Returns the player's bank money
VehicleCreate
Step 4: Required Framework Events
Player load/unload/switching character
For character information when a character is loaded
When the character logs out, this closes the phone, ends calls, etc.
Player Die/handcuffed character
When a character dies or is handcuffed
Last updated