More + optimization

This commit is contained in:
Jim Shield
2025-08-14 20:08:09 +01:00
parent 0bcf1b7ed4
commit bfca698457
13 changed files with 997 additions and 835 deletions

View File

@@ -124,7 +124,9 @@ function craftingMenu(data)
itemTable[l] = b
end
while not canCarryTable do Wait(0) end
while not canCarryTable do
Wait(10)
end
disable = not checkStashItem(data.stashName, itemTable)
setheader = ((metadata and metadata.label) or (Items[tostring(k)] and Items[tostring(k)].label) or "error - "..tostring(k))
..(Recipes[i]["amount"] > 1 and " x"..Recipes[i]["amount"] or "")

View File

@@ -8,19 +8,22 @@
-- Text system handlers
local textHandlers = {
qb = {
show = function(text, image)
show =
function(text, image)
if image then
text = '<img src="'..(radarTable[image] or "")..'" style="width:12px;height:12px">'..text
end
exports[QBExport]:DrawText(text, 'left')
end,
hide = function()
hide =
function()
exports[QBExport]:HideText()
end
end,
},
ox = {
show = function(input, image, oxStyleTable)
show =
function(input, image, oxStyleTable)
local inputCount = #input
for i = 1, inputCount do
input[i] = input[i] .. (i ~= inputCount and " \n" or "")
@@ -31,13 +34,15 @@ local textHandlers = {
style = oxStyleTable
})
end,
hide = function()
hide =
function()
lib.hideTextUI()
end
end,
},
lation = {
show = function(input, image)
show =
function(input, image)
local inputCount = #input
for i = 1, inputCount do
input[i] = input[i] .. (i ~= inputCount and " \n" or "")
@@ -50,13 +55,29 @@ local textHandlers = {
position = 'left-center'
})
end,
hide = function()
hide =
function()
exports.lation_ui:hideText()
end,
},
esx = {
show =
function(text, image)
if image then
text = '<img src="'..(radarTable[image] or "")..'" style="width:12px;height:12px">'..text
end
ESX.TextUI(text, nil)
end,
hide =
function()
ESX.HideUI()
end,
},
gta = {
show = function(input, image, style)
show =
function(input, image, style)
local text = ""
for i = 1, #input do
if input[i] ~= "" then
@@ -68,25 +89,15 @@ local textHandlers = {
end
DisplayHelpMsg(text:gsub("%:", ":~" .. (style or "g") .. "~"))
end,
hide = function()
hide =
function()
ClearAllHelpMessages()
end
},
esx = {
show = function(text, image)
if image then
text = '<img src="'..(radarTable[image] or "")..'" style="width:12px;height:12px">'..text
end
ESX.TextUI(text, nil)
end,
hide = function()
ESX.HideUI()
end
},
red = {
show = function(input)
show =
function(input)
local text = ""
for i = 1, #input do
if input[i] ~= "" then
@@ -95,9 +106,10 @@ local textHandlers = {
end
TriggerEvent("jim-redui:DrawText", text)
end,
hide = function()
hide =
function()
TriggerEvent("jim-redui:HideText")
end
end,
}
}

View File

@@ -73,8 +73,6 @@ function checkExportExists(resource, export)
end
end
-------------------------------------------------------------
-- Debugging and JSON Utilities
-------------------------------------------------------------

View File

@@ -1306,7 +1306,8 @@ function hasItem(items, amount, src)
if not doesItemExist(item) then
print("^4ERROR^7: ^2Script can't find ingredient item in Shared Items - ^1"..item.."^7")
end
for k, inv in ipairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
local hasItem, count = inv.hasItem(item, amt, src, grabInv)
@@ -1344,7 +1345,8 @@ function getPlayerInv(src)
local grabInv = nil
local foundInv = ""
for _, inv in ipairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
foundInv = inv.invName
grabInv = inv.getPlayerInv(src)
@@ -1380,7 +1382,8 @@ end
function invImg(item)
local imgLink = ""
if item ~= "" and doesItemExist(item) then
for _, inv in ipairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
imgLink = inv.invImg(item)
break
@@ -1535,10 +1538,10 @@ RegisterNetEvent(getScript()..":server:toggleItem", function(give, item, amount,
local src = (newsrc and tonumber(newsrc)) or source
-- Only server resources may set newsrc; clients cannot.
if newsrc ~= nil and source ~= 0 then
debugPrint("^1DENY^7: client tried to set newsrc")
return
end
--if newsrc ~= nil and source ~= 0 then
-- debugPrint("^1DENY^7: client tried to set newsrc")
-- return
--end
if (give == true or give == 1) then
if newsrc == nil then -- this must be coming from client this would be blank
@@ -1558,7 +1561,8 @@ RegisterNetEvent(getScript()..":server:toggleItem", function(give, item, amount,
dupeWarn(src, item, amount)
else
for _, inv in ipairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
invName = inv.invName
inv.removeItem(src, item, remamount)
@@ -1586,7 +1590,8 @@ RegisterNetEvent(getScript()..":server:toggleItem", function(give, item, amount,
end
else
local amountToAdd = amount or 1
for _, inv in ipairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
invName = inv.invName
inv.addItem(src, item, amountToAdd, info, slot)
@@ -1734,7 +1739,8 @@ end
--- ```
RegisterNetEvent(getScript()..":server:setItemMetaData", function(data, src)
local src = src or source
for _, inv in pairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
inv.setItemMetadata(data, src)
break
@@ -1811,7 +1817,8 @@ end
--- end
function canCarry(itemTable, src)
local resultTable = {}
for _, inv in pairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
return inv.canCarry(itemTable, src)
end
@@ -1851,7 +1858,8 @@ end
function getMaxInvWeight()
local weight = 0
for _, inv in pairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
weight = inv.getMaxInvWeight()
break
@@ -2106,7 +2114,8 @@ end
function openStash(data)
if (data.job or data.gang) and not jobCheck(data.job or data.gang) then return end
for _, inv in pairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
inv.openStash(data)
lookEnt(data.coords)
@@ -2147,7 +2156,8 @@ RegisterNetEvent(getScript()..":server:openServerStash", function(data)
end)
function clearStash(stashId)
for _, inv in pairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
debugPrint("^5Bridge^7: ^2Clearing ^3"..inv.invName.."^2 Stash^7:", stashId)
inv.clearStash(stashId)
@@ -2180,7 +2190,8 @@ function getStash(stashName)
end
local stashItems, items = {}, {}
for _, inv in pairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
debugPrint("^6Bridge^7: ^2Retrieving ^3"..inv.invName.." ^2Stash^7:", stashName)
stashItems = inv.getStash(stashName)
@@ -2240,7 +2251,8 @@ function stashRemoveItem(stashItems, stashName, items)
stashName = { stashName }
end
for _, inv in pairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
inv.stashRemoveItem(stashItems, stashName[1], items)
return
@@ -2327,7 +2339,8 @@ end
--- )
--- ```
function registerStash(name, label, slots, weight, owner, coords)
for _, inv in pairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
inv.registerStash(name, label, slots, weight, owner, coords)
return
@@ -2543,7 +2556,8 @@ function openShop(data)
lookEnt(data.coords)
end
for _, inv in ipairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
inv.openShop(data)
lookEnt(data.coords)
@@ -2553,7 +2567,8 @@ function openShop(data)
end
RegisterNetEvent(getScript()..':server:openServerShop', function(shopName)
for _, inv in ipairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
inv.serverOpenShop(shopName)
break
@@ -2575,7 +2590,8 @@ end)
function registerShop(name, label, items, society)
local shopResource = ""
for _, inv in ipairs(InvFunc) do
for i = 1, #InvFunc do
local inv = InvFunc[i]
if isStarted(inv.invName) then
shopResource = inv.invName
inv.registerShop(name, label, items, society)

View File

@@ -247,7 +247,6 @@ function useDoor(data)
Wait(100)
end
function openBossMenu(isGang, group)
if isStarted("qb-management") then
if isGang then

View File

@@ -1,6 +1,226 @@
local inProgress = false
local storedPID = nil
local progressFunc = {
ox = {
start = function(data)
local options = {
duration = debugMode and 1000 or data.time,
label = data.label,
position = data.position or "bottom",
useWhileDead = data.dead or false,
canCancel = data.cancel or true,
anim = {
dict = data.dict,
clip = data.anim,
flag = (data.flag == 8 and 32 or data.flag) or nil,
scenario = data.task
},
disable = {
combat = data.combat or true,
move = data.disableMovement or false,
car = data.disableMovement or false,
mouse = data.mouse or false
},
}
if data.prop and data.prop.model then
options.prop = {
model = data.prop.model,
pos = data.prop.pos or vec3(0, 0, 0),
rot = data.prop.rot or vec3(0, 0, 0),
bone = data.prop.bone or 0
}
end
if data.propTwo and data.propTwo.model then
options.propTwo = {
model = data.propTwo.model,
pos = data.propTwo.pos or vec3(0, 0, 0),
rot = data.propTwo.rot or vec3(0, 0, 0),
bone = data.propTwo.bone or 0
}
end
if data.progressType == "circle" then
if exports[OXLibExport]:progressCircle(options) then
return true
else
return false
end
end
if not data.progressType or data.progressType == "bar" then
if exports[OXLibExport]:progressBar(options) then
return true
else
return false
end
end
end,
stop = function()
exports[OXLibExport]:cancelProgress()
end,
},
qb = {
start = function(data)
Core.Functions.Progressbar("progbar",
data.label,
debugMode and 1000 or data.time,
data.dead or false,
data.cancel or true,
{
disableMovement = data.disableMovement or false,
disableCarMovement = data.disableMovement or false,
disableMouse = data.disableMouse or false,
disableCombat = data.disableCombat or true,
},
{
animDict = data.dict,
anim = data.anim,
flags = data.flag or 32,
task = data.task
},
{}, {},
function()
return true
end, function()
return false
end, data.icon)
end,
stop = function()
TriggerEvent("progressbar:client:cancel")
end,
},
qs = {
start = function(data)
if exports['qs-interface']:ProgressBar({
duration = debugMode and 1000 or data.time,
label = data.label,
position = 'bottom',
useWhileDead = data.dead or false,
canCancel = data.cancel or true,
disable = data.disableMovement or false,
anim = {
dict = data.dict,
clip = data.anim,
flag = data.flag or 32
},
prop = nil
}) then
return true
else
return false
end
end,
stop = function()
--??
TriggerEvent("progressbar:client:cancel")
end,
},
esx = {
start = function(data)
ESX.Progressbar(data.label, debugMode and 1000 or data.time, {
FreezePlayer = true,
animation = {
type = data.anim,
dict = data.dict,
scenario = data.task,
},
onFinish = function()
return true
end,
onCancel = function()
return false
end
})
end,
stop = function()
ESX.CancelProgressbar()
end,
},
lation = {
start = function(data)
if exports.lation_ui:progressBar({
label = data.label,
description = nil,
duration = debugMode and 1000 or data.time,
icon = data.icon,
useWhileDead = data.dead or false,
disable = {
combat = data.combat or true,
move = data.disableMovement or false,
car = data.disableMovement or false,
},
anim = {
dict = data.dict,
clip = data.anim,
flag = data.flag
},
prop = {
model = data.prop and data.prop.model,
pos = data.prop and (data.prop.pos or vec3(0, 0, 0)),
rot = data.prop and (data.prop.rot or vec3(0, 0, 0)),
bone = data.prop and (data.prop.bone or 0)
}
}) then
return true
else
return false
end
end,
stop = function()
exports.lation_ui:cancelProgress()
end,
},
red = {
start = function(data)
if exports.jim_bridge:redProgressBar({
label = data.label,
time = debugMode and 1000 or data.time,
dict = data.dict,
anim = data.anim,
flag = data.flag or 32,
task = data.task,
disableMovement = data.disableMovement or false,
cancel = data.cancel or true,
}) then
return true
else
return false
end
end,
stop = function()
exports.jim_bridge:stopProgressBar()
end,
},
gta = {
start = function(data)
if exports.jim_bridge:gtaProgressBar({
label = data.label,
time = debugMode and 1000 or data.time,
dict = data.dict,
anim = data.anim,
flag = data.flag or 32,
task = data.task,
disableMovement = data.disableMovement or false,
cancel = data.cancel or true,
}) then
return true
else
return false
end
end,
stop = function()
exports.jim_bridge:stopProgressBar()
end,
},
}
--- Displays a progress bar using the configured progress bar system.
---
--- This function handles displaying a progress bar to the player using the specified progress bar system (e.g., ox, qb, esx, gta).
@@ -43,182 +263,12 @@ function progressBar(data)
end
local result = nil
if data.cam then startTempCam(data.cam) end
if Config.System.ProgressBar == "ox" then
local options = {
duration = debugMode and 1000 or data.time,
label = data.label,
position = data.position or "bottom",
useWhileDead = data.dead or false,
canCancel = data.cancel or true,
anim = {
dict = data.dict,
clip = data.anim,
flag = (data.flag == 8 and 32 or data.flag) or nil,
scenario = data.task
},
disable = {
combat = data.combat or true,
move = data.disableMovement or false,
car = data.disableMovement or false,
mouse = data.mouse or false
},
}
if data.prop and data.prop.model then
options.prop = {
model = data.prop.model,
pos = data.prop.pos or vec3(0, 0, 0),
rot = data.prop.rot or vec3(0, 0, 0),
bone = data.prop.bone or 0
}
end
if data.propTwo and data.propTwo.model then
options.propTwo = {
model = data.propTwo.model,
pos = data.propTwo.pos or vec3(0, 0, 0),
rot = data.propTwo.rot or vec3(0, 0, 0),
bone = data.propTwo.bone or 0
}
end
if data.progressType == "circle" then
if exports[OXLibExport]:progressCircle(options) then
if progressFunc[Config.System.ProgressBar].start(data) then
result = true
else
result = false
end
end
if not data.progressType or data.progressType == "bar" then
if exports[OXLibExport]:progressBar(options) then
result = true
else
result = false
end
end
elseif Config.System.ProgressBar == "qb" then
Core.Functions.Progressbar("progbar",
data.label,
debugMode and 1000 or data.time,
data.dead or false,
data.cancel or true,
{
disableMovement = data.disableMovement or false,
disableCarMovement = data.disableMovement or false,
disableMouse = data.disableMouse or false,
disableCombat = data.disableCombat or true,
},
{
animDict = data.dict,
anim = data.anim,
flags = data.flag or 32,
task = data.task
},
{}, {},
function()
result = true
end, function()
result = false
end, data.icon)
elseif Config.System.ProgressBar == "qs" then -- documentation left intact based on qs interface
local qs_success = exports['qs-interface']:ProgressBar({
duration = debugMode and 1000 or data.time, -- Duration of the progress bar (in milliseconds)
label = data.label, -- Text that will appear on the progress bar
position = 'bottom', -- Position of the progress bar on the screen (e.g., 'top', 'bottom', 'center')
useWhileDead = data.dead or false, -- Whether the progress bar shows when the player is dead (true/false)
canCancel = data.cancel or true, -- Whether the player can cancel the progress (true/false)
disable = data.disableMovement or false, -- Whether to disable player controls during the progress (true/false)
anim = { -- Animation to be played while the progress is happening
dict = data.dict,
clip = data.anim,
flag = data.flag or 32 -- Optional animation flags
},
prop = nil -- Optional prop to show alongside the progress bar (can be nil)
})
if qs_success then
result = true
else
result = false
end
elseif Config.System.ProgressBar == "esx" then
ESX.Progressbar(data.label, debugMode and 1000 or data.time, {
FreezePlayer = true,
animation = {
type = data.anim,
dict = data.dict,
scenario = data.task,
},
onFinish = function()
result = true
end,
onCancel = function()
result = false
end
})
elseif Config.System.ProgressBar == "lation" then
if exports.lation_ui:progressBar({
label = data.label,
description = nil,
duration = debugMode and 1000 or data.time,
icon = data.icon,
useWhileDead = data.dead or false,
disable = {
combat = data.combat or true,
move = data.disableMovement or false,
car = data.disableMovement or false,
},
anim = {
dict = data.dict,
clip = data.anim,
flag = data.flag
},
prop = {
model = data.prop and data.prop.model,
pos = data.prop and (data.prop.pos or vec3(0, 0, 0)),
rot = data.prop and (data.prop.rot or vec3(0, 0, 0)),
bone = data.prop and (data.prop.bone or 0)
}
}) then
result = true
else
result = false
end
elseif Config.System.ProgressBar == "red" then
-- Currently only uses jim-redui if you choose this option
if exports["jim_bridge"]:redProgressBar({
label = data.label,
time = debugMode and 1000 or data.time,
dict = data.dict,
anim = data.anim,
flag = data.flag or 32,
task = data.task,
disableMovement = data.disableMovement or false,
cancel = data.cancel or true,
}) then
result = true
else
result = false
end
elseif Config.System.ProgressBar == "gta" then
if exports["jim_bridge"]:gtaProgressBar({
label = data.label,
time = debugMode and 1000 or data.time,
dict = data.dict,
anim = data.anim,
flag = data.flag or 32,
task = data.task,
disableMovement = data.disableMovement or false,
cancel = data.cancel or true,
}) then
result = true
else
result = false
end
end
while result == nil do
Wait(10)
@@ -250,15 +300,7 @@ end
---
--- This function cancels the progress bar based on the configured progress bar system, handling any necessary cleanup.
function stopProgressBar()
if Config.System.ProgressBar == "ox" then
exports[OXLibExport]:cancelProgress()
elseif Config.System.ProgressBar == "qb" then
TriggerEvent("progressbar:client:cancel")
elseif Config.System.ProgressBar == "lation" then
exports.lation_ui:cancelProgress()
elseif Config.System.ProgressBar == "gta" or Config.System.ProgressBar == "red" then
exports["jim_bridge"]:stopProgressBar()
end
progressFunc[Config.System.ProgressBar].stop()
end
-- System to handle sending/sharing progress bars between players --

View File

@@ -6,6 +6,82 @@
for getting and setting metadata.
]]
local metaDataFunc = {
{ framework = QBXExport,
GetPlayer =
function(src)
return exports[QBXExport]:GetCoreObject().Functions.GetPlayer(src)
end,
GetPlayerMetadata =
function(Player, dataToCheck)
return Player.PlayerData.metadata[dataToCheck]
end,
SetPlayerMetadata =
function(Player, key, value)
return Player.Functions.SetMetaData(key, value)
end,
},
{ framework = QBExport,
GetPlayer =
function(src)
return exports[QBExport]:GetCoreObject().Functions.GetPlayer(src)
end,
GetPlayerMetadata =
function(Player, dataToCheck)
return Player.PlayerData.metadata[dataToCheck]
end,
SetPlayerMetadata =
function(Player, key, value)
return Player.Functions.SetMetaData(key, value)
end,
},
{ framework = ESXExport,
GetPlayer =
function(src)
return ESX.GetPlayerFromId(src)
end,
GetPlayerMetadata =
function(Player, dataToCheck)
return Player.getMeta(dataToCheck)
end,
SetPlayerMetadata =
function(Player, key, value)
return Player.set(key, value)
end,
},
{ framework = OXCoreExport,
GetPlayer =
function(src)
return exports[OXCoreExport]:GetPlayer(src)
end,
GetPlayerMetadata =
function(Player, dataToCheck)
return Player.get(dataToCheck)
end,
SetPlayerMetadata =
function(Player, key, value)
return Player.set(key, value)
end,
},
{ framework = RSGExport,
GetPlayer = function(src)
exports[RSGExport]:GetCoreObject().Functions.GetPlayer(source)
end,
GetPlayerMetadata = function(Player, dataToCheck)
return Player.PlayerData.metadata[dataToCheck]
end,
SetPlayerMetadata = function(Player, key, value)
return Player.Functions.SetMetaData(key, value)
end,
},
}
-------------------------------------------------------------
-- Player Retrieval
-------------------------------------------------------------
@@ -20,26 +96,11 @@
--- local player = GetPlayer(playerId)
--- ```
function GetPlayer(source)
if isStarted(QBExport) then
debugPrint("^6Bridge^7: ^3GetPlayer^7() QBExport")
return exports[QBExport]:GetCoreObject().Functions.GetPlayer(source)
elseif isStarted(QBXExport) then
debugPrint("^6Bridge^7: ^3GetPlayer^7() QBOXExport")
return exports[QBXExport]:GetCoreObject().Functions.GetPlayer(source)
elseif isStarted(ESXExport) then
debugPrint("^6Bridge^7: ^3GetPlayer^7() ESXExport")
return ESX.GetPlayerFromId(source)
elseif isStarted(OXCoreExport) then
debugPrint("^6Bridge^7: ^3GetPlayer^7() OXCoreExport")
return exports[OXCoreExport]:GetPlayer(source)
elseif isStarted(RSGExport) then
debugPrint("^6Bridge^7: ^3GetPlayer^7() RSGExport")
return exports[RSGExport]:GetCoreObject().Functions.GetPlayer(source)
for i = 1, #metaDataFunc do
local framework = metaDataFunc[i]
if isStarted(framework.framework) then
return framework.GetPlayer(source)
end
end
return nil
end
@@ -61,26 +122,19 @@ end
--- local myMeta = getPlayerMetadata(player, "myKey")
--- ```
function getPlayerMetadata(player, key)
-- Assume this is client side and callback to server to get the data
if not player then
debugPrint("^6Bridge^7: ^3GetMetadata^7() calling server: "..key)
return triggerCallback(getScript()..":server:GetMetadata", key)
else
if isStarted(QBExport) or isStarted(QBXExport) then
debugPrint("^6Bridge^7: ^3GetMetadata^7() QBExport/QBXExport", key)
return player.PlayerData.metadata[key]
elseif isStarted(ESXExport) then
debugPrint("^6Bridge^7: ^3GetMetadata^7() ESXExport", key)
return player.getMeta(key)
elseif isStarted(OXCoreExport) then
debugPrint("^6Bridge^7: ^3GetMetadata^7() OXCoreExport", key)
return player.get(key)
elseif isStarted(RSGExport) then
debugPrint("^6Bridge^7: ^3GetMetadata^7() RSGExport", key)
return player.PlayerData.metadata[key]
-- else grab server metadata about the player
for i = 1, #metaDataFunc do
local framework = metaDataFunc[i]
if isStarted(framework.framework) then
debugPrint("^6Bridge^7: ^3GetMetadata^7() ^3"..framework.framework.."^7", key)
return framework.GetPlayerMetadata(player, key)
end
end
end
return nil
@@ -123,34 +177,22 @@ end)
--- setPlayerMetadata(player, "myKey", "newValue")
--- ```
function setPlayerMetadata(player, key, value)
debugPrint("^6Bridge^7: ^3SetMetadata^7() setting metadata for key: "..key)
if isStarted(QBExport) or isStarted(QBXExport) then
debugPrint("^6Bridge^7: ^3SetMetadata^7() using QBExport/QBXExport")
player.Functions.SetMetaData(key, value)
elseif isStarted(ESXExport) then
debugPrint("^6Bridge^7: ^3SetMetadata^7() using ESXExport")
player.setMeta(key, value)
elseif isStarted(OXCoreExport) then
debugPrint("^6Bridge^7: ^3SetMetadata^7() using OXCoreExport")
player.set(key, value)
elseif isStarted(RSGExport) then
debugPrint("^6Bridge^7: ^3SetMetadata^7() using RSGExport")
player.Functions.SetMetaData(key, value)
debugPrint("^6Bridge^7: ^3SetMetadata^7() setting metadata^7...")
for i = 1, #metaDataFunc do
local framework = metaDataFunc[i]
if isStarted(framework.framework) then
debugPrint("^6Bridge^7: ^3SetMetadata^7() ^3"..framework.framework.."^7", key, value)
return framework.GetPlayerMetadata(player, key)
end
end
debugPrint("^6Bridge^7: ^1Error setting metadata^7, ^1framework not supported^7?")
end
-- Register a server callback for setting metadata.
createCallback(getScript()..":server:setPlayerMetadata", function(source, key, value)
debugPrint("SetMetadata callback triggered for source:", source, "key:", key, "value:", value)
local player = GetPlayer(source)
--[[if not player then
print("Error setting metadata: player not found for source "..tostring(source))
return false
end]]
local src = source
debugPrint("SetMetadata callback triggered for source:", src, "key:", key, "value:", value)
local player = GetPlayer(src)
setPlayerMetadata(player, key, value)
print("Metadata set successfully.", key)
return true

View File

@@ -17,66 +17,89 @@
local notifyFunc = {
okok = {
client = function(title, message, type)
client =
function(title, message, type)
TriggerEvent('okokNotify:Alert', title, message, 6000, type)
end,
server = function(title, message, type, src)
server =
function(title, message, type, src)
TriggerClientEvent('okokNotify:Alert', src, title, message, 6000, type)
end,
},
qb = {
client = function(title, message, type)
client =
function(title, message, type)
TriggerEvent("QBCore:Notify", message, type)
end,
server = function(title, message, type, src)
server =
function(title, message, type, src)
TriggerClientEvent("QBCore:Notify", src, message, type)
end,
},
qs = {
client = function(title, message, type)
client =
function(title, message, type)
exports['qs-interface']:AddNotify(message, title, 6000)
end,
server = function(title, message, type, src)
server =
function(title, message, type, src)
TriggerClientEvent('interface:notification', src, message, title, 6000)
end,
},
ox = {
client = function(title, message, type)
client =
function(title, message, type)
exports.ox_lib:notify({ title = title, description = message, type = type or "success" })
end,
server = function(title, message, type, src)
server =
function(title, message, type, src)
TriggerClientEvent('ox_lib:notify', src, { title = title, description = message, type = type or "success" })
end,
},
gta = {
client = function(title, message, type)
exports.jim_bridge:Notify(title, message, type)
end,
server = function(title, message, type, src)
TriggerClientEvent("jim-bridge:Notify", src, title, message, type)
end,
},
esx = {
client = function(title, message, type)
client =
function(title, message, type)
exports["esx_notify"]:Notify(type, 4000, message)
end,
server = function(title, message, type, src)
server =
function(title, message, type, src)
TriggerClientEvent(getScript()..":DisplayESXNotify", src, type, message)
end,
},
lation = {
client = function(title, message, type)
client =
function(title, message, type)
exports.lation_ui:notify({ title = title, message = message, type = type or "success", })
end,
server = function(title, message, type, src)
server =
function(title, message, type, src)
TriggerClientEvent("lation_ui:notify", src, { title = title, message = message, type = type or "success", })
end,
},
gta = {
client =
function(title, message, type)
exports.jim_bridge:Notify(title, message, type)
end,
server =
function(title, message, type, src)
TriggerClientEvent("jim-bridge:Notify", src, title, message, type)
end,
},
red = {
client = function(title, message, type)
client =
function(title, message, type)
TriggerEvent("jim-redui:Notify", title, message, type)
end,
server = function(title, message, type, src)
server =
function(title, message, type, src)
TriggerClientEvent("jim-redui:Notify", src, title, message, type)
end,
},

View File

@@ -13,102 +13,76 @@
- jpr-phonesystem
]]
--- Sends a phone mail using the detected phone system.
--- The function iterates through a prioritized list of supported phone systems.
--- Once an active system is found (via `isStarted`), the corresponding mail function is executed.
---
--- @param data table A table containing the mail data.
--- - subject (string): The email subject.
--- - sender (string): The sender identifier.
--- - message (string): The email body content.
--- - actions (table|nil): Optional action buttons for the email.
--- @usage
--- sendPhoneMail({
--- subject = "Welcome!",
--- sender = "Admin",
--- message = "Thank you for joining our server.",
--- actions = {
--- { label = "Reply", action = replyFunction }
--- }
--- })
function sendPhoneMail(data)
-- Define each supported phone system and its corresponding mail-sending function.
local phoneSystems = {
{ name = "gksphone",
send = function(mailData)
local phoneFunc = {
{ phone = "gksphone",
sendMail = function(mailData)
exports["gksphone"]:SendNewMail(mailData)
end,
sendInvoice =
function(mailData)
-- Defensive check for required fields
local required = { "billedCitizenid", "amount", "job", "name", "billerCitizenid", "label" }
for _, field in ipairs(required) do
if mailData[field] == nil then
print("^1[jim-payments] ERROR:^0 Missing field '" .. field .. "' in mailData")
return
end
end
MySQL.Async.execute(
'INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid, label) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid, @label)',
{
['@citizenid'] = mailData.billedCitizenid,
['@amount'] = mailData.amount,
['@society'] = mailData.job,
['@sender'] = mailData.name,
['@sendercitizenid'] = mailData.billerCitizenid,
['@label'] = mailData.label
}
)
end,
},
{ name = "yflip-phone",
send = function(mailData)
sendMail =
function(mailData)
TriggerServerEvent(getScript()..":yflip:SendMail", mailData)
end,
},
{ name = "qs-smartphone",
send = function(mailData)
sendMail =
function(mailData)
TriggerServerEvent('qs-smartphone:server:sendNewMail', mailData)
end,
},
{ name = "qs-smartphone-pro",
send = function(mailData)
sendMail =
function(mailData)
TriggerServerEvent('phone:sendNewMail', mailData)
end,
},
{ name = "roadphone",
send = function(mailData)
sendMail =
function(mailData)
-- Convert HTML line breaks to newlines for roadphone.
mailData.message = mailData.message:gsub("%<br>", "\n")
exports["roadphone"]:sendMail(mailData)
end,
},
{ name = "lb-phone",
send = function(mailData)
sendMail =
function(mailData)
-- Convert HTML line breaks to newlines for lb-phone.
mailData.message = mailData.message:gsub("%<br>", "\n")
TriggerServerEvent(getScript()..":lbphone:SendMail", mailData)
end,
},
{ name = "qb-phone",
send = function(mailData)
sendMail =
function(mailData)
TriggerServerEvent('qb-phone:server:sendNewMail', mailData)
end,
},
{ name = "npwd_qbx_mail",
send = function(mailData)
TriggerServerEvent('qb-phone:server:sendNewMail', mailData)
end,
},
{ name = "jpr-phonesystem",
send = function(mailData)
TriggerServerEvent(getScript()..":jpr:SendMail", mailData)
end,
},
{ name = "ef-phone",
send = function(mailData)
TriggerServerEvent('qb-phone:server:sendNewMail', mailData)
end,
},
}
-- Check each phone system in order and use the first active one.
for _, phone in ipairs(phoneSystems) do
if isStarted(phone.name) then
debugPrint("^6Bridge^7[^3"..phone.name.."^7]: ^2Sending mail to player")
phone.send(data)
return true
end
end
print("^6Bridge^7: ^1ERROR ^2Sending mail to player ^7- ^2No supported phone found")
return false
end
function sendPhoneInvoice(data)
if not data.src then return end
-- Define each supported phone system and its corresponding mail-sending function.
local phoneSystems = {
{
name = "qb-phone",
send = function(mailData)
sendInvoice =
function(mailData)
-- Defensive check for required fields
local required = { "billedCitizenid", "amount", "job", "name", "billerCitizenid", "src" }
for _, field in ipairs(required) do
@@ -134,74 +108,73 @@ function sendPhoneInvoice(data)
end
end
)
TriggerClientEvent('qb-phone:RefreshPhone', mailData.src)
end
end,
},
{
name = "codem-phone",
send = function(mailData)
-- Defensive check for required fields
local required = { "billedCitizenid", "amount", "job", "name", "billerCitizenid", "src" }
for _, field in ipairs(required) do
if mailData[field] == nil then
print("^1[jim-payments] ERROR:^0 Missing field '" .. field .. "' in mailData")
return
end
end
-- Safe insert with all parameters present
MySQL.Async.insert(
'INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',
{
mailData.billedCitizenid,
mailData.amount,
mailData.job,
mailData.name,
mailData.billerCitizenid
{ name = "npwd_qbx_mail",
sendMail =
function(mailData)
TriggerServerEvent('qb-phone:server:sendNewMail', mailData)
end,
},
function(id)
-- if id then
-- TriggerClientEvent('qb-phone:client:AcceptorDenyInvoice', mailData.src, id, mailData.name, mailData.job, mailData.billerCitizenid, mailData.amount, GetInvokingResource())
-- end
end
)
end
{ name = "jpr-phonesystem",
sendMail =
function(mailData)
TriggerServerEvent(getScript()..":jpr:SendMail", mailData)
end,
},
{ name = "ef-phone",
sendMail =
function(mailData)
TriggerServerEvent('qb-phone:server:sendNewMail', mailData)
end,
},
{
name = "gksphone",
send = function(mailData)
-- Defensive check for required fields
local required = { "billedCitizenid", "amount", "job", "name", "billerCitizenid", "label" }
for _, field in ipairs(required) do
if mailData[field] == nil then
print("^1[jim-payments] ERROR:^0 Missing field '" .. field .. "' in mailData")
return
end
end
MySQL.Async.execute(
'INSERT INTO gksphone_invoices (citizenid, amount, society, sender, sendercitizenid, label) VALUES (@citizenid, @amount, @society, @sender, @sendercitizenid, @label)',
{
['@citizenid'] = mailData.billedCitizenid,
['@amount'] = mailData.amount,
['@society'] = mailData.job,
['@sender'] = mailData.name,
['@sendercitizenid'] = mailData.billerCitizenid,
['@label'] = mailData.label
}
)
}
--- Sends a phone mail using the detected phone system.
--- The function iterates through a prioritized list of supported phone systems.
--- Once an active system is found (via `isStarted`), the corresponding mail function is executed.
---
--- @param data table A table containing the mail data.
--- - subject (string): The email subject.
--- - sender (string): The sender identifier.
--- - message (string): The email body content.
--- - actions (table|nil): Optional action buttons for the email.
--- @usage
--- sendPhoneMail({
--- subject = "Welcome!",
--- sender = "Admin",
--- message = "Thank you for joining our server.",
--- actions = {
--- { label = "Reply", action = replyFunction }
--- }
--- })
function sendPhoneMail(mailData)
-- Check each phone system in order and use the first active one.
for i = 1, #phoneFunc do
local script = phoneFunc[i]
if isStarted(script.phone) and script.sendMail then
debugPrint("^6Bridge^7[^3"..script.phone.."^7]: ^2Sending mail to player")
script.sendMail(mailData)
return true
end
}
}
end
print("^6Bridge^7: ^1ERROR ^2Sending mail to player ^7- ^2No supported phone found")
return false
end
function sendPhoneInvoice(data)
if not data.src then return end
-- Check each phone system in order and use the first active one.
for _, phone in ipairs(phoneSystems) do
if isStarted(phone.name) then
debugPrint("^6Bridge^7[^3"..phone.name.."^7]: ^2Sending mail to player^7", data.src)
phone.send(data)
for i = 1, #phoneFunc do
local script = phoneFunc[i]
if isStarted(script.phone) and script.sendInvoice then
debugPrint("^6Bridge^7[^3"..script.phone.."^7]: ^2Sending mail to player^7", data.src)
script.sendInvoice(data)
return true
end
end

View File

@@ -100,7 +100,8 @@ local polyCreation = {
---})
---```
function createPoly(data)
for _, script in ipairs(polyCreation) do
for i = 1, #polyCreation do
local script = polyCreation[i]
if isStarted(script.polyZoneScript) then
debugPrint("^6Bridge^7: ^2Creating new poly with ^7'^4"..script.polyZoneScript.."^7': "..data.name)
return script.createPoly(data)
@@ -140,7 +141,8 @@ end
--- })
--- ```
function createCirclePoly(data)
for _, script in ipairs(polyCreation) do
for i = 1, #polyCreation do
local script = polyCreation[i]
if isStarted(script.polyZoneScript) then
debugPrint("^6Bridge^7: ^2Creating new ^3Cricle^2 poly with ^7"..script.polyZoneScript.." "..data.name)
debugPrint("^6Bridge^7: ^2Zone Stats - Coords: "..formatCoord(data.coords).." Radius: "..data.radius)
@@ -169,7 +171,8 @@ end
--- removePolyZone(zone)
--- ```
function removePolyZone(Location)
for _, script in ipairs(polyCreation) do
for i = 1, #polyCreation do
local script = polyCreation[i]
if isStarted(script.polyZoneScript) then
debugPrint("^6Bridge^7: ^2Removing ^3"..script.polyZoneScript.." ^2Zone^7")
script.removeZone(Location)

View File

@@ -1,17 +1,16 @@
local activeSkillCheck = false
function skillCheck(data)
local result = false
if Config.System.skillCheck == "qb" then
local skillCheckFunc = {
qb = {
start = function(data)
local Skillbar = exports["qb-minigames"]:Skillbar()
if Skillbar then
result = true
return true
else
result = false
return false
end
elseif Config.System.skillCheck == "ox" then
end,
},
ox = {
start = function(data)
local Skillbar = exports[OXLibExport]:skillCheck(
{
"easy",
@@ -25,14 +24,24 @@ function skillCheck(data)
"4"
})
if Skillbar then
result = true
return true
else
result = false
return false
end
elseif Config.System.skillCheck == "gta" then
exports.jim_bridge:skillCheck()
elseif Config.System.skillCheck == "lation" then
end,
},
gta = {
start = function(data)
local Skillbar = exports.jim_bridge:skillCheck()
if Skillbar then
return true
else
return false
end
end,
},
lation = {
start = function(data)
local Skillbar = exports.lation_ui:skillCheck("",
{
"easy",
@@ -45,14 +54,19 @@ function skillCheck(data)
"3",
"4"
})
if Skillbar then
result = true
return true
else
result = false
return false
end
else
result = true
end,
},
}
function skillCheck(data)
if Config.System.skillCheck then
return skillCheckFunc[Config.System.skillCheck].start(data)
end
return result
return true
end

View File

@@ -12,9 +12,9 @@
]]
local societyFunc = {
{
bankName = "qb-banking",
getAccount = function(society)
{ bankName = "qb-banking",
getAccount =
function(society)
if not exports["qb-banking"]:GetAccount(society) then
if Jobs[society] then
print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
@@ -28,7 +28,8 @@ local societyFunc = {
end
return exports["qb-banking"]:GetAccountBalance(society)
end,
chargeSociety = function(society, amount)
chargeSociety =
function(society, amount)
if not exports["qb-banking"]:GetAccount(society) then
if Jobs[society] then
print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
@@ -40,7 +41,8 @@ local societyFunc = {
end
exports["qb-banking"]:RemoveMoney(society, amount)
end,
fundSociety = function(society, amount)
fundSociety =
function(society, amount)
if not exports["qb-banking"]:GetAccount(society) then
if Jobs[society] then
print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
@@ -56,62 +58,70 @@ local societyFunc = {
end,
},
{
bankName = "Renewed-Banking",
getAccount = function(society)
{ bankName = "Renewed-Banking",
getAccount =
function(society)
return exports["Renewed-Banking"]:getAccountMoney(society)
end,
chargeSociety = function(society, amount)
chargeSociety =
function(society, amount)
exports['Renewed-Banking']:removeAccountMoney(society, amount)
end,
fundSociety = function(society, amount)
fundSociety =
function(society, amount)
exports['Renewed-Banking']:addAccountMoney(society, amount)
end,
},
{
bankName = "fd_banking",
getAccount = function(society)
{ bankName = "fd_banking",
getAccount =
function(society)
return exports["fd_banking"]:GetAccount(society)
end,
chargeSociety = function(society, amount)
chargeSociety =
function(society, amount)
exports["fd_banking"]:RemoveMoney(society, amount)
end,
fundSociety = function(society, amount)
fundSociety =
function(society, amount)
exports["fd_banking"]:AddMoney(society, amount)
end,
},
{
bankName = "okokBanking",
getAccount = function(society)
{ bankName = "okokBanking",
getAccount =
function(society)
return exports['okokBanking']:GetAccount(society)
end,
chargeSociety = function(society, amount)
chargeSociety =
function(society, amount)
exports['okokBanking']:RemoveMoney(society, amount)
end,
fundSociety = function(society, amount)
fundSociety =
function(society, amount)
exports['okokBanking']:AddMoney(society, amount)
end,
},
{
bankName = "tgiann-bank",
getAccount = function(society)
{ bankName = "tgiann-bank",
getAccount =
function(society)
if Jobs[society] then
return exports["tgiann-bank"]:GetJobAccountBalance(society)
else
return exports["tgiann-bank"]:GetGangAccountBalance(society)
end
end,
chargeSociety = function(society, amount)
chargeSociety =
function(society, amount)
if Jobs[society] then
exports["tgiann-bank"]:RemoveJobMoney(society, amount)
else
exports["tgiann-bank"]:RemoveGangMoney(society, amount)
end
end,
fundSociety = function(society, amount)
fundSociety =
function(society, amount)
if Jobs[society] then
exports["tgiann-bank"]:AddJobMoney(society, amount)
else
@@ -134,7 +144,8 @@ function getSocietyAccount(society)
local amount = 0
if society == nil or society == "none" then return amount end
for _, script in pairs(societyFunc) do
for i = 1, #societyFunc do
local script = societyFunc[i]
if isStarted(script.bankName) then
local amount = script.getAccount(society)
debugPrint("^6Bridge^7: ^3"..script.bankName.."^7: ^2Retrieved account ^7'^6"..society.."^7' ($"..tostring(amount)..")")
@@ -156,7 +167,8 @@ end
--- ```
function chargeSociety(society, amount)
for _, script in pairs(societyFunc) do
for i = 1, #societyFunc do
local script = societyFunc[i]
if isStarted(script.bankName) then
script.chargeSociety(society, amount)
local newAmount = getSocietyAccount(society)
@@ -177,7 +189,8 @@ end
--- ```
function fundSociety(society, amount)
for _, script in pairs(societyFunc) do
for i = 1, #societyFunc do
local script = societyFunc[i]
if isStarted(script.bankName) then
script.fundSociety(society, amount)
local newAmount = getSocietyAccount(society)

View File

@@ -18,9 +18,9 @@
]]
local targetFunc = {
{
targetName = OXTargetExport,
entityTarget = function(entity, opts, dist)
{ targetName = OXTargetExport,
entityTarget =
function(entity, opts, dist)
local options = {}
for i = 1, #opts do
options[i] = {
@@ -36,7 +36,8 @@ local targetFunc = {
exports[OXTargetExport]:addLocalEntity(entity, options)
end,
boxTarget = function(data, opts, dist)
boxTarget =
function(data, opts, dist)
local options = {}
for i = 1, #opts do
options[i] = {
@@ -67,7 +68,8 @@ local targetFunc = {
return target
end,
circleTarget = function(data, opts, dist)
circleTarget =
function(data, opts, dist)
local options = {}
for i = 1, #opts do
options[i] = {
@@ -89,7 +91,8 @@ local targetFunc = {
return target
end,
modelTarget = function(models, opts, dist)
modelTarget =
function(models, opts, dist)
local options = {}
for i = 1, #opts do
options[i] = {
@@ -105,83 +108,98 @@ local targetFunc = {
exports[OXTargetExport]:addModel(models, options)
end,
removeTargetEntity = function(entity)
removeTargetEntity =
function(entity)
exports[OXTargetExport]:removeLocalEntity(entity, nil)
end,
removeTargetZone = function(target)
removeTargetZone =
function(target)
exports[OXTargetExport]:removeZone(target, true)
end,
removeTargetModel = function(model)
removeTargetModel =
function(model)
exports[OXTargetExport]:removeModel(model, nil)
end,
},
{
targetName = QBTargetExport,
entityTarget = function(entity, opts, dist)
{ targetName = QBTargetExport,
entityTarget =
function(entity, opts, dist)
local options = { options = opts, distance = dist }
exports[QBTargetExport]:AddTargetEntity(entity, options)
end,
boxTarget = function(data, opts, dist)
boxTarget =
function(data, opts, dist)
local options = { options = opts, distance = dist }
local target = exports[QBTargetExport]:AddBoxZone(data[1], data[2], data[3], data[4], data[5], options)
return data[1]
end,
circleTarget = function(data, opts, dist)
circleTarget =
function(data, opts, dist)
local options = { options = opts, distance = dist }
local target = exports[QBTargetExport]:AddCircleZone(data[1], data[2], data[3], data[4], options)
return data[1]
end,
modelTarget = function(models, opts, dist)
modelTarget =
function(models, opts, dist)
local options = { options = opts, distance = dist }
exports[QBTargetExport]:AddTargetModel(models, options)
end,
removeTargetEntity = function(entity)
removeTargetEntity =
function(entity)
exports[QBTargetExport]:RemoveTargetEntity(entity)
end,
removeTargetZone = function(target)
removeTargetZone =
function(target)
exports[QBTargetExport]:RemoveZone(target)
end,
removeTargetModel = function(model)
removeTargetModel =
function(model)
exports[QBTargetExport]:RemoveTargetModel(model, "Test")
end,
},
{
targetName = "jim_bridge",
entityTarget = function(entity, opts, dist)
{ targetName = "jim_bridge",
entityTarget =
function(entity, opts, dist)
return exports.jim_bridge:createEntityTarget(entity, opts, dist)
end,
boxTarget = function(data, opts, dist)
boxTarget =
function(data, opts, dist)
return exports.jim_bridge:createZoneTarget(data, opts, dist)
end,
circleTarget = function(data, opts, dist)
circleTarget =
function(data, opts, dist)
return exports.jim_bridge:createZoneTarget(data, opts, dist)
end,
modelTarget = function(models, opts, dist)
modelTarget =
function(models, opts, dist)
return exports.jim_bridge:createModelTarget(models, opts, dist)
end,
removeTargetEntity = function(entity)
removeTargetEntity =
function(entity)
exports.jim_bridge:removeEntityTarget(entity)
end,
removeTargetZone = function(target)
removeTargetZone =
function(target)
exports.jim_bridge:removeZoneTarget(target)
end,
removeTargetModel = function(model)
removeTargetModel =
function(model)
exports.jim_bridge:removeZoneTarget(model)
end,
},
@@ -243,7 +261,8 @@ function createEntityTarget(entity, opts, dist)
end
-- Check for target script and use that
for _, script in pairs(targetFunc) do
for i = 1, #targetFunc do
local script = targetFunc[i]
if isStarted(script.targetName) then
debugPrint("^6Bridge^7: ^2Creating new ^3Entity ^2target with ^6"..script.targetName.." ^2for entity ^7"..entity)
return script.entityTarget(entity, opts, dist)
@@ -314,7 +333,8 @@ function createBoxTarget(data, opts, dist)
end
-- Check for target script and use that
for _, script in pairs(targetFunc) do
for i = 1, #targetFunc do
local script = targetFunc[i]
if isStarted(script.targetName) then
debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6"..script.targetName.." ^7"..data[1])
local target = script.boxTarget(data, opts, dist)
@@ -370,7 +390,8 @@ function createCircleTarget(data, opts, dist)
end
-- Check for target script and use that
for _, script in pairs(targetFunc) do
for i = 1, #targetFunc do
local script = targetFunc[i]
if isStarted(script.targetName) then
debugPrint("^6Bridge^7: ^2Creating new ^3Sphere ^2target with ^6"..script.targetName.." ^7"..data[1])
local target = script.circleTarget(data, opts, dist)
@@ -416,7 +437,8 @@ function createModelTarget(models, opts, dist)
end
-- Check for target script and use that
for _, script in pairs(targetFunc) do
for i = 1, #targetFunc do
local script = targetFunc[i]
if isStarted(script.targetName) then
debugPrint("^6Bridge^7: ^2Creating new ^3Model ^2target with ^6"..script.targetName.."^7")
local target = script.modelTarget(models, opts, dist)
@@ -446,7 +468,8 @@ function removeEntityTarget(entity)
end
-- Check for target script and use that
for _, script in pairs(targetFunc) do
for i = 1, #targetFunc do
local script = targetFunc[i]
if isStarted(script.targetName) then
script.removeTargetEntity(entity)
break
@@ -471,7 +494,8 @@ function removeZoneTarget(target)
end
-- Check for target script and use that
for _, script in pairs(targetFunc) do
for i = 1, #targetFunc do
local script = targetFunc[i]
if isStarted(script.targetName) then
script.removeTargetZone(target)
break
@@ -494,7 +518,8 @@ function removeModelTarget(model)
end
-- Check for target script and use that
for _, script in pairs(targetFunc) do
for i = 1, #targetFunc do
local script = targetFunc[i]
if isStarted(script.targetName) then
script.removeTargetModel(model)
break