fix(qb-core): post-update recovery + centralizare notify 17mov_Hud
Restaurat jobs.lua din git (Quasar fork a suprascris joburile 17mov). Adăugat item map în items.lua (lipsea, rupt rv-maphold). Setat licences.driver = false în config.lua. Override QBCore.Functions.Notify + QBCore:Notify event → 17mov_Hud:ShowNotification (toate notificările merg automat prin 17mov_Hud).
This commit is contained in:
@@ -55,40 +55,33 @@ end)
|
||||
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
function WSB.serverCallback(name, cb, ...)
|
||||
Callback(name, false, cb, ...)
|
||||
lib.callback(name, false, cb, ...)
|
||||
end
|
||||
|
||||
|
||||
function WSB.awaitServerCallback(name, ...)
|
||||
local results = { Callback.awaitResponse(name, false, ...) }
|
||||
return table.unpack(results)
|
||||
return lib.callback.await(name, false, ...)
|
||||
end
|
||||
|
||||
function WSB.registerCallback(name, fn)
|
||||
Callback.register(name, function(source, ...)
|
||||
local responded = false
|
||||
local response = nil
|
||||
|
||||
local cb = function(...)
|
||||
responded = true
|
||||
response = {...}
|
||||
end
|
||||
|
||||
local ok, ret = pcall(function(...)
|
||||
return table.pack(fn(source, cb, ...))
|
||||
end, ...)
|
||||
|
||||
if responded then
|
||||
return table.unpack(response)
|
||||
elseif ret ~= nil then
|
||||
return table.unpack(ret, 1, ret.n)
|
||||
end
|
||||
|
||||
if not ok then
|
||||
print(("[wsb] callback %s threw an error: %s"):format(name, ret))
|
||||
end
|
||||
end)
|
||||
end
|
||||
lib.callback.register(name, function(...)
|
||||
local results = nil
|
||||
local cb = function(...)
|
||||
results = {...}
|
||||
end
|
||||
local ok, ret = pcall(function(...)
|
||||
return table.pack(fn(nil, cb, ...))
|
||||
end, ...)
|
||||
if not ok then
|
||||
error(ret)
|
||||
end
|
||||
if results then
|
||||
return table.unpack(results)
|
||||
end
|
||||
if ret and ret.n then
|
||||
return table.unpack(ret, 1, ret.n)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- function WSB.awaitServerCallback(name, ...)
|
||||
-- local args = { ... }
|
||||
|
||||
@@ -78,32 +78,26 @@ function WSB.getAllJobs()
|
||||
end
|
||||
|
||||
function WSB.awaitClientCallback(name, source, ...)
|
||||
local results = { Callback.awaitResponse(name, source, ...) }
|
||||
return table.unpack(results)
|
||||
return lib.callback.await(name, source, ...)
|
||||
end
|
||||
|
||||
function WSB.registerCallback(name, fn)
|
||||
Callback.register(name, function(source, ...)
|
||||
local responded = false
|
||||
local response = nil
|
||||
|
||||
lib.callback.register(name, function(source, ...)
|
||||
local results = nil
|
||||
local cb = function(...)
|
||||
responded = true
|
||||
response = {...}
|
||||
results = {...}
|
||||
end
|
||||
|
||||
local ok, ret = pcall(function(...)
|
||||
return table.pack(fn(source, cb, ...))
|
||||
local ok, ret = pcall(function(...)
|
||||
return table.pack(fn(source, cb, ...))
|
||||
end, ...)
|
||||
|
||||
if responded then
|
||||
return table.unpack(response)
|
||||
elseif ret ~= nil then
|
||||
return table.unpack(ret, 1, ret.n)
|
||||
end
|
||||
|
||||
if not ok then
|
||||
print(("[wsb] callback %s threw an error: %s"):format(name, ret))
|
||||
error(ret)
|
||||
end
|
||||
if results then
|
||||
return table.unpack(results)
|
||||
end
|
||||
if ret and ret.n then
|
||||
return table.unpack(ret, 1, ret.n)
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -236,6 +230,10 @@ function WSB.getNameFromPlayerObj(player)
|
||||
end
|
||||
|
||||
function WSB.registerUsableItem(item, cb)
|
||||
if WSB.inventorySystem == 'jaksam_inventory' then
|
||||
exports['jaksam_inventory']:registerUsableItem(item, cb)
|
||||
return
|
||||
end
|
||||
if qboxFound then
|
||||
exports.qbx_core:CreateUseableItem(item, cb)
|
||||
else
|
||||
@@ -244,6 +242,23 @@ function WSB.registerUsableItem(item, cb)
|
||||
end
|
||||
|
||||
function WSB.getPlayerInventory(source)
|
||||
if WSB.inventorySystem == 'jaksam_inventory' then
|
||||
local inv = exports['jaksam_inventory']:getInventory(source)
|
||||
if not inv or not inv.items then return {} end
|
||||
local cleanedItems, count = {}, 0
|
||||
for _, item in pairs(inv.items) do
|
||||
if item and item.name then
|
||||
count = count + 1
|
||||
cleanedItems[count] = {
|
||||
name = item.name,
|
||||
amount = item.amount or 0,
|
||||
count = item.amount or 0,
|
||||
metadata = item.metadata or {}
|
||||
}
|
||||
end
|
||||
end
|
||||
return cleanedItems
|
||||
end
|
||||
local player = WSB.getPlayer(source)
|
||||
if not player then return end
|
||||
local cleanedItems, count = {}, 0
|
||||
@@ -256,10 +271,12 @@ function WSB.getPlayerInventory(source)
|
||||
end
|
||||
end
|
||||
return cleanedItems or {}
|
||||
|
||||
end
|
||||
|
||||
function WSB.hasItem(source, _item)
|
||||
if WSB.inventorySystem == 'jaksam_inventory' then
|
||||
return exports['jaksam_inventory']:getTotalItemAmount(source, _item) or 0
|
||||
end
|
||||
if qboxFound or oxFound then
|
||||
return exports.ox_inventory:GetItem(source, _item, nil, true) or 0
|
||||
end
|
||||
@@ -274,6 +291,10 @@ local qsFound = qsInventory == 'started' or qsInventory == 'starting' or false
|
||||
|
||||
|
||||
function WSB.addItem(source, item, count, slot, metadata)
|
||||
if WSB.inventorySystem == 'jaksam_inventory' then
|
||||
local ok = exports['jaksam_inventory']:addItem(source, item, count or 1, metadata, slot)
|
||||
return ok
|
||||
end
|
||||
if qboxFound or oxFound then
|
||||
return exports.ox_inventory:AddItem(source, item, count, metadata, slot)
|
||||
end
|
||||
@@ -290,6 +311,9 @@ function WSB.addItem(source, item, count, slot, metadata)
|
||||
end
|
||||
|
||||
function WSB.addWeapon(source, weapon, ammo)
|
||||
if WSB.inventorySystem == 'jaksam_inventory' then
|
||||
return exports['jaksam_inventory']:addItem(source, weapon, 1, nil, nil)
|
||||
end
|
||||
if qboxFound or oxFound then
|
||||
return exports.ox_inventory:AddItem(source, weapon, 1)
|
||||
end
|
||||
@@ -300,6 +324,10 @@ function WSB.addWeapon(source, weapon, ammo)
|
||||
end
|
||||
|
||||
function WSB.removeItem(source, item, count, slot, metadata)
|
||||
if WSB.inventorySystem == 'jaksam_inventory' then
|
||||
local ok = exports['jaksam_inventory']:removeItem(source, item, count or 1, metadata, slot)
|
||||
return ok
|
||||
end
|
||||
if qboxFound or oxFound then
|
||||
return exports.ox_inventory:RemoveItem(source, item, count, metadata, slot)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user