Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions client/cl_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -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,
})
Expand Down Expand Up @@ -100,4 +111,4 @@ exports('ForceOpenGunrack', ForceOpenGunrack)

RegisterCommand("cargunrack", function()
OpenCarGunrack()
end, false)
end, false)
15 changes: 13 additions & 2 deletions server/sv_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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)
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)
7 changes: 3 additions & 4 deletions shared/config.lua
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 = {
Expand Down