15 files changed
+79
-15
No files matched your search
+1
-1
@@ -5,7 +5,7 @@ use_experimental_fxv2_oal 'yes'
|
||||
author 'The Order of the Sacred Framework'
|
||||
name 'community_bridge'
|
||||
description 'A Universal Bridge for Our Community, created by a group of contributors with a shared vision to enhance both user and developer experiences. This bridge connects various frameworks, inventories, target systems, notification systems, and more, fostering compatibility and seamless integration.'
|
||||
version '0.13.2'
|
||||
version '0.13.3'
|
||||
|
||||
shared_scripts {
|
||||
'@ox_lib/init.lua',
|
||||
|
||||
@@ -114,7 +114,7 @@ function Marker.Run()
|
||||
)
|
||||
::continue::
|
||||
end
|
||||
Wait(3)
|
||||
Wait(2)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -78,6 +78,25 @@ Framework.GetPlayer = function(src)
|
||||
return xPlayer
|
||||
end
|
||||
|
||||
---@description Returns the player data of the specified identifier in the framework defualt format.
|
||||
---@param citizenid string
|
||||
---@return table | nil
|
||||
Framework.GetPlayerByIdentifier = function(citizenid)
|
||||
local player = ESX.GetPlayerFromIdentifier(citizenid)
|
||||
if not player then return end
|
||||
return player
|
||||
end
|
||||
|
||||
---@description This will return the player source of the specified citizen ID.
|
||||
---@param citizenid string
|
||||
---@return number | nil
|
||||
Framework.GetPlayerSource = function(citizenid)
|
||||
local player = Framework.GetPlayerByIdentifier(citizenid)
|
||||
if not player then return end
|
||||
return player.source
|
||||
end
|
||||
|
||||
|
||||
--- @description Returns the citizen ID of the player.
|
||||
--- @param src number
|
||||
--- @return string | nil returns the citizen ID of the player if it exists
|
||||
|
||||
@@ -26,7 +26,10 @@ end
|
||||
---@return boolean
|
||||
Framework.GetIsFrameworkAdmin = function(src)
|
||||
if not src then return false end
|
||||
return QBCore.Functions.HasPermission(src, 'admin')
|
||||
local isAdmin = QBCore.Functions.HasPermission(src, 'admin')
|
||||
local isGod = QBCore.Functions.HasPermission(src, 'god')
|
||||
local isAceAllowed = IsPlayerAceAllowed(src, 'command')
|
||||
return isAdmin or isGod or isAceAllowed
|
||||
end
|
||||
|
||||
---@description This will return the citizen ID of the player.
|
||||
@@ -48,6 +51,25 @@ Framework.GetPlayer = function(src)
|
||||
return player
|
||||
end
|
||||
|
||||
|
||||
---@description Returns the player data of the specified identifier in the framework defualt format.
|
||||
---@param citizenid string
|
||||
---@return table | nil
|
||||
Framework.GetPlayerByIdentifier = function(citizenid)
|
||||
local player = QBCore.Functions.GetPlayerByCitizenId(citizenid)
|
||||
if not player then return end
|
||||
return player
|
||||
end
|
||||
|
||||
---@description This will return the player source of the specified citizen ID.
|
||||
---@param citizenid string
|
||||
---@return number | nil
|
||||
Framework.GetPlayerSource = function(citizenid)
|
||||
local player = Framework.GetPlayerByIdentifier(citizenid)
|
||||
if not player then return end
|
||||
return player.PlayerData.source
|
||||
end
|
||||
|
||||
---@description This will return the jobs registered in the framework in a table.
|
||||
---@return table {name = jobName, label = jobLabel, grade = {name = gradeName, level = gradeLevel}}
|
||||
Framework.GetFrameworkJobs = function()
|
||||
|
||||
@@ -44,6 +44,25 @@ Framework.GetPlayer = function(src)
|
||||
return player
|
||||
end
|
||||
|
||||
|
||||
---@description Returns the player data of the specified identifier in the framework defualt format.
|
||||
---@param citizenid string
|
||||
---@return table | nil
|
||||
Framework.GetPlayerByIdentifier = function(citizenid)
|
||||
local player = QBox:GetPlayerByCitizenId(citizenid)
|
||||
if not player then return end
|
||||
return player
|
||||
end
|
||||
|
||||
---@description This will return the player source of the specified citizen ID.
|
||||
---@param citizenid string
|
||||
---@return number | nil
|
||||
Framework.GetPlayerSource = function(citizenid)
|
||||
local player = Framework.GetPlayerByIdentifier(citizenid)
|
||||
if not player then return end
|
||||
return player.PlayerData.source
|
||||
end
|
||||
|
||||
---@description Returns a table of the jobs in the framework.
|
||||
---@return table
|
||||
Framework.GetFrameworkJobs = function()
|
||||
|
||||
@@ -87,10 +87,10 @@ function OxToQBInput(data)
|
||||
input.options = {}
|
||||
if v.options then -- Checks if options varible is valid so checkboxes are bundled together (not used by ox for each checkpoint)
|
||||
for k, j in pairs(v.options) do
|
||||
table.insert(input.options, {value = j.value, text = j.label, checked = j.checked}) -- added checked option (used to show box as ticked or not)
|
||||
table.insert(input.options, {value = #returnData + #input.options + 1, text = j.label, checked = j.checked}) -- added checked option (used to show box as ticked or not)
|
||||
end
|
||||
else -- If options is not valid or people pass a single checkbox then it will be a single checkbox per entry
|
||||
table.insert(input.options, {value = v.value, text = v.label, checked = v.checked}) -- Kept value just incase it's used for other stuffs
|
||||
table.insert(input.options, {value = #returnData + 1, text = v.label, checked = v.checked}) -- Kept value just incase it's used for other stuffs
|
||||
end
|
||||
end
|
||||
table.insert(returnData, input)
|
||||
|
||||
@@ -33,6 +33,7 @@ function Input.Open(title, data, isQBFormat, submitText)
|
||||
|
||||
for i, v in pairs(returnData) do
|
||||
local index = i and tonumber(i)
|
||||
v = tostring(v) == "true" and true or (tostring(v) == "false" and false or v)
|
||||
if not index then
|
||||
table.insert(convertedData, v)
|
||||
else
|
||||
|
||||
@@ -235,7 +235,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
trunk_oldplate = 'trunk-' .. oldplate
|
||||
}
|
||||
MySQL.transaction.await(queries, values)
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
if GetResourceState('jg-mechanic') == 'missing' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
}
|
||||
local values = { newplate = newplate, oldplate = oldplate }
|
||||
MySQL.transaction.await(queries, values)
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
if GetResourceState('jg-mechanic') == 'missing' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
}
|
||||
local values = { newplate = newplate, oldplate = oldplate }
|
||||
MySQL.transaction.await(queries, values)
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
if GetResourceState('jg-mechanic') == 'missing' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ end
|
||||
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
ox_inventory:UpdateVehicle(oldplate, newplate)
|
||||
-- ox standard doesnt return anything so probably shouldnt return so everything else has the same standard. Yeaaaa probably should change this.
|
||||
if GetResourceState('jg-mechanic') ~= 'missing' then return true end
|
||||
if GetResourceState('jg-mechanic') == 'missing' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
local values = { newplate = newplate, oldplate = oldplate }
|
||||
MySQL.transaction.await(queries, values)
|
||||
-- ox standard doesnt return anything so probably shouldnt return so everything else has the same standard. Yeaaaa probably should change this.
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
if GetResourceState('jg-mechanic') == 'missing' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
|
||||
@@ -12,7 +12,10 @@ Inventory.Version = nil
|
||||
Inventory.ShopData = {}
|
||||
|
||||
local function getInventoryNewVersion()
|
||||
if tonumber(string.sub(GetResourceMetadata("qb-inventory", "version", 0), 1, 1)) >= 2 then Inventory.Version = true end
|
||||
if tonumber(string.sub(GetResourceMetadata("qb-inventory", "version", 0), 1, 1)) >= 2 then
|
||||
Inventory.Version = true
|
||||
return
|
||||
end
|
||||
Inventory.Version = false
|
||||
end
|
||||
|
||||
@@ -206,7 +209,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
qbInventory:SetInventory('glovebox-'..newplate, storedGloveBox.items, "Community Bridge Moving Items In GloveBox")
|
||||
qbInventory:CreateInventory('trunk-'..newplate, {label = 'trunk-'..newplate, slots = storedTrunk.slots, maxweight = storedTrunk.maxweight})
|
||||
qbInventory:SetInventory('trunk-'..newplate, storedTrunk.items, "Community Bridge Moving Items In Trunk")
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
if GetResourceState('jg-mechanic') == 'missing' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
@@ -269,7 +272,7 @@ Inventory.Old.UpdatePlate = function(oldplate, newplate)
|
||||
}
|
||||
local values = { newplate = newplate, oldplate = oldplate }
|
||||
MySQL.transaction.await(queries, values)
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
if GetResourceState('jg-mechanic') == 'missing' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
}
|
||||
local values = { newplate = newplate, oldplate = oldplate }
|
||||
MySQL.transaction.await(queries, values)
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
if GetResourceState('jg-mechanic') == 'missing' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
local values = { newplate = newplate, oldplate = oldplate }
|
||||
MySQL.transaction.await(queries, values)
|
||||
tgiann:UpdateVehicle(oldplate, newplate)
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
if GetResourceState('jg-mechanic') == 'missing' then return true end
|
||||
return true, exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user