From 5448eabd87e3c47b9b09d2a21c430dafbdddc6a3 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Wed, 10 Jul 2024 16:21:34 -0700 Subject: [PATCH] Update functions.lua --- client/functions.lua | 66 +++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/client/functions.lua b/client/functions.lua index c7ea049..543cc0e 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -85,11 +85,44 @@ end print"dude, it literally tells you what you need to set it as in the config" end end + +function GetImage(img) + if GetResourceState('ox_inventory') == 'started' then + local Items = exports['ox_inventory']:Items() + if Items[img]['client']['image'] == nil then + return Items[img] + else + return Items[img]['client']['image'] + end + elseif GetResourceState('ps-inventory') == 'started' then + return "nui://ps-inventory/html/images/".. QBCore.Shared.Items[img].image + elseif GetResourceState('lj-inventory') == 'started' then + return "nui://lj-inventory/html/images/".. QBCore.Shared.Items[img].image + elseif GetResourceState('qb-inventory') == 'started' then + return "nui://qb-inventory/html/images/".. QBCore.Shared.Items[img].image + elseif GetResourceState('qs-inventory') == 'started' then + return "nui://qs-inventory/html/img/".. QBCore.Shared.Items[img].image + elseif GetResourceState('origen_inventory') == 'started' then + return "nui://origen_inventory/html/img/".. QBCore.Shared.Items[img].image + elseif GetResourceState('core_inventory') == 'started' then + return "nui://core_inventory/html/img/".. QBCore.Shared.Items[img].image + end +end + +function GetLabel(label) + if GetResourceState('ox_inventory') == 'started' then + local Items = exports['ox_inventory']:Items() + return Items[label]['label'] + else + return QBCore.Shared.Items[label]['label'] + end +end + function ItemCheck(item) local success if GetResourceState('ox_inventory') == 'started' then - if exports.ox_inventory:GetItemCount(item) >= 1 then return true else Notify('You Need ' .. QBCore.Shared.Items[item].label .. " !", 'error') end + if exports.ox_inventory:GetItemCount(item) >= 1 then return true else Notify('You Need ' .. GetLabel(item) .. " !", 'error') end else if QBCore.Shared.Items[item] == nil then print("There Is No " .. item .. " In Your QB Items.lua") return end if QBCore.Functions.HasItem(item) then success = item return success else Notify('You Need ' .. QBCore.Shared.Items[item].label .. " !", 'error') end @@ -176,34 +209,3 @@ function GetCops(number) end -function GetImage(img) - if GetResourceState('ox_inventory') == 'started' then - local Items = exports['ox_inventory']:Items() - if Items[img]['client']['image'] == nil then - return Items[img] - else - return Items[img]['client']['image'] - end - elseif GetResourceState('ps-inventory') == 'started' then - return "nui://ps-inventory/html/images/".. QBCore.Shared.Items[img].image - elseif GetResourceState('lj-inventory') == 'started' then - return "nui://lj-inventory/html/images/".. QBCore.Shared.Items[img].image - elseif GetResourceState('qb-inventory') == 'started' then - return "nui://qb-inventory/html/images/".. QBCore.Shared.Items[img].image - elseif GetResourceState('qs-inventory') == 'started' then - return "nui://qs-inventory/html/img/".. QBCore.Shared.Items[img].image - elseif GetResourceState('origen_inventory') == 'started' then - return "nui://origen_inventory/html/img/".. QBCore.Shared.Items[img].image - elseif GetResourceState('core_inventory') == 'started' then - return "nui://core_inventory/html/img/".. QBCore.Shared.Items[img].image - end -end - -function GetLabel(label) - if GetResourceState('ox_inventory') == 'started' then - local Items = exports['ox_inventory']:Items() - return Items[label]['label'] - else - return QBCore.Shared.Items[label]['label'] - end -end