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:
@@ -61,39 +61,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.hasGroup(filter)
|
||||
if not WSB.playerData or not WSB.playerData.job then return end
|
||||
|
||||
@@ -54,32 +54,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
|
||||
@@ -188,10 +182,31 @@ function WSB.getNameFromPlayerObj(player)
|
||||
end
|
||||
|
||||
function WSB.registerUsableItem(item, cb)
|
||||
if WSB.inventorySystem == 'jaksam_inventory' then
|
||||
exports['jaksam_inventory']:registerUsableItem(item, cb)
|
||||
return
|
||||
end
|
||||
ESX.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 inventory = player.getInventory()
|
||||
@@ -208,6 +223,9 @@ function WSB.getPlayerInventory(source)
|
||||
end
|
||||
|
||||
function WSB.hasItem(source, _item)
|
||||
if WSB.inventorySystem == 'jaksam_inventory' then
|
||||
return exports['jaksam_inventory']:getTotalItemAmount(source, _item) or 0
|
||||
end
|
||||
local player = WSB.getPlayer(source)
|
||||
if not player then return end
|
||||
|
||||
@@ -226,6 +244,10 @@ function WSB.hasItem(source, _item)
|
||||
end
|
||||
|
||||
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
|
||||
local player = WSB.getPlayer(source)
|
||||
if not player then return end
|
||||
if metadata and not WSB.inventory then
|
||||
@@ -236,12 +258,19 @@ 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
|
||||
local player = WSB.getPlayer(source)
|
||||
if not player then return end
|
||||
player.addWeapon(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
|
||||
local player = WSB.getPlayer(source)
|
||||
if not player then return end
|
||||
player.removeInventoryItem(item, count, metadata, slot)
|
||||
|
||||
Reference in New Issue
Block a user