mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 14:56:02 +01:00
separate create dui event
This commit is contained in:
@@ -478,7 +478,7 @@ function stashRemoveItem(stashItems, stashName, items) local amount = amount and
|
|||||||
|
|
||||||
elseif GetResourceState(OrigenInv):find("start") then
|
elseif GetResourceState(OrigenInv):find("start") then
|
||||||
for k, v in pairs(items) do
|
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
|
if Config.System.Debug then print("^6Bridge^7: ^2Removing item from ^3Stash^2 with ^7"..OrigenInv, k, v) end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -40,12 +40,13 @@ function loadPtfxDict(ptFxName)
|
|||||||
end
|
end
|
||||||
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 unloadPtfxDict(dict) if Config.System.Debug then print("^6Bridge^7: ^2Removing Ptfx Dictionary^7: '^6"..dict.."^7'") end RemoveNamedPtfxAsset(dict) end
|
||||||
|
|
||||||
function loadTextureDict(dict)
|
function loadTextureDict(dict)
|
||||||
if not HasStreamedTextureDictLoaded(dict) then
|
if not HasStreamedTextureDictLoaded(dict) then
|
||||||
if Config.System.Debug then
|
if Config.System.Debug then
|
||||||
print("^6Bridge^7: ^2Loading Texture Dictionary^7: '^6"..dict.."^7'")
|
print("^6Bridge^7: ^2Loading Texture Dictionary^7: '^6"..dict.."^7'")
|
||||||
end
|
end
|
||||||
while not HasStreamedTextureDictLoaded(dict) do RequestNamedPtfxAsset(dict) Wait(5) end
|
while not HasStreamedTextureDictLoaded(dict) do RequestStreamedTextureDict(dict) Wait(5) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -230,6 +231,7 @@ function ensureNetToVeh(vehNetID)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local previewTxd = not IsDuplicityVersion() and CreateRuntimeTxd(GetCurrentResourceName()..'previewTxd') or nil
|
local previewTxd = not IsDuplicityVersion() and CreateRuntimeTxd(GetCurrentResourceName()..'previewTxd') or nil
|
||||||
|
local customDUIList = {}
|
||||||
function makeBlip(data)
|
function makeBlip(data)
|
||||||
local blip = AddBlipForCoord(vec3(data.coords.x, data.coords.y, data.coords.z))
|
local blip = AddBlipForCoord(vec3(data.coords.x, data.coords.y, data.coords.z))
|
||||||
SetBlipAsShortRange(blip, true)
|
SetBlipAsShortRange(blip, true)
|
||||||
@@ -243,12 +245,9 @@ function makeBlip(data)
|
|||||||
EndTextCommandSetBlipName(blip)
|
EndTextCommandSetBlipName(blip)
|
||||||
if GetResourceState("blip_info"):find("start") or GetResourceState("blip-info"):find("start") or GetResourceState("blipinfo"):find("start") then
|
if GetResourceState("blip_info"):find("start") or GetResourceState("blip-info"):find("start") or GetResourceState("blipinfo"):find("start") then
|
||||||
if data.preview 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
|
if data.preview:find("http") then
|
||||||
local newTxt = CreateDui(data.preview, 512, 256)
|
createNewDui(txname, data.preview, { 512, 256 })
|
||||||
local duihandle = GetDuiHandle(newTxt)
|
|
||||||
while not GetDuiHandle(newTxt) do Wait(0) end
|
|
||||||
CreateRuntimeTextureFromDuiHandle(previewTxd, txname, duihandle)
|
|
||||||
else
|
else
|
||||||
CreateRuntimeTextureFromImage(previewTxd, txname, data.preview)
|
CreateRuntimeTextureFromImage(previewTxd, txname, data.preview)
|
||||||
end
|
end
|
||||||
@@ -260,6 +259,16 @@ function makeBlip(data)
|
|||||||
return blip
|
return blip
|
||||||
end
|
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)
|
function makeEntityBlip(data)
|
||||||
AddBlipForEntity(data.entity)
|
AddBlipForEntity(data.entity)
|
||||||
local blip = GetBlipFromEntity(data.entity)
|
local blip = GetBlipFromEntity(data.entity)
|
||||||
@@ -274,12 +283,9 @@ function makeEntityBlip(data)
|
|||||||
EndTextCommandSetBlipName(blip)
|
EndTextCommandSetBlipName(blip)
|
||||||
if GetResourceState("blip_info"):find("start") or GetResourceState("blip-info"):find("start") or GetResourceState("blipinfo"):find("start") then
|
if GetResourceState("blip_info"):find("start") or GetResourceState("blip-info"):find("start") or GetResourceState("blipinfo"):find("start") then
|
||||||
if data.preview then
|
if data.preview then
|
||||||
local txname = tostring('preview'..keyGen()..keyGen())
|
local txname = data.name..'preview'
|
||||||
if data.preview:find("http") then
|
if data.preview:find("http") then
|
||||||
local newTxt = CreateDui(data.preview, 512, 256)
|
createNewDui(txname, data.preview, { 512, 256 })
|
||||||
local duihandle = GetDuiHandle(newTxt)
|
|
||||||
while not GetDuiHandle(newTxt) do Wait(0) end
|
|
||||||
CreateRuntimeTextureFromDuiHandle(previewTxd, txname, duihandle)
|
|
||||||
else
|
else
|
||||||
CreateRuntimeTextureFromImage(previewTxd, txname, data.preview)
|
CreateRuntimeTextureFromImage(previewTxd, txname, data.preview)
|
||||||
end
|
end
|
||||||
@@ -747,7 +753,7 @@ function dupeWarn(src, item, amount)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function getDurability(item)
|
function getDurability(item)
|
||||||
local lowestSlot = 100
|
local lowestSlot = 100 -- anything above your players max slots
|
||||||
local durability = nil
|
local durability = nil
|
||||||
if GetResourceState(QBInv):find("start") then
|
if GetResourceState(QBInv):find("start") then
|
||||||
local itemcheck = Core.Functions.GetPlayerData().items
|
local itemcheck = Core.Functions.GetPlayerData().items
|
||||||
@@ -775,7 +781,6 @@ end
|
|||||||
RegisterNetEvent(GetCurrentResourceName()..":server:setMetaData", function(data)
|
RegisterNetEvent(GetCurrentResourceName()..":server:setMetaData", function(data)
|
||||||
local src = source
|
local src = source
|
||||||
if GetResourceState(QBInv):find("start") then
|
if GetResourceState(QBInv):find("start") then
|
||||||
print(src, data.item, 1, data.slot)
|
|
||||||
local Player = Core.Functions.GetPlayer(src)
|
local Player = Core.Functions.GetPlayer(src)
|
||||||
|
|
||||||
Player.PlayerData.items[data.slot].info = data.metadata
|
Player.PlayerData.items[data.slot].info = data.metadata
|
||||||
|
|||||||
Reference in New Issue
Block a user