Skip to content

Commit

Permalink
fix: populate shared.weapons from ox_inventory weapons
Browse files Browse the repository at this point in the history
  • Loading branch information
0Programmer committed Feb 15, 2025
1 parent 92021e2 commit eb7a7de
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 8 additions & 0 deletions bridge/qb/shared/main.lua
Original file line number Diff line number Diff line change
@@ -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] = {
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion shared/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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<number, Vehicle>
qbShared.VehicleHashes = {}
Expand Down
2 changes: 1 addition & 1 deletion shared/weapons.lua
Original file line number Diff line number Diff line change
@@ -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<number, Weapon>
return {}

0 comments on commit eb7a7de

Please sign in to comment.