diff --git a/fxmanifest.lua b/fxmanifest.lua index df85653..01eb242 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -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', diff --git a/lib/markers/client/markers.lua b/lib/markers/client/markers.lua index a747e20..9d0d3c0 100644 --- a/lib/markers/client/markers.lua +++ b/lib/markers/client/markers.lua @@ -114,7 +114,7 @@ function Marker.Run() ) ::continue:: end - Wait(3) + Wait(2) end end) end diff --git a/modules/framework/es_extended/server.lua b/modules/framework/es_extended/server.lua index 4d37030..41b37b8 100644 --- a/modules/framework/es_extended/server.lua +++ b/modules/framework/es_extended/server.lua @@ -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 diff --git a/modules/framework/qb-core/server.lua b/modules/framework/qb-core/server.lua index 0908af9..d244b0b 100644 --- a/modules/framework/qb-core/server.lua +++ b/modules/framework/qb-core/server.lua @@ -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() diff --git a/modules/framework/qbx_core/server.lua b/modules/framework/qbx_core/server.lua index 98b086c..f8431aa 100644 --- a/modules/framework/qbx_core/server.lua +++ b/modules/framework/qbx_core/server.lua @@ -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() diff --git a/modules/input/_default/client.lua b/modules/input/_default/client.lua index d3e6a8f..371db88 100644 --- a/modules/input/_default/client.lua +++ b/modules/input/_default/client.lua @@ -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) diff --git a/modules/input/qb-input/client.lua b/modules/input/qb-input/client.lua index 3742d57..d9dcd5e 100644 --- a/modules/input/qb-input/client.lua +++ b/modules/input/qb-input/client.lua @@ -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 diff --git a/modules/inventory/core_inventory/server.lua b/modules/inventory/core_inventory/server.lua index c6407e6..64e473f 100644 --- a/modules/inventory/core_inventory/server.lua +++ b/modules/inventory/core_inventory/server.lua @@ -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 diff --git a/modules/inventory/jpr-inventory/server.lua b/modules/inventory/jpr-inventory/server.lua index d8ce57d..bdd78f8 100644 --- a/modules/inventory/jpr-inventory/server.lua +++ b/modules/inventory/jpr-inventory/server.lua @@ -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 diff --git a/modules/inventory/origen_inventory/server.lua b/modules/inventory/origen_inventory/server.lua index 9a634cf..4e06f2f 100644 --- a/modules/inventory/origen_inventory/server.lua +++ b/modules/inventory/origen_inventory/server.lua @@ -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 diff --git a/modules/inventory/ox_inventory/server.lua b/modules/inventory/ox_inventory/server.lua index 7e022ac..dda2f60 100644 --- a/modules/inventory/ox_inventory/server.lua +++ b/modules/inventory/ox_inventory/server.lua @@ -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 diff --git a/modules/inventory/ps-inventory/server.lua b/modules/inventory/ps-inventory/server.lua index 335bc97..9bf1390 100644 --- a/modules/inventory/ps-inventory/server.lua +++ b/modules/inventory/ps-inventory/server.lua @@ -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 diff --git a/modules/inventory/qb-inventory/server.lua b/modules/inventory/qb-inventory/server.lua index 8086949..1f626af 100644 --- a/modules/inventory/qb-inventory/server.lua +++ b/modules/inventory/qb-inventory/server.lua @@ -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 diff --git a/modules/inventory/qs-inventory/server.lua b/modules/inventory/qs-inventory/server.lua index cb7cc4d..4c550cf 100644 --- a/modules/inventory/qs-inventory/server.lua +++ b/modules/inventory/qs-inventory/server.lua @@ -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 diff --git a/modules/inventory/tgiann-inventory/server.lua b/modules/inventory/tgiann-inventory/server.lua index 2d7b629..c77e0e1 100644 --- a/modules/inventory/tgiann-inventory/server.lua +++ b/modules/inventory/tgiann-inventory/server.lua @@ -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