ESXclient
esx:playerLoaded
ESX client documentation with a FiveM Lua example.
Summary
Client event fired when the ESX player is fully loaded, delivering the xPlayer/PlayerData. The right moment to start reading player data in ESX.
Returns
event
Example
RegisterNetEvent('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
PlayerData.job = xPlayer.job
end)
RegisterNetEvent('esx:setJob', function(job)
PlayerData.job = job
end)Common pitfalls
- Reading ESX.GetPlayerData().job before the player loads returns nil — wait for this event or loop until job is set.
- Handle esx:setJob to keep job current, and esx:onPlayerLogout to clear data.
Related functions
Related guides
Managing jobs on your server?
Viper Multi-Job lets players hold several jobs and switch between them with grade, salary and duty handled — QBCore, QBox and ESX, validated server-side.
See Viper Multi-Job →