diff --git a/client/cl_main.lua b/client/cl_main.lua index 28b0e9b..4bd7920 100644 --- a/client/cl_main.lua +++ b/client/cl_main.lua @@ -2,7 +2,7 @@ -----------------For support, scripts, and more---------------- --------------- https://discord.gg/AeCVP2F8h7 ------------- --------------------------------------------------------------- - +QBCore = exports['qb-core']:GetCoreObject() local function DoProgress(cb) if Config.Progress == "qb" then QBCore.Functions.Progressbar("opening-gunrack", "Opening Gunrack", 5000, false, true, { @@ -44,8 +44,19 @@ local function OpenGunrack(plate, doProgress) return end end - if Config.Inventory == "qb" or Config.Inventory == "qs" then - TriggerServerEvent("inventory:server:OpenInventory", "stash", "gunrack_car_"..plate, { + + if Config.Inventory == "qb" then + if Config.QBInventory == "old" then + TriggerServerEvent("inventory:server:OpenInventory", "stash", "gunrack_car_"..plate, { + maxweight = Config.StashSize, + slots = Config.StashSlots, + }) + TriggerEvent("inventory:client:SetCurrentStash", "gunrack_car_"..plate) + elseif Config.QBInventory == "new" then + TriggerServerEvent("snipe-cargunrack:server:openGunrack", plate) + end + elseif Config.Inventory == "qs" then + TriggerServerEvent("inventory:server:OpenInventory", "stash", "gunrack_car_"..plate, { maxweight = Config.StashSize, slots = Config.StashSlots, }) @@ -100,4 +111,4 @@ exports('ForceOpenGunrack', ForceOpenGunrack) RegisterCommand("cargunrack", function() OpenCarGunrack() -end, false) \ No newline at end of file +end, false) diff --git a/server/sv_main.lua b/server/sv_main.lua index 4c040b5..f1380ba 100644 --- a/server/sv_main.lua +++ b/server/sv_main.lua @@ -2,7 +2,7 @@ -----------------For support, scripts, and more---------------- --------------- https://discord.gg/AeCVP2F8h7 ------------- --------------------------------------------------------------- - +QBCore = exports['qb-core']:GetCoreObject() function Trim(value) if not value then return nil end return (string.gsub(value, '^%s*(.-)%s*$', '%1')) @@ -33,4 +33,15 @@ RegisterNetEvent("snipe-cargunrack:server:registerStash", function(stashId, inve exports['mf-inventory']:createInventory(stashId, 'inventory', 'stash', stashId, Config.StashSize, Config.StashSlots) end end -end) \ No newline at end of file +end) + +RegisterNetEvent('snipe-cargunrack:server:openGunrack', function(plate) + local src = source + local Player = QBCore.Functions.GetPlayer(src) + if Player then + exports['qb-inventory']:OpenInventory(src, 'gunrack_car_'..plate, { + maxweight = Config.StashSize, + slots = Config.StashSlots, + }) + end +end) diff --git a/shared/config.lua b/shared/config.lua index 682c510..2f9f99f 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -1,8 +1,6 @@ - -----------------For support, scripts, and more---------------- --------------- https://discord.gg/AeCVP2F8h7 ------------- --------------------------------------------------------------- - Config = {} -- if you have renamed your qb-core, es_extended, event names, make sure to change them. Based on this information your framework will be detected. @@ -28,10 +26,11 @@ Config.AllowedCarsModel = { } -Config.Inventory = "ox" -- qb || qs || ox || mf || codem +Config.Inventory = "qb" -- qb || qs || ox || mf || codem +Config.QBInventory = "new" -- new for new version, old for old version. -- if you set this as false and a player opens a vehicle is not owned by anyone, the gunrack will not appear after restart because the plate wont match! -Config.AllowGunracksForOwnedVehicles = true -- if true, only owned vehicles will have gunracks. +Config.AllowGunracksForOwnedVehicles = false -- if true, only owned vehicles will have gunracks. Config.AllowOnlyJobsToAccessGunracks = true -- if true, only the jobs listed in JobsToAccessGunracks will be able to access the gunracks. Config.JobsToAccessGunracks = {