qb-core
qb-core copied to clipboard
[BUG] Existing players cant have new money accounts
Summary
If you register a new money account, all existing players won't have it only new characters
Reproduction
1 - Register a new money account in qb-core/config.lua > QBConfig.Money.MoneyTypes and QBConfig.Money.DontAllowMinus, name it however you want, in my case I used "cosmo".
2 - Add the following command to any server.lua (ofc make sure to load QBCore object first)
RegisterCommand("test", function(source,args)
local Player = QBCore.Functions.GetPlayer(source)
local account = args[1]
print("account: "..account, "amount: ", Player.PlayerData.money[account])
end)
3 - Use the command /test [account name] and it should print your current balance, it prints 0 if the account exists and it'll print nil if the account doesn't exist in the player data.
4 - Logout and create a new character
5 - Use the command with the new character, cosmo will be printed with a 0 instead of nil.
6 - Verify the players table and the old character doesn't have the new accounts, the new one does have it.
Expected behavior
Print 0 because money account exists but balance is 0, this is the behavior in previous versions of qb-core, I'm currently running one from April which works ok, all new accounts are added to existing and new players but the most recent version of qb-core is not adding them.
Actual behavior
It prints nil meaning the account doesn't exist and is not adding the account to the player money table in database
Additional context
No clue how to solve it tbh, I think is has something to do with the applyDefaults function
Last Updated
today
Custom Resources
None
Resource Rename
qb-core