StartESX
Start ESX with a line, dont need any return, all will be done automatically.
It also automatically loads player data (like the job, that auto update)
the ESX
and xPlayer
variables are made available
Argument | Data Type | Needed | Default | Description |
---|---|---|---|---|
esxEventName | string | esx:getSharedObject | The esx event, if you have the replaced trigger | |
Second Job | string | - | If you have set up the second job in the utility configuration, you need to enter the name here for it to auto-update |
Dont need to be called every frame
Example
StartESX()
Old method
ESX = nil
local PlayerData = {}
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
while ESX.GetPlayerData().job == nil do
Citizen.Wait(1)
end
PlayerData = ESX.GetPlayerData()
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(xPlayer)
PlayerData = xPlayer
end)
Last update: April 12, 2022
Created: June 27, 2021
Created: June 27, 2021