mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-17 05:56:02 +01:00
More + optimization
This commit is contained in:
@@ -124,7 +124,9 @@ function craftingMenu(data)
|
|||||||
itemTable[l] = b
|
itemTable[l] = b
|
||||||
end
|
end
|
||||||
|
|
||||||
while not canCarryTable do Wait(0) end
|
while not canCarryTable do
|
||||||
|
Wait(10)
|
||||||
|
end
|
||||||
disable = not checkStashItem(data.stashName, itemTable)
|
disable = not checkStashItem(data.stashName, itemTable)
|
||||||
setheader = ((metadata and metadata.label) or (Items[tostring(k)] and Items[tostring(k)].label) or "error - "..tostring(k))
|
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 "")
|
||||||
|
|||||||
@@ -8,19 +8,22 @@
|
|||||||
-- Text system handlers
|
-- Text system handlers
|
||||||
local textHandlers = {
|
local textHandlers = {
|
||||||
qb = {
|
qb = {
|
||||||
show = function(text, image)
|
show =
|
||||||
|
function(text, image)
|
||||||
if image then
|
if image then
|
||||||
text = '<img src="'..(radarTable[image] or "")..'" style="width:12px;height:12px">'..text
|
text = '<img src="'..(radarTable[image] or "")..'" style="width:12px;height:12px">'..text
|
||||||
end
|
end
|
||||||
exports[QBExport]:DrawText(text, 'left')
|
exports[QBExport]:DrawText(text, 'left')
|
||||||
end,
|
end,
|
||||||
hide = function()
|
hide =
|
||||||
|
function()
|
||||||
exports[QBExport]:HideText()
|
exports[QBExport]:HideText()
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
ox = {
|
ox = {
|
||||||
show = function(input, image, oxStyleTable)
|
show =
|
||||||
|
function(input, image, oxStyleTable)
|
||||||
local inputCount = #input
|
local inputCount = #input
|
||||||
for i = 1, inputCount do
|
for i = 1, inputCount do
|
||||||
input[i] = input[i] .. (i ~= inputCount and " \n" or "")
|
input[i] = input[i] .. (i ~= inputCount and " \n" or "")
|
||||||
@@ -31,13 +34,15 @@ local textHandlers = {
|
|||||||
style = oxStyleTable
|
style = oxStyleTable
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
hide = function()
|
hide =
|
||||||
|
function()
|
||||||
lib.hideTextUI()
|
lib.hideTextUI()
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
lation = {
|
lation = {
|
||||||
show = function(input, image)
|
show =
|
||||||
|
function(input, image)
|
||||||
local inputCount = #input
|
local inputCount = #input
|
||||||
for i = 1, inputCount do
|
for i = 1, inputCount do
|
||||||
input[i] = input[i] .. (i ~= inputCount and " \n" or "")
|
input[i] = input[i] .. (i ~= inputCount and " \n" or "")
|
||||||
@@ -50,13 +55,29 @@ local textHandlers = {
|
|||||||
position = 'left-center'
|
position = 'left-center'
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
hide = function()
|
hide =
|
||||||
|
function()
|
||||||
exports.lation_ui:hideText()
|
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
|
end
|
||||||
|
ESX.TextUI(text, nil)
|
||||||
|
end,
|
||||||
|
hide =
|
||||||
|
function()
|
||||||
|
ESX.HideUI()
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
gta = {
|
gta = {
|
||||||
show = function(input, image, style)
|
show =
|
||||||
|
function(input, image, style)
|
||||||
local text = ""
|
local text = ""
|
||||||
for i = 1, #input do
|
for i = 1, #input do
|
||||||
if input[i] ~= "" then
|
if input[i] ~= "" then
|
||||||
@@ -68,25 +89,15 @@ local textHandlers = {
|
|||||||
end
|
end
|
||||||
DisplayHelpMsg(text:gsub("%:", ":~" .. (style or "g") .. "~"))
|
DisplayHelpMsg(text:gsub("%:", ":~" .. (style or "g") .. "~"))
|
||||||
end,
|
end,
|
||||||
hide = function()
|
hide =
|
||||||
|
function()
|
||||||
ClearAllHelpMessages()
|
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,
|
end,
|
||||||
hide = function()
|
|
||||||
ESX.HideUI()
|
|
||||||
end
|
|
||||||
},
|
},
|
||||||
|
|
||||||
red = {
|
red = {
|
||||||
show = function(input)
|
show =
|
||||||
|
function(input)
|
||||||
local text = ""
|
local text = ""
|
||||||
for i = 1, #input do
|
for i = 1, #input do
|
||||||
if input[i] ~= "" then
|
if input[i] ~= "" then
|
||||||
@@ -95,9 +106,10 @@ local textHandlers = {
|
|||||||
end
|
end
|
||||||
TriggerEvent("jim-redui:DrawText", text)
|
TriggerEvent("jim-redui:DrawText", text)
|
||||||
end,
|
end,
|
||||||
hide = function()
|
hide =
|
||||||
|
function()
|
||||||
TriggerEvent("jim-redui:HideText")
|
TriggerEvent("jim-redui:HideText")
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,6 @@ function checkExportExists(resource, export)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
-- Debugging and JSON Utilities
|
-- Debugging and JSON Utilities
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
|
|||||||
@@ -1306,7 +1306,8 @@ function hasItem(items, amount, src)
|
|||||||
if not doesItemExist(item) then
|
if not doesItemExist(item) then
|
||||||
print("^4ERROR^7: ^2Script can't find ingredient item in Shared Items - ^1"..item.."^7")
|
print("^4ERROR^7: ^2Script can't find ingredient item in Shared Items - ^1"..item.."^7")
|
||||||
end
|
end
|
||||||
for k, inv in ipairs(InvFunc) do
|
for i = 1, #InvFunc do
|
||||||
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
local hasItem, count = inv.hasItem(item, amt, src, grabInv)
|
local hasItem, count = inv.hasItem(item, amt, src, grabInv)
|
||||||
|
|
||||||
@@ -1344,7 +1345,8 @@ function getPlayerInv(src)
|
|||||||
local grabInv = nil
|
local grabInv = nil
|
||||||
local foundInv = ""
|
local foundInv = ""
|
||||||
|
|
||||||
for _, inv in ipairs(InvFunc) do
|
for i = 1, #InvFunc do
|
||||||
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
foundInv = inv.invName
|
foundInv = inv.invName
|
||||||
grabInv = inv.getPlayerInv(src)
|
grabInv = inv.getPlayerInv(src)
|
||||||
@@ -1380,7 +1382,8 @@ end
|
|||||||
function invImg(item)
|
function invImg(item)
|
||||||
local imgLink = ""
|
local imgLink = ""
|
||||||
if item ~= "" and doesItemExist(item) then
|
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
|
if isStarted(inv.invName) then
|
||||||
imgLink = inv.invImg(item)
|
imgLink = inv.invImg(item)
|
||||||
break
|
break
|
||||||
@@ -1535,10 +1538,10 @@ RegisterNetEvent(getScript()..":server:toggleItem", function(give, item, amount,
|
|||||||
local src = (newsrc and tonumber(newsrc)) or source
|
local src = (newsrc and tonumber(newsrc)) or source
|
||||||
|
|
||||||
-- Only server resources may set newsrc; clients cannot.
|
-- Only server resources may set newsrc; clients cannot.
|
||||||
if newsrc ~= nil and source ~= 0 then
|
--if newsrc ~= nil and source ~= 0 then
|
||||||
debugPrint("^1DENY^7: client tried to set newsrc")
|
-- debugPrint("^1DENY^7: client tried to set newsrc")
|
||||||
return
|
-- return
|
||||||
end
|
--end
|
||||||
|
|
||||||
if (give == true or give == 1) then
|
if (give == true or give == 1) then
|
||||||
if newsrc == nil then -- this must be coming from client this would be blank
|
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)
|
dupeWarn(src, item, amount)
|
||||||
|
|
||||||
else
|
else
|
||||||
for _, inv in ipairs(InvFunc) do
|
for i = 1, #InvFunc do
|
||||||
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
invName = inv.invName
|
invName = inv.invName
|
||||||
inv.removeItem(src, item, remamount)
|
inv.removeItem(src, item, remamount)
|
||||||
@@ -1586,7 +1590,8 @@ RegisterNetEvent(getScript()..":server:toggleItem", function(give, item, amount,
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
local amountToAdd = amount or 1
|
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
|
if isStarted(inv.invName) then
|
||||||
invName = inv.invName
|
invName = inv.invName
|
||||||
inv.addItem(src, item, amountToAdd, info, slot)
|
inv.addItem(src, item, amountToAdd, info, slot)
|
||||||
@@ -1734,7 +1739,8 @@ end
|
|||||||
--- ```
|
--- ```
|
||||||
RegisterNetEvent(getScript()..":server:setItemMetaData", function(data, src)
|
RegisterNetEvent(getScript()..":server:setItemMetaData", function(data, src)
|
||||||
local src = src or source
|
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
|
if isStarted(inv.invName) then
|
||||||
inv.setItemMetadata(data, src)
|
inv.setItemMetadata(data, src)
|
||||||
break
|
break
|
||||||
@@ -1811,7 +1817,8 @@ end
|
|||||||
--- end
|
--- end
|
||||||
function canCarry(itemTable, src)
|
function canCarry(itemTable, src)
|
||||||
local resultTable = {}
|
local resultTable = {}
|
||||||
for _, inv in pairs(InvFunc) do
|
for i = 1, #InvFunc do
|
||||||
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
return inv.canCarry(itemTable, src)
|
return inv.canCarry(itemTable, src)
|
||||||
end
|
end
|
||||||
@@ -1851,7 +1858,8 @@ end
|
|||||||
|
|
||||||
function getMaxInvWeight()
|
function getMaxInvWeight()
|
||||||
local weight = 0
|
local weight = 0
|
||||||
for _, inv in pairs(InvFunc) do
|
for i = 1, #InvFunc do
|
||||||
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
weight = inv.getMaxInvWeight()
|
weight = inv.getMaxInvWeight()
|
||||||
break
|
break
|
||||||
@@ -2106,7 +2114,8 @@ end
|
|||||||
function openStash(data)
|
function openStash(data)
|
||||||
if (data.job or data.gang) and not jobCheck(data.job or data.gang) then return end
|
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
|
if isStarted(inv.invName) then
|
||||||
inv.openStash(data)
|
inv.openStash(data)
|
||||||
lookEnt(data.coords)
|
lookEnt(data.coords)
|
||||||
@@ -2147,7 +2156,8 @@ RegisterNetEvent(getScript()..":server:openServerStash", function(data)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
function clearStash(stashId)
|
function clearStash(stashId)
|
||||||
for _, inv in pairs(InvFunc) do
|
for i = 1, #InvFunc do
|
||||||
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
debugPrint("^5Bridge^7: ^2Clearing ^3"..inv.invName.."^2 Stash^7:", stashId)
|
debugPrint("^5Bridge^7: ^2Clearing ^3"..inv.invName.."^2 Stash^7:", stashId)
|
||||||
inv.clearStash(stashId)
|
inv.clearStash(stashId)
|
||||||
@@ -2180,7 +2190,8 @@ function getStash(stashName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local stashItems, items = {}, {}
|
local stashItems, items = {}, {}
|
||||||
for _, inv in pairs(InvFunc) do
|
for i = 1, #InvFunc do
|
||||||
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
debugPrint("^6Bridge^7: ^2Retrieving ^3"..inv.invName.." ^2Stash^7:", stashName)
|
debugPrint("^6Bridge^7: ^2Retrieving ^3"..inv.invName.." ^2Stash^7:", stashName)
|
||||||
stashItems = inv.getStash(stashName)
|
stashItems = inv.getStash(stashName)
|
||||||
@@ -2240,7 +2251,8 @@ function stashRemoveItem(stashItems, stashName, items)
|
|||||||
stashName = { stashName }
|
stashName = { stashName }
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, inv in pairs(InvFunc) do
|
for i = 1, #InvFunc do
|
||||||
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
inv.stashRemoveItem(stashItems, stashName[1], items)
|
inv.stashRemoveItem(stashItems, stashName[1], items)
|
||||||
return
|
return
|
||||||
@@ -2327,7 +2339,8 @@ end
|
|||||||
--- )
|
--- )
|
||||||
--- ```
|
--- ```
|
||||||
function registerStash(name, label, slots, weight, owner, coords)
|
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
|
if isStarted(inv.invName) then
|
||||||
inv.registerStash(name, label, slots, weight, owner, coords)
|
inv.registerStash(name, label, slots, weight, owner, coords)
|
||||||
return
|
return
|
||||||
@@ -2543,7 +2556,8 @@ function openShop(data)
|
|||||||
lookEnt(data.coords)
|
lookEnt(data.coords)
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, inv in ipairs(InvFunc) do
|
for i = 1, #InvFunc do
|
||||||
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
inv.openShop(data)
|
inv.openShop(data)
|
||||||
lookEnt(data.coords)
|
lookEnt(data.coords)
|
||||||
@@ -2553,7 +2567,8 @@ function openShop(data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
RegisterNetEvent(getScript()..':server:openServerShop', function(shopName)
|
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
|
if isStarted(inv.invName) then
|
||||||
inv.serverOpenShop(shopName)
|
inv.serverOpenShop(shopName)
|
||||||
break
|
break
|
||||||
@@ -2575,7 +2590,8 @@ end)
|
|||||||
function registerShop(name, label, items, society)
|
function registerShop(name, label, items, society)
|
||||||
local shopResource = ""
|
local shopResource = ""
|
||||||
|
|
||||||
for _, inv in ipairs(InvFunc) do
|
for i = 1, #InvFunc do
|
||||||
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
shopResource = inv.invName
|
shopResource = inv.invName
|
||||||
inv.registerShop(name, label, items, society)
|
inv.registerShop(name, label, items, society)
|
||||||
|
|||||||
@@ -247,7 +247,6 @@ function useDoor(data)
|
|||||||
Wait(100)
|
Wait(100)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function openBossMenu(isGang, group)
|
function openBossMenu(isGang, group)
|
||||||
if isStarted("qb-management") then
|
if isStarted("qb-management") then
|
||||||
if isGang then
|
if isGang then
|
||||||
|
|||||||
@@ -1,6 +1,226 @@
|
|||||||
local inProgress = false
|
local inProgress = false
|
||||||
local storedPID = nil
|
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.
|
--- 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).
|
--- 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
|
end
|
||||||
local result = nil
|
local result = nil
|
||||||
if data.cam then startTempCam(data.cam) end
|
if data.cam then startTempCam(data.cam) end
|
||||||
if Config.System.ProgressBar == "ox" then
|
|
||||||
local options = {
|
if progressFunc[Config.System.ProgressBar].start(data) then
|
||||||
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
|
result = true
|
||||||
else
|
else
|
||||||
result = false
|
result = false
|
||||||
end
|
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
|
while result == nil do
|
||||||
Wait(10)
|
Wait(10)
|
||||||
@@ -250,15 +300,7 @@ end
|
|||||||
---
|
---
|
||||||
--- This function cancels the progress bar based on the configured progress bar system, handling any necessary cleanup.
|
--- This function cancels the progress bar based on the configured progress bar system, handling any necessary cleanup.
|
||||||
function stopProgressBar()
|
function stopProgressBar()
|
||||||
if Config.System.ProgressBar == "ox" then
|
progressFunc[Config.System.ProgressBar].stop()
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- System to handle sending/sharing progress bars between players --
|
-- System to handle sending/sharing progress bars between players --
|
||||||
|
|||||||
@@ -6,6 +6,82 @@
|
|||||||
for getting and setting metadata.
|
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
|
-- Player Retrieval
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
@@ -20,26 +96,11 @@
|
|||||||
--- local player = GetPlayer(playerId)
|
--- local player = GetPlayer(playerId)
|
||||||
--- ```
|
--- ```
|
||||||
function GetPlayer(source)
|
function GetPlayer(source)
|
||||||
if isStarted(QBExport) then
|
for i = 1, #metaDataFunc do
|
||||||
debugPrint("^6Bridge^7: ^3GetPlayer^7() QBExport")
|
local framework = metaDataFunc[i]
|
||||||
return exports[QBExport]:GetCoreObject().Functions.GetPlayer(source)
|
if isStarted(framework.framework) then
|
||||||
|
return framework.GetPlayer(source)
|
||||||
elseif isStarted(QBXExport) then
|
end
|
||||||
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)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@@ -61,26 +122,19 @@ end
|
|||||||
--- local myMeta = getPlayerMetadata(player, "myKey")
|
--- local myMeta = getPlayerMetadata(player, "myKey")
|
||||||
--- ```
|
--- ```
|
||||||
function getPlayerMetadata(player, key)
|
function getPlayerMetadata(player, key)
|
||||||
|
-- Assume this is client side and callback to server to get the data
|
||||||
if not player then
|
if not player then
|
||||||
debugPrint("^6Bridge^7: ^3GetMetadata^7() calling server: "..key)
|
debugPrint("^6Bridge^7: ^3GetMetadata^7() calling server: "..key)
|
||||||
return triggerCallback(getScript()..":server:GetMetadata", key)
|
return triggerCallback(getScript()..":server:GetMetadata", key)
|
||||||
else
|
else
|
||||||
if isStarted(QBExport) or isStarted(QBXExport) then
|
-- else grab server metadata about the player
|
||||||
debugPrint("^6Bridge^7: ^3GetMetadata^7() QBExport/QBXExport", key)
|
for i = 1, #metaDataFunc do
|
||||||
return player.PlayerData.metadata[key]
|
local framework = metaDataFunc[i]
|
||||||
|
if isStarted(framework.framework) then
|
||||||
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]
|
|
||||||
|
|
||||||
|
debugPrint("^6Bridge^7: ^3GetMetadata^7() ^3"..framework.framework.."^7", key)
|
||||||
|
return framework.GetPlayerMetadata(player, key)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
@@ -123,34 +177,22 @@ end)
|
|||||||
--- setPlayerMetadata(player, "myKey", "newValue")
|
--- setPlayerMetadata(player, "myKey", "newValue")
|
||||||
--- ```
|
--- ```
|
||||||
function setPlayerMetadata(player, key, value)
|
function setPlayerMetadata(player, key, value)
|
||||||
debugPrint("^6Bridge^7: ^3SetMetadata^7() setting metadata for key: "..key)
|
debugPrint("^6Bridge^7: ^3SetMetadata^7() setting metadata^7...")
|
||||||
if isStarted(QBExport) or isStarted(QBXExport) then
|
for i = 1, #metaDataFunc do
|
||||||
debugPrint("^6Bridge^7: ^3SetMetadata^7() using QBExport/QBXExport")
|
local framework = metaDataFunc[i]
|
||||||
player.Functions.SetMetaData(key, value)
|
if isStarted(framework.framework) then
|
||||||
|
debugPrint("^6Bridge^7: ^3SetMetadata^7() ^3"..framework.framework.."^7", key, value)
|
||||||
elseif isStarted(ESXExport) then
|
return framework.GetPlayerMetadata(player, key)
|
||||||
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)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
debugPrint("^6Bridge^7: ^1Error setting metadata^7, ^1framework not supported^7?")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Register a server callback for setting metadata.
|
-- Register a server callback for setting metadata.
|
||||||
createCallback(getScript()..":server:setPlayerMetadata", function(source, key, value)
|
createCallback(getScript()..":server:setPlayerMetadata", function(source, key, value)
|
||||||
debugPrint("SetMetadata callback triggered for source:", source, "key:", key, "value:", value)
|
local src = source
|
||||||
local player = GetPlayer(source)
|
debugPrint("SetMetadata callback triggered for source:", src, "key:", key, "value:", value)
|
||||||
--[[if not player then
|
local player = GetPlayer(src)
|
||||||
print("Error setting metadata: player not found for source "..tostring(source))
|
|
||||||
return false
|
|
||||||
end]]
|
|
||||||
setPlayerMetadata(player, key, value)
|
setPlayerMetadata(player, key, value)
|
||||||
print("Metadata set successfully.", key)
|
print("Metadata set successfully.", key)
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -17,66 +17,89 @@
|
|||||||
|
|
||||||
local notifyFunc = {
|
local notifyFunc = {
|
||||||
okok = {
|
okok = {
|
||||||
client = function(title, message, type)
|
client =
|
||||||
|
function(title, message, type)
|
||||||
TriggerEvent('okokNotify:Alert', title, message, 6000, type)
|
TriggerEvent('okokNotify:Alert', title, message, 6000, type)
|
||||||
end,
|
end,
|
||||||
server = function(title, message, type, src)
|
server =
|
||||||
|
function(title, message, type, src)
|
||||||
TriggerClientEvent('okokNotify:Alert', src, title, message, 6000, type)
|
TriggerClientEvent('okokNotify:Alert', src, title, message, 6000, type)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
qb = {
|
qb = {
|
||||||
client = function(title, message, type)
|
client =
|
||||||
|
function(title, message, type)
|
||||||
TriggerEvent("QBCore:Notify", message, type)
|
TriggerEvent("QBCore:Notify", message, type)
|
||||||
end,
|
end,
|
||||||
server = function(title, message, type, src)
|
server =
|
||||||
|
function(title, message, type, src)
|
||||||
TriggerClientEvent("QBCore:Notify", src, message, type)
|
TriggerClientEvent("QBCore:Notify", src, message, type)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
qs = {
|
qs = {
|
||||||
client = function(title, message, type)
|
client =
|
||||||
|
function(title, message, type)
|
||||||
exports['qs-interface']:AddNotify(message, title, 6000)
|
exports['qs-interface']:AddNotify(message, title, 6000)
|
||||||
end,
|
end,
|
||||||
server = function(title, message, type, src)
|
server =
|
||||||
|
function(title, message, type, src)
|
||||||
TriggerClientEvent('interface:notification', src, message, title, 6000)
|
TriggerClientEvent('interface:notification', src, message, title, 6000)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
ox = {
|
ox = {
|
||||||
client = function(title, message, type)
|
client =
|
||||||
|
function(title, message, type)
|
||||||
exports.ox_lib:notify({ title = title, description = message, type = type or "success" })
|
exports.ox_lib:notify({ title = title, description = message, type = type or "success" })
|
||||||
end,
|
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" })
|
TriggerClientEvent('ox_lib:notify', src, { title = title, description = message, type = type or "success" })
|
||||||
end,
|
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 = {
|
esx = {
|
||||||
client = function(title, message, type)
|
client =
|
||||||
|
function(title, message, type)
|
||||||
exports["esx_notify"]:Notify(type, 4000, message)
|
exports["esx_notify"]:Notify(type, 4000, message)
|
||||||
end,
|
end,
|
||||||
server = function(title, message, type, src)
|
server =
|
||||||
|
function(title, message, type, src)
|
||||||
TriggerClientEvent(getScript()..":DisplayESXNotify", src, type, message)
|
TriggerClientEvent(getScript()..":DisplayESXNotify", src, type, message)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
lation = {
|
lation = {
|
||||||
client = function(title, message, type)
|
client =
|
||||||
|
function(title, message, type)
|
||||||
exports.lation_ui:notify({ title = title, message = message, type = type or "success", })
|
exports.lation_ui:notify({ title = title, message = message, type = type or "success", })
|
||||||
end,
|
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", })
|
TriggerClientEvent("lation_ui:notify", src, { title = title, message = message, type = type or "success", })
|
||||||
end,
|
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 = {
|
red = {
|
||||||
client = function(title, message, type)
|
client =
|
||||||
|
function(title, message, type)
|
||||||
TriggerEvent("jim-redui:Notify", title, message, type)
|
TriggerEvent("jim-redui:Notify", title, message, type)
|
||||||
end,
|
end,
|
||||||
server = function(title, message, type, src)
|
server =
|
||||||
|
function(title, message, type, src)
|
||||||
TriggerClientEvent("jim-redui:Notify", src, title, message, type)
|
TriggerClientEvent("jim-redui:Notify", src, title, message, type)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,102 +13,76 @@
|
|||||||
- jpr-phonesystem
|
- jpr-phonesystem
|
||||||
]]
|
]]
|
||||||
|
|
||||||
--- Sends a phone mail using the detected phone system.
|
local phoneFunc = {
|
||||||
--- The function iterates through a prioritized list of supported phone systems.
|
{ phone = "gksphone",
|
||||||
--- Once an active system is found (via `isStarted`), the corresponding mail function is executed.
|
sendMail = function(mailData)
|
||||||
---
|
|
||||||
--- @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)
|
exports["gksphone"]:SendNewMail(mailData)
|
||||||
end,
|
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",
|
{ name = "yflip-phone",
|
||||||
send = function(mailData)
|
sendMail =
|
||||||
|
function(mailData)
|
||||||
TriggerServerEvent(getScript()..":yflip:SendMail", mailData)
|
TriggerServerEvent(getScript()..":yflip:SendMail", mailData)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ name = "qs-smartphone",
|
{ name = "qs-smartphone",
|
||||||
send = function(mailData)
|
sendMail =
|
||||||
|
function(mailData)
|
||||||
TriggerServerEvent('qs-smartphone:server:sendNewMail', mailData)
|
TriggerServerEvent('qs-smartphone:server:sendNewMail', mailData)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ name = "qs-smartphone-pro",
|
{ name = "qs-smartphone-pro",
|
||||||
send = function(mailData)
|
sendMail =
|
||||||
|
function(mailData)
|
||||||
TriggerServerEvent('phone:sendNewMail', mailData)
|
TriggerServerEvent('phone:sendNewMail', mailData)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ name = "roadphone",
|
{ name = "roadphone",
|
||||||
send = function(mailData)
|
sendMail =
|
||||||
|
function(mailData)
|
||||||
-- Convert HTML line breaks to newlines for roadphone.
|
-- Convert HTML line breaks to newlines for roadphone.
|
||||||
mailData.message = mailData.message:gsub("%<br>", "\n")
|
mailData.message = mailData.message:gsub("%<br>", "\n")
|
||||||
exports["roadphone"]:sendMail(mailData)
|
exports["roadphone"]:sendMail(mailData)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ name = "lb-phone",
|
{ name = "lb-phone",
|
||||||
send = function(mailData)
|
sendMail =
|
||||||
|
function(mailData)
|
||||||
-- Convert HTML line breaks to newlines for lb-phone.
|
-- Convert HTML line breaks to newlines for lb-phone.
|
||||||
mailData.message = mailData.message:gsub("%<br>", "\n")
|
mailData.message = mailData.message:gsub("%<br>", "\n")
|
||||||
TriggerServerEvent(getScript()..":lbphone:SendMail", mailData)
|
TriggerServerEvent(getScript()..":lbphone:SendMail", mailData)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ name = "qb-phone",
|
{ name = "qb-phone",
|
||||||
send = function(mailData)
|
sendMail =
|
||||||
|
function(mailData)
|
||||||
TriggerServerEvent('qb-phone:server:sendNewMail', mailData)
|
TriggerServerEvent('qb-phone:server:sendNewMail', mailData)
|
||||||
end,
|
end,
|
||||||
},
|
sendInvoice =
|
||||||
{ name = "npwd_qbx_mail",
|
function(mailData)
|
||||||
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)
|
|
||||||
-- Defensive check for required fields
|
-- Defensive check for required fields
|
||||||
local required = { "billedCitizenid", "amount", "job", "name", "billerCitizenid", "src" }
|
local required = { "billedCitizenid", "amount", "job", "name", "billerCitizenid", "src" }
|
||||||
for _, field in ipairs(required) do
|
for _, field in ipairs(required) do
|
||||||
@@ -134,74 +108,73 @@ function sendPhoneInvoice(data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
TriggerClientEvent('qb-phone:RefreshPhone', mailData.src)
|
TriggerClientEvent('qb-phone:RefreshPhone', mailData.src)
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
{
|
{ name = "npwd_qbx_mail",
|
||||||
name = "codem-phone",
|
sendMail =
|
||||||
send = function(mailData)
|
function(mailData)
|
||||||
-- Defensive check for required fields
|
TriggerServerEvent('qb-phone:server:sendNewMail', mailData)
|
||||||
local required = { "billedCitizenid", "amount", "job", "name", "billerCitizenid", "src" }
|
end,
|
||||||
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
|
|
||||||
},
|
},
|
||||||
function(id)
|
{ name = "jpr-phonesystem",
|
||||||
-- if id then
|
sendMail =
|
||||||
-- TriggerClientEvent('qb-phone:client:AcceptorDenyInvoice', mailData.src, id, mailData.name, mailData.job, mailData.billerCitizenid, mailData.amount, GetInvokingResource())
|
function(mailData)
|
||||||
-- end
|
TriggerServerEvent(getScript()..":jpr:SendMail", mailData)
|
||||||
end
|
end,
|
||||||
)
|
},
|
||||||
|
{ name = "ef-phone",
|
||||||
|
sendMail =
|
||||||
end
|
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,
|
--- Sends a phone mail using the detected phone system.
|
||||||
['@amount'] = mailData.amount,
|
--- The function iterates through a prioritized list of supported phone systems.
|
||||||
['@society'] = mailData.job,
|
--- Once an active system is found (via `isStarted`), the corresponding mail function is executed.
|
||||||
['@sender'] = mailData.name,
|
---
|
||||||
['@sendercitizenid'] = mailData.billerCitizenid,
|
--- @param data table A table containing the mail data.
|
||||||
['@label'] = mailData.label
|
--- - 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
|
||||||
}
|
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.
|
-- Check each phone system in order and use the first active one.
|
||||||
for _, phone in ipairs(phoneSystems) do
|
|
||||||
if isStarted(phone.name) then
|
for i = 1, #phoneFunc do
|
||||||
debugPrint("^6Bridge^7[^3"..phone.name.."^7]: ^2Sending mail to player^7", data.src)
|
local script = phoneFunc[i]
|
||||||
phone.send(data)
|
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
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ local polyCreation = {
|
|||||||
---})
|
---})
|
||||||
---```
|
---```
|
||||||
function createPoly(data)
|
function createPoly(data)
|
||||||
for _, script in ipairs(polyCreation) do
|
for i = 1, #polyCreation do
|
||||||
|
local script = polyCreation[i]
|
||||||
if isStarted(script.polyZoneScript) then
|
if isStarted(script.polyZoneScript) then
|
||||||
debugPrint("^6Bridge^7: ^2Creating new poly with ^7'^4"..script.polyZoneScript.."^7': "..data.name)
|
debugPrint("^6Bridge^7: ^2Creating new poly with ^7'^4"..script.polyZoneScript.."^7': "..data.name)
|
||||||
return script.createPoly(data)
|
return script.createPoly(data)
|
||||||
@@ -140,7 +141,8 @@ end
|
|||||||
--- })
|
--- })
|
||||||
--- ```
|
--- ```
|
||||||
function createCirclePoly(data)
|
function createCirclePoly(data)
|
||||||
for _, script in ipairs(polyCreation) do
|
for i = 1, #polyCreation do
|
||||||
|
local script = polyCreation[i]
|
||||||
if isStarted(script.polyZoneScript) then
|
if isStarted(script.polyZoneScript) then
|
||||||
debugPrint("^6Bridge^7: ^2Creating new ^3Cricle^2 poly with ^7"..script.polyZoneScript.." "..data.name)
|
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)
|
debugPrint("^6Bridge^7: ^2Zone Stats - Coords: "..formatCoord(data.coords).." Radius: "..data.radius)
|
||||||
@@ -169,7 +171,8 @@ end
|
|||||||
--- removePolyZone(zone)
|
--- removePolyZone(zone)
|
||||||
--- ```
|
--- ```
|
||||||
function removePolyZone(Location)
|
function removePolyZone(Location)
|
||||||
for _, script in ipairs(polyCreation) do
|
for i = 1, #polyCreation do
|
||||||
|
local script = polyCreation[i]
|
||||||
if isStarted(script.polyZoneScript) then
|
if isStarted(script.polyZoneScript) then
|
||||||
debugPrint("^6Bridge^7: ^2Removing ^3"..script.polyZoneScript.." ^2Zone^7")
|
debugPrint("^6Bridge^7: ^2Removing ^3"..script.polyZoneScript.." ^2Zone^7")
|
||||||
script.removeZone(Location)
|
script.removeZone(Location)
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
local activeSkillCheck = false
|
local skillCheckFunc = {
|
||||||
|
qb = {
|
||||||
function skillCheck(data)
|
start = function(data)
|
||||||
local result = false
|
|
||||||
|
|
||||||
if Config.System.skillCheck == "qb" then
|
|
||||||
local Skillbar = exports["qb-minigames"]:Skillbar()
|
local Skillbar = exports["qb-minigames"]:Skillbar()
|
||||||
if Skillbar then
|
if Skillbar then
|
||||||
result = true
|
return true
|
||||||
else
|
else
|
||||||
result = false
|
return false
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
elseif Config.System.skillCheck == "ox" then
|
},
|
||||||
|
ox = {
|
||||||
|
start = function(data)
|
||||||
local Skillbar = exports[OXLibExport]:skillCheck(
|
local Skillbar = exports[OXLibExport]:skillCheck(
|
||||||
{
|
{
|
||||||
"easy",
|
"easy",
|
||||||
@@ -25,14 +24,24 @@ function skillCheck(data)
|
|||||||
"4"
|
"4"
|
||||||
})
|
})
|
||||||
if Skillbar then
|
if Skillbar then
|
||||||
result = true
|
return true
|
||||||
else
|
else
|
||||||
result = false
|
return false
|
||||||
end
|
end
|
||||||
elseif Config.System.skillCheck == "gta" then
|
end,
|
||||||
exports.jim_bridge:skillCheck()
|
},
|
||||||
|
gta = {
|
||||||
elseif Config.System.skillCheck == "lation" then
|
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("",
|
local Skillbar = exports.lation_ui:skillCheck("",
|
||||||
{
|
{
|
||||||
"easy",
|
"easy",
|
||||||
@@ -45,14 +54,19 @@ function skillCheck(data)
|
|||||||
"3",
|
"3",
|
||||||
"4"
|
"4"
|
||||||
})
|
})
|
||||||
|
|
||||||
if Skillbar then
|
if Skillbar then
|
||||||
result = true
|
return true
|
||||||
else
|
else
|
||||||
result = false
|
return false
|
||||||
end
|
end
|
||||||
else
|
end,
|
||||||
result = true
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function skillCheck(data)
|
||||||
|
if Config.System.skillCheck then
|
||||||
|
return skillCheckFunc[Config.System.skillCheck].start(data)
|
||||||
end
|
end
|
||||||
return result
|
return true
|
||||||
end
|
end
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
local societyFunc = {
|
local societyFunc = {
|
||||||
{
|
{ bankName = "qb-banking",
|
||||||
bankName = "qb-banking",
|
getAccount =
|
||||||
getAccount = function(society)
|
function(society)
|
||||||
if not exports["qb-banking"]:GetAccount(society) then
|
if not exports["qb-banking"]:GetAccount(society) then
|
||||||
if Jobs[society] then
|
if Jobs[society] then
|
||||||
print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
|
print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
|
||||||
@@ -28,7 +28,8 @@ local societyFunc = {
|
|||||||
end
|
end
|
||||||
return exports["qb-banking"]:GetAccountBalance(society)
|
return exports["qb-banking"]:GetAccountBalance(society)
|
||||||
end,
|
end,
|
||||||
chargeSociety = function(society, amount)
|
chargeSociety =
|
||||||
|
function(society, amount)
|
||||||
if not exports["qb-banking"]:GetAccount(society) then
|
if not exports["qb-banking"]:GetAccount(society) then
|
||||||
if Jobs[society] then
|
if Jobs[society] then
|
||||||
print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
|
print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
|
||||||
@@ -40,7 +41,8 @@ local societyFunc = {
|
|||||||
end
|
end
|
||||||
exports["qb-banking"]:RemoveMoney(society, amount)
|
exports["qb-banking"]:RemoveMoney(society, amount)
|
||||||
end,
|
end,
|
||||||
fundSociety = function(society, amount)
|
fundSociety =
|
||||||
|
function(society, amount)
|
||||||
if not exports["qb-banking"]:GetAccount(society) then
|
if not exports["qb-banking"]:GetAccount(society) then
|
||||||
if Jobs[society] then
|
if Jobs[society] then
|
||||||
print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
|
print("^6Bridge^7: ^2Making new bank account in ^7'^3qb-banking^7' ^2for ^7'^3"..society.."^7'")
|
||||||
@@ -56,62 +58,70 @@ local societyFunc = {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ bankName = "Renewed-Banking",
|
||||||
bankName = "Renewed-Banking",
|
getAccount =
|
||||||
getAccount = function(society)
|
function(society)
|
||||||
return exports["Renewed-Banking"]:getAccountMoney(society)
|
return exports["Renewed-Banking"]:getAccountMoney(society)
|
||||||
end,
|
end,
|
||||||
chargeSociety = function(society, amount)
|
chargeSociety =
|
||||||
|
function(society, amount)
|
||||||
exports['Renewed-Banking']:removeAccountMoney(society, amount)
|
exports['Renewed-Banking']:removeAccountMoney(society, amount)
|
||||||
end,
|
end,
|
||||||
fundSociety = function(society, amount)
|
fundSociety =
|
||||||
|
function(society, amount)
|
||||||
exports['Renewed-Banking']:addAccountMoney(society, amount)
|
exports['Renewed-Banking']:addAccountMoney(society, amount)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ bankName = "fd_banking",
|
||||||
bankName = "fd_banking",
|
getAccount =
|
||||||
getAccount = function(society)
|
function(society)
|
||||||
return exports["fd_banking"]:GetAccount(society)
|
return exports["fd_banking"]:GetAccount(society)
|
||||||
end,
|
end,
|
||||||
chargeSociety = function(society, amount)
|
chargeSociety =
|
||||||
|
function(society, amount)
|
||||||
exports["fd_banking"]:RemoveMoney(society, amount)
|
exports["fd_banking"]:RemoveMoney(society, amount)
|
||||||
end,
|
end,
|
||||||
fundSociety = function(society, amount)
|
fundSociety =
|
||||||
|
function(society, amount)
|
||||||
exports["fd_banking"]:AddMoney(society, amount)
|
exports["fd_banking"]:AddMoney(society, amount)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ bankName = "okokBanking",
|
||||||
bankName = "okokBanking",
|
getAccount =
|
||||||
getAccount = function(society)
|
function(society)
|
||||||
return exports['okokBanking']:GetAccount(society)
|
return exports['okokBanking']:GetAccount(society)
|
||||||
end,
|
end,
|
||||||
chargeSociety = function(society, amount)
|
chargeSociety =
|
||||||
|
function(society, amount)
|
||||||
exports['okokBanking']:RemoveMoney(society, amount)
|
exports['okokBanking']:RemoveMoney(society, amount)
|
||||||
end,
|
end,
|
||||||
fundSociety = function(society, amount)
|
fundSociety =
|
||||||
|
function(society, amount)
|
||||||
exports['okokBanking']:AddMoney(society, amount)
|
exports['okokBanking']:AddMoney(society, amount)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ bankName = "tgiann-bank",
|
||||||
bankName = "tgiann-bank",
|
getAccount =
|
||||||
getAccount = function(society)
|
function(society)
|
||||||
if Jobs[society] then
|
if Jobs[society] then
|
||||||
return exports["tgiann-bank"]:GetJobAccountBalance(society)
|
return exports["tgiann-bank"]:GetJobAccountBalance(society)
|
||||||
else
|
else
|
||||||
return exports["tgiann-bank"]:GetGangAccountBalance(society)
|
return exports["tgiann-bank"]:GetGangAccountBalance(society)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
chargeSociety = function(society, amount)
|
chargeSociety =
|
||||||
|
function(society, amount)
|
||||||
if Jobs[society] then
|
if Jobs[society] then
|
||||||
exports["tgiann-bank"]:RemoveJobMoney(society, amount)
|
exports["tgiann-bank"]:RemoveJobMoney(society, amount)
|
||||||
else
|
else
|
||||||
exports["tgiann-bank"]:RemoveGangMoney(society, amount)
|
exports["tgiann-bank"]:RemoveGangMoney(society, amount)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
fundSociety = function(society, amount)
|
fundSociety =
|
||||||
|
function(society, amount)
|
||||||
if Jobs[society] then
|
if Jobs[society] then
|
||||||
exports["tgiann-bank"]:AddJobMoney(society, amount)
|
exports["tgiann-bank"]:AddJobMoney(society, amount)
|
||||||
else
|
else
|
||||||
@@ -134,7 +144,8 @@ function getSocietyAccount(society)
|
|||||||
local amount = 0
|
local amount = 0
|
||||||
if society == nil or society == "none" then return amount end
|
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
|
if isStarted(script.bankName) then
|
||||||
local amount = script.getAccount(society)
|
local amount = script.getAccount(society)
|
||||||
debugPrint("^6Bridge^7: ^3"..script.bankName.."^7: ^2Retrieved account ^7'^6"..society.."^7' ($"..tostring(amount)..")")
|
debugPrint("^6Bridge^7: ^3"..script.bankName.."^7: ^2Retrieved account ^7'^6"..society.."^7' ($"..tostring(amount)..")")
|
||||||
@@ -156,7 +167,8 @@ end
|
|||||||
--- ```
|
--- ```
|
||||||
function chargeSociety(society, amount)
|
function chargeSociety(society, amount)
|
||||||
|
|
||||||
for _, script in pairs(societyFunc) do
|
for i = 1, #societyFunc do
|
||||||
|
local script = societyFunc[i]
|
||||||
if isStarted(script.bankName) then
|
if isStarted(script.bankName) then
|
||||||
script.chargeSociety(society, amount)
|
script.chargeSociety(society, amount)
|
||||||
local newAmount = getSocietyAccount(society)
|
local newAmount = getSocietyAccount(society)
|
||||||
@@ -177,7 +189,8 @@ end
|
|||||||
--- ```
|
--- ```
|
||||||
function fundSociety(society, amount)
|
function fundSociety(society, amount)
|
||||||
|
|
||||||
for _, script in pairs(societyFunc) do
|
for i = 1, #societyFunc do
|
||||||
|
local script = societyFunc[i]
|
||||||
if isStarted(script.bankName) then
|
if isStarted(script.bankName) then
|
||||||
script.fundSociety(society, amount)
|
script.fundSociety(society, amount)
|
||||||
local newAmount = getSocietyAccount(society)
|
local newAmount = getSocietyAccount(society)
|
||||||
|
|||||||
@@ -18,9 +18,9 @@
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
local targetFunc = {
|
local targetFunc = {
|
||||||
{
|
{ targetName = OXTargetExport,
|
||||||
targetName = OXTargetExport,
|
entityTarget =
|
||||||
entityTarget = function(entity, opts, dist)
|
function(entity, opts, dist)
|
||||||
local options = {}
|
local options = {}
|
||||||
for i = 1, #opts do
|
for i = 1, #opts do
|
||||||
options[i] = {
|
options[i] = {
|
||||||
@@ -36,7 +36,8 @@ local targetFunc = {
|
|||||||
exports[OXTargetExport]:addLocalEntity(entity, options)
|
exports[OXTargetExport]:addLocalEntity(entity, options)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
boxTarget = function(data, opts, dist)
|
boxTarget =
|
||||||
|
function(data, opts, dist)
|
||||||
local options = {}
|
local options = {}
|
||||||
for i = 1, #opts do
|
for i = 1, #opts do
|
||||||
options[i] = {
|
options[i] = {
|
||||||
@@ -67,7 +68,8 @@ local targetFunc = {
|
|||||||
return target
|
return target
|
||||||
end,
|
end,
|
||||||
|
|
||||||
circleTarget = function(data, opts, dist)
|
circleTarget =
|
||||||
|
function(data, opts, dist)
|
||||||
local options = {}
|
local options = {}
|
||||||
for i = 1, #opts do
|
for i = 1, #opts do
|
||||||
options[i] = {
|
options[i] = {
|
||||||
@@ -89,7 +91,8 @@ local targetFunc = {
|
|||||||
return target
|
return target
|
||||||
end,
|
end,
|
||||||
|
|
||||||
modelTarget = function(models, opts, dist)
|
modelTarget =
|
||||||
|
function(models, opts, dist)
|
||||||
local options = {}
|
local options = {}
|
||||||
for i = 1, #opts do
|
for i = 1, #opts do
|
||||||
options[i] = {
|
options[i] = {
|
||||||
@@ -105,83 +108,98 @@ local targetFunc = {
|
|||||||
exports[OXTargetExport]:addModel(models, options)
|
exports[OXTargetExport]:addModel(models, options)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
removeTargetEntity = function(entity)
|
removeTargetEntity =
|
||||||
|
function(entity)
|
||||||
exports[OXTargetExport]:removeLocalEntity(entity, nil)
|
exports[OXTargetExport]:removeLocalEntity(entity, nil)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
removeTargetZone = function(target)
|
removeTargetZone =
|
||||||
|
function(target)
|
||||||
exports[OXTargetExport]:removeZone(target, true)
|
exports[OXTargetExport]:removeZone(target, true)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
removeTargetModel = function(model)
|
removeTargetModel =
|
||||||
|
function(model)
|
||||||
exports[OXTargetExport]:removeModel(model, nil)
|
exports[OXTargetExport]:removeModel(model, nil)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ targetName = QBTargetExport,
|
||||||
targetName = QBTargetExport,
|
entityTarget =
|
||||||
entityTarget = function(entity, opts, dist)
|
function(entity, opts, dist)
|
||||||
local options = { options = opts, distance = dist }
|
local options = { options = opts, distance = dist }
|
||||||
exports[QBTargetExport]:AddTargetEntity(entity, options)
|
exports[QBTargetExport]:AddTargetEntity(entity, options)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
boxTarget = function(data, opts, dist)
|
boxTarget =
|
||||||
|
function(data, opts, dist)
|
||||||
local options = { options = opts, distance = dist }
|
local options = { options = opts, distance = dist }
|
||||||
local target = exports[QBTargetExport]:AddBoxZone(data[1], data[2], data[3], data[4], data[5], options)
|
local target = exports[QBTargetExport]:AddBoxZone(data[1], data[2], data[3], data[4], data[5], options)
|
||||||
return data[1]
|
return data[1]
|
||||||
end,
|
end,
|
||||||
|
|
||||||
circleTarget = function(data, opts, dist)
|
circleTarget =
|
||||||
|
function(data, opts, dist)
|
||||||
local options = { options = opts, distance = dist }
|
local options = { options = opts, distance = dist }
|
||||||
local target = exports[QBTargetExport]:AddCircleZone(data[1], data[2], data[3], data[4], options)
|
local target = exports[QBTargetExport]:AddCircleZone(data[1], data[2], data[3], data[4], options)
|
||||||
return data[1]
|
return data[1]
|
||||||
end,
|
end,
|
||||||
|
|
||||||
modelTarget = function(models, opts, dist)
|
modelTarget =
|
||||||
|
function(models, opts, dist)
|
||||||
local options = { options = opts, distance = dist }
|
local options = { options = opts, distance = dist }
|
||||||
exports[QBTargetExport]:AddTargetModel(models, options)
|
exports[QBTargetExport]:AddTargetModel(models, options)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
removeTargetEntity = function(entity)
|
removeTargetEntity =
|
||||||
|
function(entity)
|
||||||
exports[QBTargetExport]:RemoveTargetEntity(entity)
|
exports[QBTargetExport]:RemoveTargetEntity(entity)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
removeTargetZone = function(target)
|
removeTargetZone =
|
||||||
|
function(target)
|
||||||
exports[QBTargetExport]:RemoveZone(target)
|
exports[QBTargetExport]:RemoveZone(target)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
removeTargetModel = function(model)
|
removeTargetModel =
|
||||||
|
function(model)
|
||||||
exports[QBTargetExport]:RemoveTargetModel(model, "Test")
|
exports[QBTargetExport]:RemoveTargetModel(model, "Test")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{ targetName = "jim_bridge",
|
||||||
targetName = "jim_bridge",
|
entityTarget =
|
||||||
entityTarget = function(entity, opts, dist)
|
function(entity, opts, dist)
|
||||||
return exports.jim_bridge:createEntityTarget(entity, opts, dist)
|
return exports.jim_bridge:createEntityTarget(entity, opts, dist)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
boxTarget = function(data, opts, dist)
|
boxTarget =
|
||||||
|
function(data, opts, dist)
|
||||||
return exports.jim_bridge:createZoneTarget(data, opts, dist)
|
return exports.jim_bridge:createZoneTarget(data, opts, dist)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
circleTarget = function(data, opts, dist)
|
circleTarget =
|
||||||
|
function(data, opts, dist)
|
||||||
return exports.jim_bridge:createZoneTarget(data, opts, dist)
|
return exports.jim_bridge:createZoneTarget(data, opts, dist)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
modelTarget = function(models, opts, dist)
|
modelTarget =
|
||||||
|
function(models, opts, dist)
|
||||||
return exports.jim_bridge:createModelTarget(models, opts, dist)
|
return exports.jim_bridge:createModelTarget(models, opts, dist)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
removeTargetEntity = function(entity)
|
removeTargetEntity =
|
||||||
|
function(entity)
|
||||||
exports.jim_bridge:removeEntityTarget(entity)
|
exports.jim_bridge:removeEntityTarget(entity)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
removeTargetZone = function(target)
|
removeTargetZone =
|
||||||
|
function(target)
|
||||||
exports.jim_bridge:removeZoneTarget(target)
|
exports.jim_bridge:removeZoneTarget(target)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
removeTargetModel = function(model)
|
removeTargetModel =
|
||||||
|
function(model)
|
||||||
exports.jim_bridge:removeZoneTarget(model)
|
exports.jim_bridge:removeZoneTarget(model)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@@ -243,7 +261,8 @@ function createEntityTarget(entity, opts, dist)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check for target script and use that
|
-- 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
|
if isStarted(script.targetName) then
|
||||||
debugPrint("^6Bridge^7: ^2Creating new ^3Entity ^2target with ^6"..script.targetName.." ^2for entity ^7"..entity)
|
debugPrint("^6Bridge^7: ^2Creating new ^3Entity ^2target with ^6"..script.targetName.." ^2for entity ^7"..entity)
|
||||||
return script.entityTarget(entity, opts, dist)
|
return script.entityTarget(entity, opts, dist)
|
||||||
@@ -314,7 +333,8 @@ function createBoxTarget(data, opts, dist)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check for target script and use that
|
-- 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
|
if isStarted(script.targetName) then
|
||||||
debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6"..script.targetName.." ^7"..data[1])
|
debugPrint("^6Bridge^7: ^2Creating new ^3Box ^2target with ^6"..script.targetName.." ^7"..data[1])
|
||||||
local target = script.boxTarget(data, opts, dist)
|
local target = script.boxTarget(data, opts, dist)
|
||||||
@@ -370,7 +390,8 @@ function createCircleTarget(data, opts, dist)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check for target script and use that
|
-- 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
|
if isStarted(script.targetName) then
|
||||||
debugPrint("^6Bridge^7: ^2Creating new ^3Sphere ^2target with ^6"..script.targetName.." ^7"..data[1])
|
debugPrint("^6Bridge^7: ^2Creating new ^3Sphere ^2target with ^6"..script.targetName.." ^7"..data[1])
|
||||||
local target = script.circleTarget(data, opts, dist)
|
local target = script.circleTarget(data, opts, dist)
|
||||||
@@ -416,7 +437,8 @@ function createModelTarget(models, opts, dist)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check for target script and use that
|
-- 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
|
if isStarted(script.targetName) then
|
||||||
debugPrint("^6Bridge^7: ^2Creating new ^3Model ^2target with ^6"..script.targetName.."^7")
|
debugPrint("^6Bridge^7: ^2Creating new ^3Model ^2target with ^6"..script.targetName.."^7")
|
||||||
local target = script.modelTarget(models, opts, dist)
|
local target = script.modelTarget(models, opts, dist)
|
||||||
@@ -446,7 +468,8 @@ function removeEntityTarget(entity)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check for target script and use that
|
-- 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
|
if isStarted(script.targetName) then
|
||||||
script.removeTargetEntity(entity)
|
script.removeTargetEntity(entity)
|
||||||
break
|
break
|
||||||
@@ -471,7 +494,8 @@ function removeZoneTarget(target)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check for target script and use that
|
-- 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
|
if isStarted(script.targetName) then
|
||||||
script.removeTargetZone(target)
|
script.removeTargetZone(target)
|
||||||
break
|
break
|
||||||
@@ -494,7 +518,8 @@ function removeModelTarget(model)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check for target script and use that
|
-- 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
|
if isStarted(script.targetName) then
|
||||||
script.removeTargetModel(model)
|
script.removeTargetModel(model)
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user