esx fivem code example
Example 1: fivem esx init
ESX = nil
playerData = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
playerData = ESX.GetPlayerData()
end)
Example 2: fivem esx script
// Initializing ESX and PlayerData
ESX = nil
playerData = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
playerData = ESX.GetPlayerData()
end)