From eb7a7de8024aa56b23a94a885e26b446ab0a8793 Mon Sep 17 00:00:00 2001 From: root <60280452+0Programmer@users.noreply.github.com> Date: Sat, 15 Feb 2025 18:35:07 +0100 Subject: [PATCH] fix: populate shared.weapons from ox_inventory weapons --- bridge/qb/shared/main.lua | 8 ++++++++ shared/main.lua | 1 - shared/weapons.lua | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bridge/qb/shared/main.lua b/bridge/qb/shared/main.lua index 62053012f..7b8fe1a5a 100644 --- a/bridge/qb/shared/main.lua +++ b/bridge/qb/shared/main.lua @@ -1,6 +1,7 @@ local qbShared = require 'shared.main' qbShared.Items = {} +qbShared.Weapons = {} local oxItems = require '@ox_inventory.data.items' for item, data in pairs(oxItems) do qbShared.Items[item] = { @@ -32,6 +33,13 @@ for weapon, data in pairs(oxWeapons.Weapons) do combinable = nil, description = nil } + qbShared.Weapons[weapon] = { + name = weapon, + label = data.label, + weapontype = data.throwable and 'Throwable' or (not data.ammoname and 'Melee' or 'Gun'), + ammotype = data.ammoname or nil, + damagereason = '' + } end for component, data in pairs(oxWeapons.Components) do component = string.lower(component) diff --git a/shared/main.lua b/shared/main.lua index 3fc9cbf89..aefb57f52 100644 --- a/shared/main.lua +++ b/shared/main.lua @@ -2,7 +2,6 @@ local qbShared = {} qbShared.ForceJobDefaultDutyAtLogin = true -- true: Force duty state to jobdefaultDuty | false: set duty state from database last saved qbShared.Locations = require 'shared.locations' qbShared.Vehicles = require 'shared.vehicles' -qbShared.Weapons = require 'shared.weapons' ---@type table qbShared.VehicleHashes = {} diff --git a/shared/weapons.lua b/shared/weapons.lua index 7385f3a92..590cd121e 100644 --- a/shared/weapons.lua +++ b/shared/weapons.lua @@ -1,3 +1,3 @@ ----@deprecated This file is deprecated and will be removed in the future. If you are utilizing QB-Core bridge functionality you will need to populate weapons here for them to be available in QBCore.Shared.Weapons. If not please add your weapons in ox_inventory/data/weapons.lua file. Currently weapons in this file will be converted on next server start. +---@deprecated This file is deprecated and will be removed in the future. Please add your weapons in ox_inventory/data/weapons.lua file. Currently weapons in this file will be converted on next server start. ---@type table return {} \ No newline at end of file