diff --git a/shared/crafting.lua b/shared/crafting.lua
index e050ce5..93da037 100644
--- a/shared/crafting.lua
+++ b/shared/crafting.lua
@@ -124,10 +124,12 @@ 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 "")
+ ..(Recipes[i]["amount"] > 1 and " x"..Recipes[i]["amount"] or "")
local statusEmoji = disable and " " or not canCarryTable[k] and " 📦" or " ✔️"
local isNew = (Recipes[i]["hasCrafted"] ~= nil and craftedItems[k] == nil) and "✨ " or ""
diff --git a/shared/drawText.lua b/shared/drawText.lua
index f8a4281..ede6b53 100644
--- a/shared/drawText.lua
+++ b/shared/drawText.lua
@@ -8,96 +8,108 @@
-- Text system handlers
local textHandlers = {
qb = {
- show = function(text, image)
- if image then
- text = '
'..text
- end
- exports[QBExport]:DrawText(text, 'left')
- end,
- hide = function()
- exports[QBExport]:HideText()
- end
+ show =
+ function(text, image)
+ if image then
+ text = '
'..text
+ end
+ exports[QBExport]:DrawText(text, 'left')
+ end,
+ hide =
+ function()
+ exports[QBExport]:HideText()
+ end,
},
ox = {
- show = function(input, image, oxStyleTable)
- local inputCount = #input
- for i = 1, inputCount do
- input[i] = input[i] .. (i ~= inputCount and " \n" or "")
- end
- lib.showTextUI(table.concat(input), {
- icon = (image and radarTable[image] or image) or nil,
- position = 'left-center',
- style = oxStyleTable
- })
- end,
- hide = function()
- lib.hideTextUI()
- end
+ show =
+ function(input, image, oxStyleTable)
+ local inputCount = #input
+ for i = 1, inputCount do
+ input[i] = input[i] .. (i ~= inputCount and " \n" or "")
+ end
+ lib.showTextUI(table.concat(input), {
+ icon = (image and radarTable[image] or image) or nil,
+ position = 'left-center',
+ style = oxStyleTable
+ })
+ end,
+ hide =
+ function()
+ lib.hideTextUI()
+ end,
},
lation = {
- show = function(input, image)
- local inputCount = #input
- for i = 1, inputCount do
- input[i] = input[i] .. (i ~= inputCount and " \n" or "")
- end
- exports.lation_ui:showText({
- description = table.concat(input),
- keybind = nil,
- icon = (image and radarTable[image] or image) or nil,
- iconColor = '#3B82F6',
- position = 'left-center'
- })
- end,
- hide = function()
- exports.lation_ui:hideText()
- end
- },
-
- gta = {
- show = function(input, image, style)
- local text = ""
- for i = 1, #input do
- if input[i] ~= "" then
- text = text .. input[i] .. "\n~s~"
+ show =
+ function(input, image)
+ local inputCount = #input
+ for i = 1, inputCount do
+ input[i] = input[i] .. (i ~= inputCount and " \n" or "")
end
- end
- if image then
- text = "~BLIP_" .. image .. "~ " .. text
- end
- DisplayHelpMsg(text:gsub("%:", ":~" .. (style or "g") .. "~"))
- end,
- hide = function()
- ClearAllHelpMessages()
- end
+ exports.lation_ui:showText({
+ description = table.concat(input),
+ keybind = nil,
+ icon = (image and radarTable[image] or image) or nil,
+ iconColor = '#3B82F6',
+ position = 'left-center'
+ })
+ end,
+ hide =
+ function()
+ exports.lation_ui:hideText()
+ end,
},
esx = {
- show = function(text, image)
- if image then
- text = '
'..text
- end
- ESX.TextUI(text, nil)
- end,
- hide = function()
- ESX.HideUI()
- end
+ show =
+ function(text, image)
+ if image then
+ text = '
'..text
+ end
+ ESX.TextUI(text, nil)
+ end,
+ hide =
+ function()
+ ESX.HideUI()
+ end,
+ },
+
+ gta = {
+ show =
+ function(input, image, style)
+ local text = ""
+ for i = 1, #input do
+ if input[i] ~= "" then
+ text = text .. input[i] .. "\n~s~"
+ end
+ end
+ if image then
+ text = "~BLIP_" .. image .. "~ " .. text
+ end
+ DisplayHelpMsg(text:gsub("%:", ":~" .. (style or "g") .. "~"))
+ end,
+ hide =
+ function()
+ ClearAllHelpMessages()
+ end,
},
red = {
- show = function(input)
- local text = ""
- for i = 1, #input do
- if input[i] ~= "" then
- text = text .. input[i] .. "\n~q~"
+ show =
+ function(input)
+ local text = ""
+ for i = 1, #input do
+ if input[i] ~= "" then
+ text = text .. input[i] .. "\n~q~"
+ end
end
- end
- TriggerEvent("jim-redui:DrawText", text)
- end,
- hide = function()
- TriggerEvent("jim-redui:HideText")
- end
+ TriggerEvent("jim-redui:DrawText", text)
+ end,
+ hide =
+ function()
+ TriggerEvent("jim-redui:HideText")
+ end,
}
}
diff --git a/shared/helpers.lua b/shared/helpers.lua
index 0ef454b..188077e 100644
--- a/shared/helpers.lua
+++ b/shared/helpers.lua
@@ -73,8 +73,6 @@ function checkExportExists(resource, export)
end
end
-
-
-------------------------------------------------------------
-- Debugging and JSON Utilities
-------------------------------------------------------------
diff --git a/shared/itemcontrol.lua b/shared/itemcontrol.lua
index 1dfadc0..e6a912d 100644
--- a/shared/itemcontrol.lua
+++ b/shared/itemcontrol.lua
@@ -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)
diff --git a/shared/jobfunctions.lua b/shared/jobfunctions.lua
index 7dff529..c304f9b 100644
--- a/shared/jobfunctions.lua
+++ b/shared/jobfunctions.lua
@@ -247,7 +247,6 @@ function useDoor(data)
Wait(100)
end
-
function openBossMenu(isGang, group)
if isStarted("qb-management") then
if isGang then
diff --git a/shared/make/progressBars.lua b/shared/make/progressBars.lua
index c5663db..3c7b77a 100644
--- a/shared/make/progressBars.lua
+++ b/shared/make/progressBars.lua
@@ -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,181 +263,11 @@ 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
- 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
+ if progressFunc[Config.System.ProgressBar].start(data) then
+ result = true
+ else
+ result = false
end
while result == nil do
@@ -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 --
diff --git a/shared/metaHandlers.lua b/shared/metaHandlers.lua
index 515d248..9e66d7f 100644
--- a/shared/metaHandlers.lua
+++ b/shared/metaHandlers.lua
@@ -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
diff --git a/shared/notify.lua b/shared/notify.lua
index b8a6195..d6fd8f2 100644
--- a/shared/notify.lua
+++ b/shared/notify.lua
@@ -17,68 +17,91 @@
local notifyFunc = {
okok = {
- client = function(title, message, type)
- TriggerEvent('okokNotify:Alert', title, message, 6000, type)
- end,
- server = function(title, message, type, src)
- TriggerClientEvent('okokNotify:Alert', src, title, message, 6000, type)
- end,
+ client =
+ function(title, message, type)
+ TriggerEvent('okokNotify:Alert', title, message, 6000, type)
+ end,
+ server =
+ function(title, message, type, src)
+ TriggerClientEvent('okokNotify:Alert', src, title, message, 6000, type)
+ end,
},
+
qb = {
- client = function(title, message, type)
- TriggerEvent("QBCore:Notify", message, type)
- end,
- server = function(title, message, type, src)
- TriggerClientEvent("QBCore:Notify", src, message, type)
- end,
+ client =
+ function(title, message, type)
+ TriggerEvent("QBCore:Notify", message, type)
+ end,
+ server =
+ function(title, message, type, src)
+ TriggerClientEvent("QBCore:Notify", src, message, type)
+ end,
},
+
qs = {
- client = function(title, message, type)
- exports['qs-interface']:AddNotify(message, title, 6000)
- end,
- server = function(title, message, type, src)
- TriggerClientEvent('interface:notification', src, message, title, 6000)
- end,
+ client =
+ function(title, message, type)
+ exports['qs-interface']:AddNotify(message, title, 6000)
+ end,
+ server =
+ function(title, message, type, src)
+ TriggerClientEvent('interface:notification', src, message, title, 6000)
+ end,
},
+
ox = {
- client = function(title, message, type)
- exports.ox_lib:notify({ title = title, description = message, type = type or "success" })
- end,
- 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,
+ client =
+ function(title, message, type)
+ exports.ox_lib:notify({ title = title, description = message, type = type or "success" })
+ end,
+ server =
+ function(title, message, type, src)
+ TriggerClientEvent('ox_lib:notify', src, { title = title, description = message, type = type or "success" })
+ end,
},
+
esx = {
- client = function(title, message, type)
- exports["esx_notify"]:Notify(type, 4000, message)
- end,
- server = function(title, message, type, src)
- TriggerClientEvent(getScript()..":DisplayESXNotify", src, type, message)
- end,
+ client =
+ function(title, message, type)
+ exports["esx_notify"]:Notify(type, 4000, message)
+ end,
+ server =
+ function(title, message, type, src)
+ TriggerClientEvent(getScript()..":DisplayESXNotify", src, type, message)
+ end,
},
+
lation = {
- client = function(title, message, type)
- exports.lation_ui:notify({ title = title, message = message, type = type or "success", })
- end,
- server = function(title, message, type, src)
- TriggerClientEvent("lation_ui:notify", src, { title = title, message = message, type = type or "success", })
- end,
+ client =
+ function(title, message, type)
+ exports.lation_ui:notify({ title = title, message = message, type = type or "success", })
+ end,
+ 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)
- TriggerEvent("jim-redui:Notify", title, message, type)
- end,
- server = function(title, message, type, src)
- TriggerClientEvent("jim-redui:Notify", src, title, message, type)
- end,
+ client =
+ function(title, message, type)
+ TriggerEvent("jim-redui:Notify", title, message, type)
+ end,
+ server =
+ function(title, message, type, src)
+ TriggerClientEvent("jim-redui:Notify", src, title, message, type)
+ end,
},
}
--- Displays notifications to the player using the configured notification system.
diff --git a/shared/phones.lua b/shared/phones.lua
index cf3ee5c..bfbefbf 100644
--- a/shared/phones.lua
+++ b/shared/phones.lua
@@ -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)
- exports["gksphone"]:SendNewMail(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)
+ },
+ { name = "yflip-phone",
+ sendMail =
+ function(mailData)
TriggerServerEvent(getScript()..":yflip:SendMail", mailData)
end,
- },
- { name = "qs-smartphone",
- send = function(mailData)
+ },
+ { name = "qs-smartphone",
+ sendMail =
+ function(mailData)
TriggerServerEvent('qs-smartphone:server:sendNewMail', mailData)
end,
- },
- { name = "qs-smartphone-pro",
- send = function(mailData)
+ },
+ { name = "qs-smartphone-pro",
+ sendMail =
+ function(mailData)
TriggerServerEvent('phone:sendNewMail', mailData)
end,
- },
- { name = "roadphone",
- send = function(mailData)
+ },
+ { name = "roadphone",
+ sendMail =
+ function(mailData)
-- Convert HTML line breaks to newlines for roadphone.
mailData.message = mailData.message:gsub("%
", "\n")
exports["roadphone"]:sendMail(mailData)
end,
- },
- { name = "lb-phone",
- send = function(mailData)
+ },
+ { name = "lb-phone",
+ sendMail =
+ function(mailData)
-- Convert HTML line breaks to newlines for lb-phone.
mailData.message = mailData.message:gsub("%
", "\n")
TriggerServerEvent(getScript()..":lbphone:SendMail", mailData)
end,
- },
- { name = "qb-phone",
- send = function(mailData)
+ },
+ { name = "qb-phone",
+ 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
- },
- {
- 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
+ end,
+ },
+ { name = "npwd_qbx_mail",
+ sendMail =
+ function(mailData)
+ TriggerServerEvent('qb-phone:server:sendNewMail', mailData)
+ 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,
+ },
- -- 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
- },
- 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 = "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
+--- 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
- 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
- }
- }
+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
diff --git a/shared/polyZone.lua b/shared/polyZone.lua
index e594703..faf901a 100644
--- a/shared/polyZone.lua
+++ b/shared/polyZone.lua
@@ -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)
diff --git a/shared/skillcheck.lua b/shared/skillcheck.lua
index 55940ae..ebf1efd 100644
--- a/shared/skillcheck.lua
+++ b/shared/skillcheck.lua
@@ -1,58 +1,72 @@
-local activeSkillCheck = false
+local skillCheckFunc = {
+ qb = {
+ start = function(data)
+ local Skillbar = exports["qb-minigames"]:Skillbar()
+ if Skillbar then
+ return true
+ else
+ return false
+ end
+ end,
+ },
+ ox = {
+ start = function(data)
+ local Skillbar = exports[OXLibExport]:skillCheck(
+ {
+ "easy",
+ "easy",
+ "easy"
+ },
+ {
+ "1",
+ "2",
+ "3",
+ "4"
+ })
+ if Skillbar then
+ return true
+ else
+ return false
+ end
+ 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",
+ "easy",
+ "easy"
+ },
+ {
+ "1",
+ "2",
+ "3",
+ "4"
+ })
+ if Skillbar then
+ return true
+ else
+ return false
+ end
+ end,
+ },
+
+}
function skillCheck(data)
- local result = false
-
- if Config.System.skillCheck == "qb" then
- local Skillbar = exports["qb-minigames"]:Skillbar()
- if Skillbar then
- result = true
- else
- result = false
- end
-
- elseif Config.System.skillCheck == "ox" then
- local Skillbar = exports[OXLibExport]:skillCheck(
- {
- "easy",
- "easy",
- "easy"
- },
- {
- "1",
- "2",
- "3",
- "4"
- })
- if Skillbar then
- result = true
- else
- result = false
- end
- elseif Config.System.skillCheck == "gta" then
- exports.jim_bridge:skillCheck()
-
- elseif Config.System.skillCheck == "lation" then
- local Skillbar = exports.lation_ui:skillCheck("",
- {
- "easy",
- "easy",
- "easy"
- },
- {
- "1",
- "2",
- "3",
- "4"
- })
-
- if Skillbar then
- result = true
- else
- result = false
- end
- else
- result = true
+ if Config.System.skillCheck then
+ return skillCheckFunc[Config.System.skillCheck].start(data)
end
- return result
+ return true
end
\ No newline at end of file
diff --git a/shared/societybank.lua b/shared/societybank.lua
index 549211a..35078c8 100644
--- a/shared/societybank.lua
+++ b/shared/societybank.lua
@@ -12,112 +12,122 @@
]]
local societyFunc = {
- {
- 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'")
- exports["qb-banking"]:CreateJobAccount(society, 0)
- Wait(150)
- elseif Gangs[society] then
- print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
- exports["qb-banking"]:CreateGangAccount(society, 0)
- Wait(150)
+ { 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'")
+ exports["qb-banking"]:CreateJobAccount(society, 0)
+ Wait(150)
+ elseif Gangs[society] then
+ print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
+ exports["qb-banking"]:CreateGangAccount(society, 0)
+ Wait(150)
+ end
end
- end
- return exports["qb-banking"]:GetAccountBalance(society)
- end,
- 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'")
- exports["qb-banking"]:CreateJobAccount(society, 0) Wait(150) -- make new account if return "null"
- elseif Gangs[society] then
- print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
- exports["qb-banking"]:CreateGangAccount(society, 0) Wait(150) -- make new account if return "null"
+ return exports["qb-banking"]:GetAccountBalance(society)
+ end,
+ 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'")
+ exports["qb-banking"]:CreateJobAccount(society, 0) Wait(150) -- make new account if return "null"
+ elseif Gangs[society] then
+ print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
+ exports["qb-banking"]:CreateGangAccount(society, 0) Wait(150) -- make new account if return "null"
+ end
end
- end
- exports["qb-banking"]:RemoveMoney(society, amount)
- end,
- 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'")
- exports["qb-banking"]:CreateJobAccount(society, 0)
- Wait(150)
- elseif Gangs[society] then
- print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
- exports["qb-banking"]:CreateGangAccount(society, 0)
- Wait(150)
+ exports["qb-banking"]:RemoveMoney(society, amount)
+ end,
+ 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'")
+ exports["qb-banking"]:CreateJobAccount(society, 0)
+ Wait(150)
+ elseif Gangs[society] then
+ print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
+ exports["qb-banking"]:CreateGangAccount(society, 0)
+ Wait(150)
+ end
end
- end
- exports["qb-banking"]:AddMoney(society, amount)
- end,
+ exports["qb-banking"]:AddMoney(society, amount)
+ end,
},
- {
- bankName = "Renewed-Banking",
- getAccount = function(society)
- return exports["Renewed-Banking"]:getAccountMoney(society)
- end,
- chargeSociety = function(society, amount)
- exports['Renewed-Banking']:removeAccountMoney(society, amount)
- end,
- fundSociety = function(society, amount)
- exports['Renewed-Banking']:addAccountMoney(society, amount)
- end,
+ { bankName = "Renewed-Banking",
+ getAccount =
+ function(society)
+ return exports["Renewed-Banking"]:getAccountMoney(society)
+ end,
+ chargeSociety =
+ function(society, amount)
+ exports['Renewed-Banking']:removeAccountMoney(society, amount)
+ end,
+ fundSociety =
+ function(society, amount)
+ exports['Renewed-Banking']:addAccountMoney(society, amount)
+ end,
},
- {
- bankName = "fd_banking",
- getAccount = function(society)
- return exports["fd_banking"]:GetAccount(society)
- end,
- chargeSociety = function(society, amount)
- exports["fd_banking"]:RemoveMoney(society, amount)
- end,
- fundSociety = function(society, amount)
- exports["fd_banking"]:AddMoney(society, amount)
- end,
+ { bankName = "fd_banking",
+ getAccount =
+ function(society)
+ return exports["fd_banking"]:GetAccount(society)
+ end,
+ chargeSociety =
+ function(society, amount)
+ exports["fd_banking"]:RemoveMoney(society, amount)
+ end,
+ fundSociety =
+ function(society, amount)
+ exports["fd_banking"]:AddMoney(society, amount)
+ end,
},
- {
- bankName = "okokBanking",
- getAccount = function(society)
- return exports['okokBanking']:GetAccount(society)
- end,
- chargeSociety = function(society, amount)
- exports['okokBanking']:RemoveMoney(society, amount)
- end,
- fundSociety = function(society, amount)
- exports['okokBanking']:AddMoney(society, amount)
- end,
+ { bankName = "okokBanking",
+ getAccount =
+ function(society)
+ return exports['okokBanking']:GetAccount(society)
+ end,
+ chargeSociety =
+ function(society, amount)
+ exports['okokBanking']:RemoveMoney(society, amount)
+ end,
+ fundSociety =
+ function(society, amount)
+ exports['okokBanking']:AddMoney(society, amount)
+ end,
},
- {
- 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)
- if Jobs[society] then
- exports["tgiann-bank"]:RemoveJobMoney(society, amount)
- else
- exports["tgiann-bank"]:RemoveGangMoney(society, amount)
- end
- end,
- fundSociety = function(society, amount)
- if Jobs[society] then
- exports["tgiann-bank"]:AddJobMoney(society, amount)
- else
- exports["tgiann-bank"]:AddGangMoney(society, amount)
- end
- end,
+ { 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)
+ if Jobs[society] then
+ exports["tgiann-bank"]:RemoveJobMoney(society, amount)
+ else
+ exports["tgiann-bank"]:RemoveGangMoney(society, amount)
+ end
+ end,
+ fundSociety =
+ function(society, amount)
+ if Jobs[society] then
+ exports["tgiann-bank"]:AddJobMoney(society, amount)
+ else
+ exports["tgiann-bank"]:AddGangMoney(society, amount)
+ end
+ end,
},
}
@@ -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)
diff --git a/shared/targets.lua b/shared/targets.lua
index 0dce114..fdf993c 100644
--- a/shared/targets.lua
+++ b/shared/targets.lua
@@ -18,172 +18,190 @@
]]
local targetFunc = {
- {
- targetName = OXTargetExport,
- entityTarget = function(entity, opts, dist)
- local options = {}
- for i = 1, #opts do
- options[i] = {
- icon = opts[i].icon,
- label = opts[i].label,
- items = opts[i].item or nil,
- groups = opts[i].job or opts[i].gang,
- onSelect = opts[i].action,
- distance = dist,
- canInteract = opts[i].canInteract or nil,
- }
- end
- exports[OXTargetExport]:addLocalEntity(entity, options)
- end,
+ { targetName = OXTargetExport,
+ entityTarget =
+ function(entity, opts, dist)
+ local options = {}
+ for i = 1, #opts do
+ options[i] = {
+ icon = opts[i].icon,
+ label = opts[i].label,
+ items = opts[i].item or nil,
+ groups = opts[i].job or opts[i].gang,
+ onSelect = opts[i].action,
+ distance = dist,
+ canInteract = opts[i].canInteract or nil,
+ }
+ end
+ exports[OXTargetExport]:addLocalEntity(entity, options)
+ end,
- boxTarget = function(data, opts, dist)
- local options = {}
- for i = 1, #opts do
- options[i] = {
- icon = opts[i].icon,
- label = opts[i].label,
- items = opts[i].item or nil,
- groups = opts[i].groups or opts[i].job or opts[i].gang,
- onSelect = opts[i].onSelect or opts[i].action,
- distance = dist,
- canInteract = opts[i].canInteract or nil,
- }
- end
+ boxTarget =
+ function(data, opts, dist)
+ local options = {}
+ for i = 1, #opts do
+ options[i] = {
+ icon = opts[i].icon,
+ label = opts[i].label,
+ items = opts[i].item or nil,
+ groups = opts[i].groups or opts[i].job or opts[i].gang,
+ onSelect = opts[i].onSelect or opts[i].action,
+ distance = dist,
+ canInteract = opts[i].canInteract or nil,
+ }
+ end
- data[5].maxZ = data[5].maxZ or (data[2].z + 0.80)
- data[5].minZ = data[5].minZ or data[2].z - 1.05
- local thickness = ((data[5].maxZ / 2) - (data[5].minZ / 2)) * 2
- local mid = data[5].maxZ - ((data[5].maxZ / 2) - (data[5].minZ / 2))
+ data[5].maxZ = data[5].maxZ or (data[2].z + 0.80)
+ data[5].minZ = data[5].minZ or data[2].z - 1.05
+ local thickness = ((data[5].maxZ / 2) - (data[5].minZ / 2)) * 2
+ local mid = data[5].maxZ - ((data[5].maxZ / 2) - (data[5].minZ / 2))
- data[2] = vec3(data[2].x, data[2].y, mid) -- force the coord to middle of the minZ and maxZ
+ data[2] = vec3(data[2].x, data[2].y, mid) -- force the coord to middle of the minZ and maxZ
- local target = exports[OXTargetExport]:addBoxZone({
- coords = data[2],
- size = vec3(data[4], data[3], thickness), -- size uses the math to determine how high it needs to be
- rotation = data[5].heading,
- debug = data[5].debugPoly,
- options = options
- })
- return target
- end,
+ local target = exports[OXTargetExport]:addBoxZone({
+ coords = data[2],
+ size = vec3(data[4], data[3], thickness), -- size uses the math to determine how high it needs to be
+ rotation = data[5].heading,
+ debug = data[5].debugPoly,
+ options = options
+ })
+ return target
+ end,
- circleTarget = function(data, opts, dist)
- local options = {}
- for i = 1, #opts do
- options[i] = {
- icon = opts[i].icon,
- label = opts[i].label,
- items = opts[i].item or nil,
- groups = opts[i].job or opts[i].gang,
- onSelect = opts[i].onSelect or opts[i].action,
- distance = dist,
- canInteract = opts[i].canInteract or nil,
- }
- end
- local target = exports[OXTargetExport]:addSphereZone({
- coords = data[2],
- radius = data[3],
- debug = data[4].debugPoly,
- options = options
- })
- return target
- end,
+ circleTarget =
+ function(data, opts, dist)
+ local options = {}
+ for i = 1, #opts do
+ options[i] = {
+ icon = opts[i].icon,
+ label = opts[i].label,
+ items = opts[i].item or nil,
+ groups = opts[i].job or opts[i].gang,
+ onSelect = opts[i].onSelect or opts[i].action,
+ distance = dist,
+ canInteract = opts[i].canInteract or nil,
+ }
+ end
+ local target = exports[OXTargetExport]:addSphereZone({
+ coords = data[2],
+ radius = data[3],
+ debug = data[4].debugPoly,
+ options = options
+ })
+ return target
+ end,
- modelTarget = function(models, opts, dist)
- local options = {}
- for i = 1, #opts do
- options[i] = {
- icon = opts[i].icon,
- label = opts[i].label,
- items = opts[i].item or nil,
- groups = opts[i].job or opts[i].gang,
- onSelect = opts[i].action,
- distance = dist,
- canInteract = opts[i].canInteract or nil,
- }
- end
- exports[OXTargetExport]:addModel(models, options)
- end,
+ modelTarget =
+ function(models, opts, dist)
+ local options = {}
+ for i = 1, #opts do
+ options[i] = {
+ icon = opts[i].icon,
+ label = opts[i].label,
+ items = opts[i].item or nil,
+ groups = opts[i].job or opts[i].gang,
+ onSelect = opts[i].action,
+ distance = dist,
+ canInteract = opts[i].canInteract or nil,
+ }
+ end
+ exports[OXTargetExport]:addModel(models, options)
+ end,
- removeTargetEntity = function(entity)
- exports[OXTargetExport]:removeLocalEntity(entity, nil)
- end,
+ removeTargetEntity =
+ function(entity)
+ exports[OXTargetExport]:removeLocalEntity(entity, nil)
+ end,
- removeTargetZone = function(target)
- exports[OXTargetExport]:removeZone(target, true)
- end,
+ removeTargetZone =
+ function(target)
+ exports[OXTargetExport]:removeZone(target, true)
+ end,
- removeTargetModel = function(model)
- exports[OXTargetExport]:removeModel(model, nil)
- end,
+ removeTargetModel =
+ function(model)
+ exports[OXTargetExport]:removeModel(model, nil)
+ end,
},
- {
- targetName = QBTargetExport,
- entityTarget = function(entity, opts, dist)
- local options = { options = opts, distance = dist }
- exports[QBTargetExport]:AddTargetEntity(entity, options)
- end,
+ { targetName = QBTargetExport,
+ entityTarget =
+ function(entity, opts, dist)
+ local options = { options = opts, distance = dist }
+ exports[QBTargetExport]:AddTargetEntity(entity, options)
+ end,
- 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,
+ 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)
- local options = { options = opts, distance = dist }
- local target = exports[QBTargetExport]:AddCircleZone(data[1], data[2], data[3], data[4], options)
- return data[1]
- end,
+ 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)
- local options = { options = opts, distance = dist }
- exports[QBTargetExport]:AddTargetModel(models, options)
- end,
+ modelTarget =
+ function(models, opts, dist)
+ local options = { options = opts, distance = dist }
+ exports[QBTargetExport]:AddTargetModel(models, options)
+ end,
- removeTargetEntity = function(entity)
- exports[QBTargetExport]:RemoveTargetEntity(entity)
- end,
+ removeTargetEntity =
+ function(entity)
+ exports[QBTargetExport]:RemoveTargetEntity(entity)
+ end,
- removeTargetZone = function(target)
- exports[QBTargetExport]:RemoveZone(target)
- end,
+ removeTargetZone =
+ function(target)
+ exports[QBTargetExport]:RemoveZone(target)
+ end,
- removeTargetModel = function(model)
- exports[QBTargetExport]:RemoveTargetModel(model, "Test")
- end,
+ removeTargetModel =
+ function(model)
+ exports[QBTargetExport]:RemoveTargetModel(model, "Test")
+ end,
},
- {
- targetName = "jim_bridge",
- entityTarget = function(entity, opts, dist)
- return exports.jim_bridge:createEntityTarget(entity, opts, dist)
- end,
+ { targetName = "jim_bridge",
+ entityTarget =
+ function(entity, opts, dist)
+ return exports.jim_bridge:createEntityTarget(entity, opts, dist)
+ end,
- boxTarget = function(data, opts, dist)
- return exports.jim_bridge:createZoneTarget(data, opts, dist)
- end,
+ boxTarget =
+ function(data, opts, dist)
+ return exports.jim_bridge:createZoneTarget(data, opts, dist)
+ end,
- circleTarget = function(data, opts, dist)
- return exports.jim_bridge:createZoneTarget(data, opts, dist)
- end,
+ circleTarget =
+ function(data, opts, dist)
+ return exports.jim_bridge:createZoneTarget(data, opts, dist)
+ end,
- modelTarget = function(models, opts, dist)
- return exports.jim_bridge:createModelTarget(models, opts, dist)
- end,
+ modelTarget =
+ function(models, opts, dist)
+ return exports.jim_bridge:createModelTarget(models, opts, dist)
+ end,
- removeTargetEntity = function(entity)
- exports.jim_bridge:removeEntityTarget(entity)
- end,
+ removeTargetEntity =
+ function(entity)
+ exports.jim_bridge:removeEntityTarget(entity)
+ end,
- removeTargetZone = function(target)
- exports.jim_bridge:removeZoneTarget(target)
- end,
+ removeTargetZone =
+ function(target)
+ exports.jim_bridge:removeZoneTarget(target)
+ end,
- removeTargetModel = function(model)
- exports.jim_bridge:removeZoneTarget(model)
- end,
+ 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