From 134c0b9f6e3fb11e5cf8c6485bf04833425fbaed Mon Sep 17 00:00:00 2001 From: DosKit <56743692+DosKit@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:50:50 -0500 Subject: [PATCH 1/2] Adjustments 1. Adjust Itembox to allow Single Named items. This allows to push the itembox without always needing the entire data on each script. 2. add a item check in the thread to help avoid spamming the server on press when item don't exist. --- client/main.lua | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/client/main.lua b/client/main.lua index 1418f5e..b7d46b6 100644 --- a/client/main.lua +++ b/client/main.lua @@ -135,13 +135,9 @@ RegisterNetEvent('inventory:client:CheckOpenState', function(type, id, label) end end) -RegisterNetEvent('inventory:client:ItemBox', function(itemData, type, amount) - SendNUIMessage({ - action = "itemBox", - item = itemData, - type = type, - amount = amount or 1, - }) +RegisterNetEvent('inventory:client:ItemBox', function(idata, itype, amount) + local idata = type(idata) == 'string' and sharedItems[idata] or idata + SendNUIMessage({action = "itemBox", item = idata, type = itype, amount = amount or 1}) end) AddEventHandler('inventory:client:requiredItems', function(items) @@ -368,31 +364,31 @@ CreateThread(function() DisableControlAction(0, 0x26E9DC00) DisableControlAction(0, 0xAC4BD4F1) -- Disable Weapon Wheel and Item Wheel DisableControlAction(0, 0xB238FE0B) -- Disable Quick Select for Weapons - if IsDisabledControlPressed(0, 0xE6F612E4) and IsInputDisabled(0) then -- 1 slot + if IsDisabledControlPressed(0, 0xE6F612E4) and IsInputDisabled(0) and PlayerData.items[1] then -- 1 slot if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then TriggerServerEvent("inventory:server:UseItemSlot", 1) end end - if IsDisabledControlPressed(0, 0x1CE6D9EB) and IsInputDisabled(0) then -- 2 slot + if IsDisabledControlPressed(0, 0x1CE6D9EB) and IsInputDisabled(0) and PlayerData.items[2] then -- 2 slot if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then TriggerServerEvent("inventory:server:UseItemSlot", 2) end end - if IsDisabledControlPressed(0, 0x4F49CC4C) and IsInputDisabled(0) then -- 3 slot + if IsDisabledControlPressed(0, 0x4F49CC4C) and IsInputDisabled(0) and PlayerData.items[3] then -- 3 slot if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then TriggerServerEvent("inventory:server:UseItemSlot", 3) end end - if IsDisabledControlPressed(0, 0x8F9F9E58) and IsInputDisabled(0) then -- 4 slot + if IsDisabledControlPressed(0, 0x8F9F9E58) and IsInputDisabled(0) and PlayerData.items[4] then -- 4 slot if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then TriggerServerEvent("inventory:server:UseItemSlot", 4) end end - if IsDisabledControlPressed(0, 0xAB62E997) and IsInputDisabled(0) then -- 5 slot + if IsDisabledControlPressed(0, 0xAB62E997) and IsInputDisabled(0) and PlayerData.items[5] then -- 5 slot if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then TriggerServerEvent("inventory:server:UseItemSlot", 5) end @@ -424,4 +420,4 @@ CreateThread(function() end Wait(500) end -end) \ No newline at end of file +end) From 1433c462fd9b46852251ce27ce96d1b35ef7ecb4 Mon Sep 17 00:00:00 2001 From: DosKit <56743692+DosKit@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:52:45 -0500 Subject: [PATCH 2/2] Version Bump Version Bump --- fxmanifest.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 72333c1..1a7492b 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -3,7 +3,7 @@ game 'rdr3' rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.' description 'QBR-Inventory' -version '1.0.1' +version '1.0.2' shared_scripts { '@qbr-core/shared/locale.lua', @@ -33,4 +33,4 @@ files { 'html/*.ttf' } -lua54 'yes' \ No newline at end of file +lua54 'yes'