From 38c83f57f265c0ed45bb3c01bddec7b429e62792 Mon Sep 17 00:00:00 2001 From: Guedes <80121559+thejoaoguedes@users.noreply.github.com> Date: Wed, 8 Mar 2023 15:23:31 -0800 Subject: [PATCH] Added support for ox_inventory Added support for ox_inventory per-item money system --- config.lua | 4 +++- server.lua | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/config.lua b/config.lua index af43f7c..9e8cd50 100644 --- a/config.lua +++ b/config.lua @@ -1,4 +1,6 @@ -Config = {} +Config = { + ox_inventory = false -- Enable if you're using ox_inventory +} Config.BusinessAccounts = { ['police'] = { -- Job Name diff --git a/server.lua b/server.lua index 19f57a4..4d99681 100644 --- a/server.lua +++ b/server.lua @@ -2,17 +2,29 @@ local QBCore = exports["qb-core"]:GetCoreObject() local function addCash(src, amount) local Player = QBCore.Functions.GetPlayer(src) - Player.Functions.AddMoney("cash", amount) + if Config.ox_inventory then + exports.ox_inventory:addCash(src,amount) + else + Player.Functions.AddMoney("cash", amount) + end end local function removeCash(src, amount) local Player = QBCore.Functions.GetPlayer(src) - Player.Functions.RemoveMoney("cash", amount) + if Config.ox_inventory then + exports.ox_inventory:removeCash(src,amount) + else + Player.Functions.RemoveMoney("cash", amount) + end end local function getCash(src) local Player = QBCore.Functions.GetPlayer(src) - return Player.PlayerData.money["cash"] or 0 + if Config.ox_inventory then + return exports.ox_inventory:getCash(src) or 0 + else + return Player.PlayerData.money["cash"] or 0 + end end local function loadPlayer(src, citizenid, name)