Skip to content

Commit

Permalink
fix: ox core
Browse files Browse the repository at this point in the history
  • Loading branch information
Coffeelot committed Dec 20, 2024
1 parent 0ac69a6 commit 093357b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions bridge/server/ox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function addMoney(src, moneyType, amount)
return exports.ox_inventory:AddItem(src, 'money', amount)
else
local account = player.getAccount()
return account.addBalance({ amount, 'Racing' })
local result = account.addBalance({ amount = amount, message = 'RacingApp Payout' })
if Config.Debug then print('Ox Banking result for adding:', json.encode(result, {indent=true})) end
return result.sucess
end
end

Expand All @@ -29,7 +31,9 @@ function removeMoney(src, moneyType, amount, reason)
return exports.ox_inventory:RemoveItem(src, 'money', amount)
else
local account = player.getAccount()
return account.removeBalance({ amount, reason or 'Racing', true })
local result = account.removeBalance({ amount = amount, message = reason or 'RacingApp Charge' })
if Config.Debug then print('Account balance', account.get('balance')) print('Ox Banking result for removing:', json.encode(result, {indent=true})) end
return result.success
end
end

Expand All @@ -38,11 +42,11 @@ function canPay(src, moneyType, cost)
local player = Ox.GetPlayer(tonumber(src))
if not player then return false end
if moneyType == 'cash' or moneyType == 'money' then
print(src, moneyType, cost)
return exports.ox_inventory:Search(src, 'count', 'money') >= cost
else
local account = player.getAccount()
return account.balance >= tonumber(cost)
if not account then return false end
return account.get('balance') >= tonumber(cost)
end
end

Expand All @@ -56,7 +60,7 @@ end

-- Fetches the Source of an online player by citizenid
function getSrcOfPlayerByCitizenId(citizenId)
local player = Ox.GetPlayerFromFilter({ stateId = tonumber(citizenId) })
local player = Ox.GetPlayerFromFilter({ stateId = citizenId })
if not player then return nil end

return player.source
Expand Down

0 comments on commit 093357b

Please sign in to comment.