From dda17e316521c7f60e772b342036056d3d2dd2af Mon Sep 17 00:00:00 2001 From: Tom <111147401+1OSaft@users.noreply.github.com> Date: Tue, 6 Feb 2024 19:00:13 +0100 Subject: [PATCH] Add files via upload Fixed an error --- client/client.lua | 34 ++++++++++++++++++---------------- fxmanifest.lua | 2 +- server/server.lua | 8 +++++--- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/client/client.lua b/client/client.lua index 6f662d8..fe4d1fe 100644 --- a/client/client.lua +++ b/client/client.lua @@ -7,21 +7,23 @@ local timeout, changed, puttedon = false, false, false local function PutOnBag(bagtype) bagtype = bagtype - if Config.Debug then print("Putting on Backpack") end - if Config.Debug then print("Bag type: " .. bagtype) end - if Config.Framework == 'ESX' then - TriggerEvent('skinchanger:getSkin', function(skin) - if skin.sex == 0 then - TriggerEvent('skinchanger:loadClothes', skin, Config.Backpacks[bagtype].Uniform.Male) - else - TriggerEvent('skinchanger:loadClothes', skin, Config.Backpacks[bagtype].Uniform.Female) - end - saveSkin() - end) - elseif Config.Framework == 'ND' then - local appearance = fivemAppearance:getPedAppearance(cache.ped) + if bagtype ~= nil then + if Config.Debug then print("Putting on Backpack") end + if Config.Debug then print("Bag type: " .. bagtype) end + if Config.Framework == 'ESX' then + TriggerEvent('skinchanger:getSkin', function(skin) + if skin.sex == 0 then + TriggerEvent('skinchanger:loadClothes', skin, Config.Backpacks[bagtype].Uniform.Male) + else + TriggerEvent('skinchanger:loadClothes', skin, Config.Backpacks[bagtype].Uniform.Female) + end + saveSkin() + end) + elseif Config.Framework == 'ND' then + local appearance = fivemAppearance:getPedAppearance(cache.ped) + end + bagEquipped, CurrentBag = true, bagtype end - bagEquipped, CurrentBag = true, bagtype end saveSkin = function() @@ -55,7 +57,7 @@ function tableChange(data) for vbag in pairs(Config.Backpacks) do count = ox_inventory:Search('count', vbag) if count > 0 then - if count >= 1 and bagEquipped == nil then + if count >= 1 then PutOnBag(vbag) if Config.Debug then print("Count: " .. count) @@ -72,7 +74,7 @@ function boolChange() count = count + ox_inventory:Search('count', vbag) end - if count > 0 and bagEquipped == true then + if count > 0 then if count >= 1 then PutOnBag(vbag) if Config.Debug then diff --git a/fxmanifest.lua b/fxmanifest.lua index b66c7b1..03f8675 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -3,7 +3,7 @@ game 'gta5' lua54 'yes' description 'Wasabi Backpack for Ox Inventory' -version '1.0.7' +version '1.0.8' client_scripts { 'client/**.lua' diff --git a/server/server.lua b/server/server.lua index 3c412ac..86a15d1 100644 --- a/server/server.lua +++ b/server/server.lua @@ -70,10 +70,12 @@ CreateThread(function() end if Config.OneBagInInventory then - if (move_type == "player" and count_bagpacks > 0 and toinv ~= fromInv) and string.find(payload.fromSlot.name, 'bag') then - TriggerClientEvent('ox_lib:notify', payload.source, + if (move_type == "player" and count_bagpacks > 0 and string.find(payload.fromSlot.name, 'bag')) then + if fromInv ~= toInv then + TriggerClientEvent('ox_lib:notify', payload.source, { type = 'error', title = Strings.action_incomplete, description = Strings.one_backpack_only }) - return false + return false + end end end return true