Skip to content

Commit

Permalink
feat(bridge/qbx): sync dynamic account types
Browse files Browse the repository at this point in the history
This covers setting the account data for multiple money types i.e money and black_money as defined by the inventory:accounts convar
  • Loading branch information
solareon committed Aug 14, 2024
1 parent 937f775 commit 86229c8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/bridge/qbx/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ local function setupPlayer(playerData)
playerData.name = ('%s %s'):format(playerData.charinfo.firstname, playerData.charinfo.lastname)
server.setPlayerInventory(playerData)

Inventory.SetItem(playerData.source, 'money', playerData.money.cash)
local accounts = Inventory.GetAccountItemCounts(playerData.source)
if not accounts then return end
for account in pairs(accounts) do
local playerAccount = account == 'money' and 'cash' or account
Inventory.SetItem(playerData.source, account, playerData.money[playerAccount])
end
end

AddStateBagChangeHandler('loadInventory', nil, function(bagName, _, value)
Expand Down

0 comments on commit 86229c8

Please sign in to comment.