Installation on the QBCORE framework is very simple. First you will need to add this code at the top of the page:
QBCore = exports['qb-core']:GetCoreObject()
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 Player = QBCore.Functions.GetPlayer(source)
if Player then
userInfo = {
id = Player.PlayerData.source,
job = Player.PlayerData.job.name,
bank = Player.PlayerData.money["bank"],
money = Player.PlayerData.money["cash"],
}
return userInfo
else
return nil -- Return nil or handle the case where the player is not found
end
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.