To install on the ESX framework, it is very simple. You will first need to replace the shared lines in your fxmanifest which by default comes like this:
Then, in the HUD config file, you will need to add this code at the top of the page:
ESX = exports["es_extended"]:getSharedObject()
With all these steps done, now you will replace the getUserInfo function in your config, which by default will look like this:
getUserInfo = function(source)
local userInfo = {
id = 12,
job = "Lixeiro",
bank = 2000,
money = 50000
}
return userInfo -- Table containing { id = number, job = string, bank = number, money = number }
end
For this one:
getUserInfo = function(source)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
userInfo = {
id = xPlayer.source,
job = xPlayer.job.name,
bank = xPlayer.getAccount("bank").money,
money = xPlayer.getMoney()
}
else
userInfo = {
id = 0,
job = "Wanted Store",
bank = 0,
money = 0
}
end
return userInfo -- Table containing { id = number, job = string, bank = number, money = number }
end
That's it, the function of pulling information from the screen onto its base is ready. Leave feedback on our discord about our service, our product, and our documentation.