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:
@@ -0,0 +1,63 @@
|
||||
local id = 0
|
||||
local MugshotsCache = {}
|
||||
local Answers = {}
|
||||
|
||||
function GetMugShotBase64(Ped,Tasparent)
|
||||
if not Ped then return "" end
|
||||
id = id + 1
|
||||
|
||||
local Handle = RegisterPedheadshot(Ped)
|
||||
|
||||
local timer = 2000
|
||||
while ((not Handle or not IsPedheadshotReady(Handle) or not IsPedheadshotValid(Handle)) and timer > 0) do
|
||||
Citizen.Wait(10)
|
||||
timer = timer - 10
|
||||
end
|
||||
|
||||
local MugShotTxd = 'none'
|
||||
if (IsPedheadshotReady(Handle) and IsPedheadshotValid(Handle)) then
|
||||
MugshotsCache[id] = Handle
|
||||
MugShotTxd = GetPedheadshotTxdString(Handle)
|
||||
end
|
||||
|
||||
SendNUIMessage({
|
||||
type = 'convert',
|
||||
pMugShotTxd = MugShotTxd,
|
||||
removeImageBackGround = Tasparent or false,
|
||||
id = id,
|
||||
})
|
||||
|
||||
local p = promise.new()
|
||||
Answers[id] = p
|
||||
|
||||
return Citizen.Await(p)
|
||||
end
|
||||
exports("GetMugShotBase64", GetMugShotBase64)
|
||||
|
||||
RegisterNUICallback('Answer', function(data)
|
||||
if MugshotsCache[data.Id] then
|
||||
UnregisterPedheadshot(MugshotsCache[data.Id])
|
||||
MugshotsCache[data.Id] = nil
|
||||
end
|
||||
Answers[data.Id]:resolve(data.Answer)
|
||||
Answers[data.Id] = nil
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStop', function(resourceName)
|
||||
if (GetCurrentResourceName() ~= resourceName) then
|
||||
return
|
||||
end
|
||||
for k,v in pairs(MugshotsCache) do
|
||||
UnregisterPedheadshot(v)
|
||||
end
|
||||
MugshotsCache = {}
|
||||
id = 0
|
||||
end)
|
||||
|
||||
RegisterCommand("base64mugshotNormal",function(source,args,rawCommand)
|
||||
print(GetMugShotBase64(GetPlayerPed(-1),false))
|
||||
end,false)
|
||||
|
||||
RegisterCommand("base64mugshotTrasParent",function(source,args,rawCommand)
|
||||
print(GetMugShotBase64(GetPlayerPed(-1),true))
|
||||
end,false)
|
||||
Reference in New Issue
Block a user