separate create dui event

This commit is contained in:
Jim Shield
2024-02-16 22:42:13 +00:00
committed by GitHub
parent 4848b51ecc
commit f1ae24d0fe
2 changed files with 19 additions and 14 deletions

View File

@@ -478,7 +478,7 @@ function stashRemoveItem(stashItems, stashName, items) local amount = amount and
elseif GetResourceState(OrigenInv):find("start") then
for k, v in pairs(items) do
exports[OrigenInv]:RemoveFromStash(stashName, nil, k, v)
exports[OrigenInv]:RemoveFromStash(stashName, k, v)
if Config.System.Debug then print("^6Bridge^7: ^2Removing item from ^3Stash^2 with ^7"..OrigenInv, k, v) end
end

View File

@@ -40,12 +40,13 @@ function loadPtfxDict(ptFxName)
end
end
function unloadPtfxDict(dict) if Config.System.Debug then print("^6Bridge^7: ^2Removing Ptfx Dictionary^7: '^6"..dict.."^7'") end RemoveNamedPtfxAsset(dict) end
function loadTextureDict(dict)
if not HasStreamedTextureDictLoaded(dict) then
if Config.System.Debug then
print("^6Bridge^7: ^2Loading Texture Dictionary^7: '^6"..dict.."^7'")
end
while not HasStreamedTextureDictLoaded(dict) do RequestNamedPtfxAsset(dict) Wait(5) end
while not HasStreamedTextureDictLoaded(dict) do RequestStreamedTextureDict(dict) Wait(5) end
end
end
@@ -230,6 +231,7 @@ function ensureNetToVeh(vehNetID)
end
local previewTxd = not IsDuplicityVersion() and CreateRuntimeTxd(GetCurrentResourceName()..'previewTxd') or nil
local customDUIList = {}
function makeBlip(data)
local blip = AddBlipForCoord(vec3(data.coords.x, data.coords.y, data.coords.z))
SetBlipAsShortRange(blip, true)
@@ -243,12 +245,9 @@ function makeBlip(data)
EndTextCommandSetBlipName(blip)
if GetResourceState("blip_info"):find("start") or GetResourceState("blip-info"):find("start") or GetResourceState("blipinfo"):find("start") then
if data.preview then
local txname = tostring('preview'..keyGen()..keyGen())
local txname = tostring(data.name..'preview'..string.gsub(data.coords.z, "%.", ""))
if data.preview:find("http") then
local newTxt = CreateDui(data.preview, 512, 256)
local duihandle = GetDuiHandle(newTxt)
while not GetDuiHandle(newTxt) do Wait(0) end
CreateRuntimeTextureFromDuiHandle(previewTxd, txname, duihandle)
createNewDui(txname, data.preview, { 512, 256 })
else
CreateRuntimeTextureFromImage(previewTxd, txname, data.preview)
end
@@ -260,6 +259,16 @@ function makeBlip(data)
return blip
end
function createNewDui(name, http, size)
if not customDUIList[name] then
local newTxt = CreateDui(http, size[1], size[2])
local duihandle = GetDuiHandle(newTxt)
while not GetDuiHandle(newTxt) do Wait(0) end
CreateRuntimeTextureFromDuiHandle(previewTxd, name, duihandle)
customDUIList[name] = true
else return end
end
function makeEntityBlip(data)
AddBlipForEntity(data.entity)
local blip = GetBlipFromEntity(data.entity)
@@ -274,12 +283,9 @@ function makeEntityBlip(data)
EndTextCommandSetBlipName(blip)
if GetResourceState("blip_info"):find("start") or GetResourceState("blip-info"):find("start") or GetResourceState("blipinfo"):find("start") then
if data.preview then
local txname = tostring('preview'..keyGen()..keyGen())
local txname = data.name..'preview'
if data.preview:find("http") then
local newTxt = CreateDui(data.preview, 512, 256)
local duihandle = GetDuiHandle(newTxt)
while not GetDuiHandle(newTxt) do Wait(0) end
CreateRuntimeTextureFromDuiHandle(previewTxd, txname, duihandle)
createNewDui(txname, data.preview, { 512, 256 })
else
CreateRuntimeTextureFromImage(previewTxd, txname, data.preview)
end
@@ -747,7 +753,7 @@ function dupeWarn(src, item, amount)
end
function getDurability(item)
local lowestSlot = 100
local lowestSlot = 100 -- anything above your players max slots
local durability = nil
if GetResourceState(QBInv):find("start") then
local itemcheck = Core.Functions.GetPlayerData().items
@@ -775,7 +781,6 @@ end
RegisterNetEvent(GetCurrentResourceName()..":server:setMetaData", function(data)
local src = source
if GetResourceState(QBInv):find("start") then
print(src, data.item, 1, data.slot)
local Player = Core.Functions.GetPlayer(src)
Player.PlayerData.items[data.slot].info = data.metadata