From d4c4999bde00213c95bd99d405b014b41bb5a80f Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Wed, 23 Jul 2025 22:16:19 -0400 Subject: [PATCH 01/54] fix for origen_police --- modules/dispatch/origen_police/client/client.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/dispatch/origen_police/client/client.lua b/modules/dispatch/origen_police/client/client.lua index 9984438..552d869 100644 --- a/modules/dispatch/origen_police/client/client.lua +++ b/modules/dispatch/origen_police/client/client.lua @@ -17,7 +17,7 @@ Dispatch.SendAlert = function(data) model = data.vehicle and (GetDisplayNameFromVehicleModel(GetEntityModel(data.vehicle))) or nil, color = color, plate = data.vehicle and GetVehicleNumberPlateText(data.vehicle) or nil, - speed = data.vehicle and (GetEntitySpeed(veh) * 3.6)..' kmh' or nil + speed = data.vehicle and (GetEntitySpeed(data.vehicle) * 3.6)..' kmh' or nil } } From 07b76868f2df7a126c4d46777685e8d8ac26b31e Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Thu, 24 Jul 2025 00:10:47 -0400 Subject: [PATCH 02/54] notify tweak --- modules/notify/brutal_notify/client.lua | 2 +- modules/notify/fl-notify/client.lua | 2 ++ modules/notify/lation_ui/client.lua | 2 +- modules/notify/okokNotify/client.lua | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/notify/brutal_notify/client.lua b/modules/notify/brutal_notify/client.lua index 7eb9e87..d40104f 100644 --- a/modules/notify/brutal_notify/client.lua +++ b/modules/notify/brutal_notify/client.lua @@ -16,7 +16,7 @@ end ---@return nil Notify.SendNotify = function(message, _type, time) time = time or 3000 - return exports['brutal_notify']:SendAlert('Notification', message, time, _type, false) + return exports['brutal_notify']:SendAlert('Notification', message, time, _type or "success", false) end return Notify \ No newline at end of file diff --git a/modules/notify/fl-notify/client.lua b/modules/notify/fl-notify/client.lua index c8d2a87..68d9cd3 100644 --- a/modules/notify/fl-notify/client.lua +++ b/modules/notify/fl-notify/client.lua @@ -22,6 +22,8 @@ Notify.SendNotify = function(message, _type, time) _type = tostring(2) elseif _type == "warning" or _type == "warn" then _type = tostring(3) + else + _type = tostring(2) -- Default to 2 if type is not recognized end return exports['FL-Notify']:Notify("Notification", "", message, 5000, tonumber(_type), 0) end diff --git a/modules/notify/lation_ui/client.lua b/modules/notify/lation_ui/client.lua index 02ae6dc..186ec79 100644 --- a/modules/notify/lation_ui/client.lua +++ b/modules/notify/lation_ui/client.lua @@ -16,7 +16,7 @@ end ---@return nil Notify.SendNotify = function(message, _type, time) time = time or 3000 - return exports.lation_ui:notify({ message = message, type = _type, duration = time, position = 'top-right' }) + return exports.lation_ui:notify({ message = message, type = _type or "success", duration = time, position = 'top-right' }) end return Notify \ No newline at end of file diff --git a/modules/notify/okokNotify/client.lua b/modules/notify/okokNotify/client.lua index 1a158ea..4c7d2fa 100644 --- a/modules/notify/okokNotify/client.lua +++ b/modules/notify/okokNotify/client.lua @@ -15,7 +15,7 @@ end ---@return nil Notify.SendNotify = function(message, _type, time) time = time or 3000 - return exports['okokNotify']:Alert('Notification', message, time, _type, false) + return exports['okokNotify']:Alert('Notification', message, time, _type or "Success", false) end return Notify \ No newline at end of file From 2ad1f4669c30e482ff7e304464607852c09e1b08 Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Thu, 24 Jul 2025 05:03:07 -0500 Subject: [PATCH 03/54] small update target got a print if onSelect or action are nil also added groups in fixoptions for sleepless client entities using return for loadmodel --- lib/entities/client/client_entity.lua | 6 +++--- lib/utility/client/utility.lua | 5 ++--- modules/target/ox_target/client.lua | 16 ++++++++++------ modules/target/sleepless_interact/client.lua | 1 + 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/entities/client/client_entity.lua b/lib/entities/client/client_entity.lua index c6e5de1..55de714 100644 --- a/lib/entities/client/client_entity.lua +++ b/lib/entities/client/client_entity.lua @@ -12,15 +12,15 @@ local function SpawnEntity(entityData) -- for k, v in pairs(entityData.args) do -- print(string.format("SpawnEntity %s: %s", k, v)) -- end - local model = entityData.model and type(entityData.model) == 'string' and GetHashKey(entityData.model) or entityData.model - if model and not Utility.LoadModel(model) then + local loaded, model = Utility.GetModel(entityData.model) + if not loaded then print(string.format("[ClientEntity] Failed to load model %s for entity %s", entityData.model, entityData.id)) return end local entity = nil local coords = entityData.coords - local rotation = entityData.rotation or vector3(0.0, 0.0, 0.0) -- Default rotation if not provided + local rotation = entityData.rotation or vector3(0.0, 0.0, entityData.heading or 0.0) -- Default rotation if not provided if entityData.entityType == 'object' then entity = CreateObject(model, coords.x, coords.y, coords.z, false, false, false) diff --git a/lib/utility/client/utility.lua b/lib/utility/client/utility.lua index 6e5a3f8..5b41346 100644 --- a/lib/utility/client/utility.lua +++ b/lib/utility/client/utility.lua @@ -226,10 +226,9 @@ end ---Load a model into memory ---@param model string|number ----@return boolean +---@return boolean, number function Utility.LoadModel(model) - local loaded = ensureModelLoaded(model) - return loaded + return ensureModelLoaded(model) end ---Request an animation dictionary diff --git a/modules/target/ox_target/client.lua b/modules/target/ox_target/client.lua index 8fedecd..ad0367a 100644 --- a/modules/target/ox_target/client.lua +++ b/modules/target/ox_target/client.lua @@ -22,14 +22,18 @@ Target = Target or {} Target.FixOptions = function(options) for k, v in pairs(options) do local action = v.onSelect or v.action - local select = function(entityOrData) - if type(entityOrData) == 'table' then - return action(entityOrData.entity) + if not action then + print(("Target option (%s) %s is missing an 'onSelect' or 'action' function."):format(k, v.label)) + else + local select = function(entityOrData) + if type(entityOrData) == 'table' then + return action(entityOrData.entity) + end + return action(entityOrData) end - return action(entityOrData) + options[k].onSelect = select + options[k].groups = v.job or v.groups end - options[k].onSelect = select - options[k].groups = v.job or v.groups end return options end diff --git a/modules/target/sleepless_interact/client.lua b/modules/target/sleepless_interact/client.lua index de80861..b7c6882 100644 --- a/modules/target/sleepless_interact/client.lua +++ b/modules/target/sleepless_interact/client.lua @@ -28,6 +28,7 @@ Target.FixOptions = function(options) return action(entityOrData) end options[k].onSelect = select + options[k].groups = v.job or v.groups end return options end From ca11f2954efe7be3d1d3099e45f7344ec67525de Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Thu, 24 Jul 2025 20:02:33 -0400 Subject: [PATCH 04/54] Disable debug commands. All the this below should go in unit tests if we are to continue using them. None of these were harmful but its a good thing to watch out for going forward. --- modules/clothing/fivem-appearance/server.lua | 72 ++++---- .../clothing/illenium-appearance/server.lua | 170 +++++++++--------- modules/clothing/qb-clothing/server.lua | 71 ++++---- 3 files changed, 155 insertions(+), 158 deletions(-) diff --git a/modules/clothing/fivem-appearance/server.lua b/modules/clothing/fivem-appearance/server.lua index 8b321f7..0520880 100644 --- a/modules/clothing/fivem-appearance/server.lua +++ b/modules/clothing/fivem-appearance/server.lua @@ -156,49 +156,47 @@ Callback.Register('community_bridge:cb:GetAppearance', function(source) return Clothing.GetAppearance(src) end) - -RegisterCommand('clothing:debug', function(source, args, rawCommand) - local src = source - Clothing.SetAppearance(src, { - components = { - { component_id = 1, drawable = math.random(0, 50), texture = 0 }, - { component_id = 2, drawable = math.random(0, 50), texture = 0 }, - { component_id = 3, drawable = math.random(0, 50), texture = 0 }, - { component_id = 4, drawable = math.random(0, 50), texture = 0 }, - { component_id = 5, drawable = math.random(0, 50), texture = 0 }, - { component_id = 6, drawable = math.random(0, 50), texture = 0 }, - { component_id = 7, drawable = math.random(0, 50), texture = 0 }, - { component_id = 8, drawable = math.random(0, 50), texture = 0 }, - }, - props = { - { prop_id = 3, drawable = 0, texture = 0 }, - { prop_id = 1, drawable = 0, texture = 0 }, - { prop_id = 2, drawable = 0, texture = 0 }, - } - }, false, true) -end, false) +-- All the this below should go in unit tests if we are to continue using them. +-- RegisterCommand('clothing:debug', function(source, args, rawCommand) +-- local src = source +-- Clothing.SetAppearance(src, { +-- components = { +-- { component_id = 1, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 2, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 3, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 4, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 5, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 6, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 7, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 8, drawable = math.random(0, 50), texture = 0 }, +-- }, +-- props = { +-- { prop_id = 3, drawable = 0, texture = 0 }, +-- { prop_id = 1, drawable = 0, texture = 0 }, +-- { prop_id = 2, drawable = 0, texture = 0 }, +-- } +-- }, false, true) +-- end, false) -RegisterCommand('clothing:revert', function(source, args, rawCommand) - local src = source - Clothing.Revert(src) -end, false) +-- RegisterCommand('clothing:revert', function(source, args, rawCommand) +-- local src = source +-- Clothing.Revert(src) +-- end, false) -RegisterCommand('clothing:current', function(source, args, rawCommand) - local src = source - local currentClothing = Clothing.GetAppearance(src) - if not currentClothing then return end - print(json.encode(currentClothing, { indent = true })) -end, false) +-- RegisterCommand('clothing:current', function(source, args, rawCommand) +-- local src = source +-- local currentClothing = Clothing.GetAppearance(src) +-- if not currentClothing then return end +-- print(json.encode(currentClothing, { indent = true })) +-- end, false) -RegisterCommand('clothing:openmenu', function(source, args, rawCommand) - local src = source - Clothing.OpenMenu(src) -end, false) +-- RegisterCommand('clothing:openmenu', function(source, args, rawCommand) +-- local src = source +-- Clothing.OpenMenu(src) +-- end, false) - --- This should be moved into unit tests -- RegisterCommand('clothing:crowley', function(source, args, rawCommand) -- local src = source -- Clothing.SetAppearance(src, { diff --git a/modules/clothing/illenium-appearance/server.lua b/modules/clothing/illenium-appearance/server.lua index 7f0b5a6..c65879d 100644 --- a/modules/clothing/illenium-appearance/server.lua +++ b/modules/clothing/illenium-appearance/server.lua @@ -158,96 +158,96 @@ Callback.Register('community_bridge:cb:GetAppearance', function(source) return Clothing.GetAppearance(src) end) --- The below Should go to unit test -RegisterCommand('clothing:debug', function(source, args, rawCommand) - local src = source - Clothing.SetAppearance(src, { - components = { - { component_id = 0, drawable = math.random(0, 50), texture = 0 }, - { component_id = 1, drawable = math.random(0, 50), texture = 0 }, - { component_id = 2, drawable = math.random(0, 50), texture = 0 }, - { component_id = 3, drawable = math.random(0, 50), texture = 0 }, - { component_id = 4, drawable = math.random(0, 50), texture = 0 }, - { component_id = 5, drawable = math.random(0, 50), texture = 0 }, - { component_id = 6, drawable = math.random(0, 50), texture = 0 }, - { component_id = 7, drawable = math.random(0, 50), texture = 0 }, - { component_id = 8, drawable = math.random(0, 50), texture = 0 }, - { component_id = 9, drawable = math.random(0, 50), texture = 0 }, - { component_id = 10, drawable = math.random(0, 50), texture = 0 }, - { component_id = 11, drawable = math.random(0, 50), texture = 0 }, - }, - props = { - { prop_id = 0, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 1, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 2, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 3, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 4, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 5, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 6, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 7, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 8, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 9, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 10, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 11, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 12, drawable = math.random(0, 50), texture = 0 }, - { prop_id = 13, drawable = math.random(0, 50), texture = 0 }, - } - }, false, true) -end, false) +-- All the this below should go in unit tests if we are to continue using them. +-- RegisterCommand('clothing:debug', function(source, args, rawCommand) +-- local src = source +-- Clothing.SetAppearance(src, { +-- components = { +-- { component_id = 0, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 1, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 2, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 3, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 4, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 5, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 6, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 7, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 8, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 9, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 10, drawable = math.random(0, 50), texture = 0 }, +-- { component_id = 11, drawable = math.random(0, 50), texture = 0 }, +-- }, +-- props = { +-- { prop_id = 0, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 1, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 2, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 3, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 4, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 5, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 6, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 7, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 8, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 9, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 10, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 11, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 12, drawable = math.random(0, 50), texture = 0 }, +-- { prop_id = 13, drawable = math.random(0, 50), texture = 0 }, +-- } +-- }, false, true) +-- end, false) -RegisterCommand('clothing:revert', function(source, args, rawCommand) - local src = source - Clothing.Revert(src) -end, false) +-- RegisterCommand('clothing:revert', function(source, args, rawCommand) +-- local src = source +-- Clothing.Revert(src) +-- end, false) -RegisterCommand('clothing:current', function(source, args, rawCommand) - local src = source - local currentClothing = Clothing.GetAppearance(src) - if not currentClothing then return end - print(json.encode(currentClothing, { indent = true })) -end, false) +-- RegisterCommand('clothing:current', function(source, args, rawCommand) +-- local src = source +-- local currentClothing = Clothing.GetAppearance(src) +-- if not currentClothing then return end +-- print(json.encode(currentClothing, { indent = true })) +-- end, false) -RegisterCommand('clothing:openmenu', function(source, args, rawCommand) - local src = source - Clothing.OpenMenu(src) -end, false) +-- RegisterCommand('clothing:openmenu', function(source, args, rawCommand) +-- local src = source +-- Clothing.OpenMenu(src) +-- end, false) -RegisterCommand('clothing:crowley', function(source, args, rawCommand) - local src = source - Clothing.SetAppearance(src, { - components = { - { drawable = 0, texture = 0, component_id = 0 }, - { drawable = 0, texture = 0, component_id = 1 }, - { drawable = 19, texture = 0, component_id = 2 }, - { drawable = 6, texture = 0, component_id = 3 }, - { drawable = 0, texture = 0, component_id = 4 }, - { drawable = 0, texture = 0, component_id = 5 }, - { drawable = 0, texture = 0, component_id = 6 }, - { drawable = 0, texture = 0, component_id = 7 }, - { drawable = 23, texture = 0, component_id = 8 }, - { drawable = 0, texture = 0, component_id = 9 }, - { drawable = 0, texture = 0, component_id = 10 }, - { drawable = 4, texture = 2, component_id = 11 } - }, - props = { - { drawable = 27, prop_id = 0, texture = 0 }, - { drawable = 0, prop_id = 1, texture = 0 }, - { drawable = 0, prop_id = 2, texture = 0 }, - { drawable = 0, prop_id = 3, texture = 0 }, - { drawable = 0, prop_id = 4, texture = 0 }, - { drawable = 0, prop_id = 5, texture = 0 }, - { drawable = 0, prop_id = 6, texture = 0 }, - { drawable = 0, prop_id = 7, texture = 0 }, - { drawable = 0, prop_id = 8, texture = 0 }, - { drawable = 0, prop_id = 9, texture = 0 }, - { drawable = 0, prop_id = 10, texture = 0 }, - { drawable = 0, prop_id = 11, texture = 0 }, - { drawable = 0, prop_id = 12, texture = 0 }, - { drawable = 0, prop_id = 13, texture = 0 } +-- RegisterCommand('clothing:crowley', function(source, args, rawCommand) +-- local src = source +-- Clothing.SetAppearance(src, { +-- components = { +-- { drawable = 0, texture = 0, component_id = 0 }, +-- { drawable = 0, texture = 0, component_id = 1 }, +-- { drawable = 19, texture = 0, component_id = 2 }, +-- { drawable = 6, texture = 0, component_id = 3 }, +-- { drawable = 0, texture = 0, component_id = 4 }, +-- { drawable = 0, texture = 0, component_id = 5 }, +-- { drawable = 0, texture = 0, component_id = 6 }, +-- { drawable = 0, texture = 0, component_id = 7 }, +-- { drawable = 23, texture = 0, component_id = 8 }, +-- { drawable = 0, texture = 0, component_id = 9 }, +-- { drawable = 0, texture = 0, component_id = 10 }, +-- { drawable = 4, texture = 2, component_id = 11 } +-- }, +-- props = { +-- { drawable = 27, prop_id = 0, texture = 0 }, +-- { drawable = 0, prop_id = 1, texture = 0 }, +-- { drawable = 0, prop_id = 2, texture = 0 }, +-- { drawable = 0, prop_id = 3, texture = 0 }, +-- { drawable = 0, prop_id = 4, texture = 0 }, +-- { drawable = 0, prop_id = 5, texture = 0 }, +-- { drawable = 0, prop_id = 6, texture = 0 }, +-- { drawable = 0, prop_id = 7, texture = 0 }, +-- { drawable = 0, prop_id = 8, texture = 0 }, +-- { drawable = 0, prop_id = 9, texture = 0 }, +-- { drawable = 0, prop_id = 10, texture = 0 }, +-- { drawable = 0, prop_id = 11, texture = 0 }, +-- { drawable = 0, prop_id = 12, texture = 0 }, +-- { drawable = 0, prop_id = 13, texture = 0 } - } - }, false, true) -end, false) +-- } +-- }, false, true) +-- end, false) diff --git a/modules/clothing/qb-clothing/server.lua b/modules/clothing/qb-clothing/server.lua index 7424c7a..9f3113c 100644 --- a/modules/clothing/qb-clothing/server.lua +++ b/modules/clothing/qb-clothing/server.lua @@ -166,47 +166,46 @@ Callback.Register('community_bridge:cb:GetAppearance', function(source) return Clothing.GetAppearance(src) end) ---[[ -RegisterCommand('clothing:debug', function(source, args, rawCommand) - local src = source - Clothing.SetAppearance(src, { - components ={ - {component_id = 1, drawable = math.random(0, 50), texture = 0}, - {component_id = 2, drawable = math.random(0, 50), texture = 0}, - {component_id = 3, drawable = math.random(0, 50), texture = 0}, - {component_id = 4, drawable = math.random(0, 50), texture = 0}, - {component_id = 5, drawable = math.random(0, 50), texture = 0}, - {component_id = 6, drawable = math.random(0, 50), texture = 0}, - {component_id = 7, drawable = math.random(0, 50), texture = 0}, - {component_id = 8, drawable = math.random(0, 50), texture = 0}, - }, - props = { - {prop_id = 3, drawable = 0, texture = 0}, - {prop_id = 1, drawable = 0, texture = 0}, - {prop_id = 2, drawable = 0, texture = 0}, - } - }, false, true) -end, false) +-- All the this below should go in unit tests if we are to continue using them. +-- RegisterCommand('clothing:debug', function(source, args, rawCommand) +-- local src = source +-- Clothing.SetAppearance(src, { +-- components ={ +-- {component_id = 1, drawable = math.random(0, 50), texture = 0}, +-- {component_id = 2, drawable = math.random(0, 50), texture = 0}, +-- {component_id = 3, drawable = math.random(0, 50), texture = 0}, +-- {component_id = 4, drawable = math.random(0, 50), texture = 0}, +-- {component_id = 5, drawable = math.random(0, 50), texture = 0}, +-- {component_id = 6, drawable = math.random(0, 50), texture = 0}, +-- {component_id = 7, drawable = math.random(0, 50), texture = 0}, +-- {component_id = 8, drawable = math.random(0, 50), texture = 0}, +-- }, +-- props = { +-- {prop_id = 3, drawable = 0, texture = 0}, +-- {prop_id = 1, drawable = 0, texture = 0}, +-- {prop_id = 2, drawable = 0, texture = 0}, +-- } +-- }, false, true) +-- end, false) -RegisterCommand('clothing:revert', function(source, args, rawCommand) - local src = source - Clothing.Revert(src) -end, false) +-- RegisterCommand('clothing:revert', function(source, args, rawCommand) +-- local src = source +-- Clothing.Revert(src) +-- end, false) -RegisterCommand('clothing:current', function(source, args, rawCommand) - local src = source - local currentClothing = Clothing.GetAppearance(src) - if not currentClothing then return end - print(json.encode(currentClothing, { indent = true })) -end, false) +-- RegisterCommand('clothing:current', function(source, args, rawCommand) +-- local src = source +-- local currentClothing = Clothing.GetAppearance(src) +-- if not currentClothing then return end +-- print(json.encode(currentClothing, { indent = true })) +-- end, false) -RegisterCommand('clothing:openmenu', function(source, args, rawCommand) - local src = source - Clothing.OpenMenu(src) -end, false) ---]] +-- RegisterCommand('clothing:openmenu', function(source, args, rawCommand) +-- local src = source +-- Clothing.OpenMenu(src) +-- end, false) -- RegisterCommand('clothing:crowley', function(source, args, rawCommand) -- local src = source From 0970bdd60460f492da2535ea36d2784b62c36335 Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Fri, 25 Jul 2025 02:51:14 -0500 Subject: [PATCH 05/54] migrated management to banking also fixed loadmodel typo --- init.lua | 1 + lib/entities/client/client_entity.lua | 2 +- modules/{managment => banking}/_default/server.lua | 12 ++++++------ modules/{managment => banking}/fd_banking/server.lua | 12 ++++++------ .../{managment => banking}/kartik-banking/server.lua | 12 ++++++------ .../{managment => banking}/okokBanking/server.lua | 12 ++++++------ modules/{managment => banking}/qb-banking/server.lua | 12 ++++++------ .../renewed-banking/server.lua | 12 ++++++------ .../{managment => banking}/tgg-banking/server.lua | 12 ++++++------ .../{managment => banking}/tgiann-bank/server.lua | 12 ++++++------ .../{managment => banking}/wasabi_banking/server.lua | 12 ++++++------ modules/dialogue/_default/client/client.lua | 1 - 12 files changed, 56 insertions(+), 56 deletions(-) rename modules/{managment => banking}/_default/server.lua (76%) rename modules/{managment => banking}/fd_banking/server.lua (76%) rename modules/{managment => banking}/kartik-banking/server.lua (77%) rename modules/{managment => banking}/okokBanking/server.lua (76%) rename modules/{managment => banking}/qb-banking/server.lua (76%) rename modules/{managment => banking}/renewed-banking/server.lua (77%) rename modules/{managment => banking}/tgg-banking/server.lua (76%) rename modules/{managment => banking}/tgiann-bank/server.lua (76%) rename modules/{managment => banking}/wasabi_banking/server.lua (78%) diff --git a/init.lua b/init.lua index bfd4c31..f4b020b 100644 --- a/init.lua +++ b/init.lua @@ -90,6 +90,7 @@ end) -- ▄█▀ █▄▄ █▀▄ ▀▄▀ █▄▄ █▀▄ if not IsDuplicityVersion() then goto client end Bridge.RegisterModule('Version', Version) +Bridge.RegisterModule('Banking', Banking) -- ▄▀▀ █ █ ██▀ █▄ █ ▀█▀ -- ▀▄▄ █▄▄ █ █▄▄ █ ▀█ █ diff --git a/lib/entities/client/client_entity.lua b/lib/entities/client/client_entity.lua index 55de714..1b7e706 100644 --- a/lib/entities/client/client_entity.lua +++ b/lib/entities/client/client_entity.lua @@ -12,7 +12,7 @@ local function SpawnEntity(entityData) -- for k, v in pairs(entityData.args) do -- print(string.format("SpawnEntity %s: %s", k, v)) -- end - local loaded, model = Utility.GetModel(entityData.model) + local loaded, model = Utility.LoadModel(entityData.model) if not loaded then print(string.format("[ClientEntity] Failed to load model %s for entity %s", entityData.model, entityData.id)) return diff --git a/modules/managment/_default/server.lua b/modules/banking/_default/server.lua similarity index 76% rename from modules/managment/_default/server.lua rename to modules/banking/_default/server.lua index 5ad2fd8..4f17414 100644 --- a/modules/managment/_default/server.lua +++ b/modules/banking/_default/server.lua @@ -1,16 +1,16 @@ ---@diagnostic disable: duplicate-set-field -Managment = Managment or {} +Banking = Banking or {} ---This will get the name of the Managment system being being used. ---@return string -Managment.GetManagmentName = function() +Banking.GetManagmentName = function() return 'default' end ---This will return a number ---@param account string ---@return number -Managment.GetAccountMoney = function(account) +Banking.GetAccountMoney = function(account) return 0, print("The resource you are using does not support this function.") end @@ -19,7 +19,7 @@ end ---@param amount number ---@param reason string ---@return boolean -Managment.AddAccountMoney = function(account, amount, reason) +Banking.AddAccountMoney = function(account, amount, reason) return false, print("The resource you are using does not support this function.") end @@ -28,8 +28,8 @@ end ---@param amount number ---@param reason string ---@return boolean -Managment.RemoveAccountMoney = function(account, amount, reason) +Banking.RemoveAccountMoney = function(account, amount, reason) return false, print("The resource you are using does not support this function.") end -return Managment \ No newline at end of file +return Banking \ No newline at end of file diff --git a/modules/managment/fd_banking/server.lua b/modules/banking/fd_banking/server.lua similarity index 76% rename from modules/managment/fd_banking/server.lua rename to modules/banking/fd_banking/server.lua index be4ccc5..ad74b7b 100644 --- a/modules/managment/fd_banking/server.lua +++ b/modules/banking/fd_banking/server.lua @@ -1,19 +1,19 @@ ---@diagnostic disable: duplicate-set-field if GetResourceState('fd_banking') == 'missing' then return end -Managment = Managment or {} +Banking = Banking or {} local fd_banking = exports['fd_banking'] ---This will get the name of the Managment system being being used. ---@return string -Managment.GetManagmentName = function() +Banking.GetManagmentName = function() return 'fd_banking' end ---This will return a number ---@param account string ---@return number -Managment.GetAccountMoney = function(account) +Banking.GetAccountMoney = function(account) return fd_banking:GetAccount(account) end @@ -22,7 +22,7 @@ end ---@param amount number ---@param reason string ---@return boolean -Managment.AddAccountMoney = function(account, amount, reason) +Banking.AddAccountMoney = function(account, amount, reason) return fd_banking:AddMoney(account, amount, reason) end @@ -31,8 +31,8 @@ end ---@param amount number ---@param reason string ---@return boolean -Managment.RemoveAccountMoney = function(account, amount, reason) +Banking.RemoveAccountMoney = function(account, amount, reason) return fd_banking:RemoveMoney(account, amount, reason) end -return Managment \ No newline at end of file +return Banking \ No newline at end of file diff --git a/modules/managment/kartik-banking/server.lua b/modules/banking/kartik-banking/server.lua similarity index 77% rename from modules/managment/kartik-banking/server.lua rename to modules/banking/kartik-banking/server.lua index 5d7f53a..078f7d1 100644 --- a/modules/managment/kartik-banking/server.lua +++ b/modules/banking/kartik-banking/server.lua @@ -1,19 +1,19 @@ ---@diagnostic disable: duplicate-set-field if GetResourceState('kartik-banking') == 'missing' then return end -Managment = Managment or {} +Banking = Banking or {} local kartik = exports['kartik-banking'] ---This will get the name of the Managment system being being used. ---@return string -Managment.GetManagmentName = function() +Banking.GetManagmentName = function() return 'kartik-banking' end ---This will return a number ---@param account string ---@return number -Managment.GetAccountMoney = function(account) +Banking.GetAccountMoney = function(account) local balance = kartik:GetAccountMoney(account) return balance or 0 end @@ -23,7 +23,7 @@ end ---@param amount number ---@param reason string ---@return boolean -Managment.AddAccountMoney = function(account, amount, reason) +Banking.AddAccountMoney = function(account, amount, reason) return kartik:AddAccountMoney(account, amount, reason) end @@ -32,8 +32,8 @@ end ---@param amount number ---@param reason string ---@return boolean -Managment.RemoveAccountMoney = function(account, amount, reason) +Banking.RemoveAccountMoney = function(account, amount, reason) return kartik:RemoveAccountMoney(account, amount, reason) end -return Managment +return Banking diff --git a/modules/managment/okokBanking/server.lua b/modules/banking/okokBanking/server.lua similarity index 76% rename from modules/managment/okokBanking/server.lua rename to modules/banking/okokBanking/server.lua index 7870503..33bf69d 100644 --- a/modules/managment/okokBanking/server.lua +++ b/modules/banking/okokBanking/server.lua @@ -1,19 +1,19 @@ ---@diagnostic disable: duplicate-set-field if GetResourceState('okokBanking') == 'missing' then return end -Managment = Managment or {} +Banking = Banking or {} local okokBanking = exports['okokBanking'] ---This will get the name of the Managment system being being used. ---@return string -Managment.GetManagmentName = function() +Banking.GetManagmentName = function() return 'okokBanking' end ---This will return a number ---@param account string ---@return number -Managment.GetAccountMoney = function(account) +Banking.GetAccountMoney = function(account) return okokBanking:GetAccount(account) end @@ -22,7 +22,7 @@ end ---@param amount number ---@param _ string ---@return boolean -Managment.AddAccountMoney = function(account, amount, _) +Banking.AddAccountMoney = function(account, amount, _) return okokBanking:AddMoney(account, amount) end @@ -31,8 +31,8 @@ end ---@param amount number ---@param _ string ---@return boolean -Managment.RemoveAccountMoney = function(account, amount, _) +Banking.RemoveAccountMoney = function(account, amount, _) return okokBanking:RemoveMoney(account, amount) end -return Managment \ No newline at end of file +return Banking \ No newline at end of file diff --git a/modules/managment/qb-banking/server.lua b/modules/banking/qb-banking/server.lua similarity index 76% rename from modules/managment/qb-banking/server.lua rename to modules/banking/qb-banking/server.lua index cc7530e..e275daa 100644 --- a/modules/managment/qb-banking/server.lua +++ b/modules/banking/qb-banking/server.lua @@ -1,19 +1,19 @@ ---@diagnostic disable: duplicate-set-field if GetResourceState('qb-banking') == 'missing' then return end -Managment = Managment or {} +Banking = Banking or {} local qbBanking = exports['qb-banking'] ---This will get the name of the Managment system being being used. ---@return string -Managment.GetManagmentName = function() +Banking.GetManagmentName = function() return 'qb-banking' end ---This will return a number ---@param account string ---@return number -Managment.GetAccountMoney = function(account) +Banking.GetAccountMoney = function(account) return qbBanking:GetAccountBalance(account) end @@ -22,7 +22,7 @@ end ---@param amount number ---@param reason string ---@return boolean -Managment.AddAccountMoney = function(account, amount, reason) +Banking.AddAccountMoney = function(account, amount, reason) return qbBanking:AddMoney(account, amount, reason) end @@ -31,8 +31,8 @@ end ---@param amount number ---@param reason string ---@return boolean -Managment.RemoveAccountMoney = function(account, amount, reason) +Banking.RemoveAccountMoney = function(account, amount, reason) return qbBanking:RemoveMoney(account, amount, reason) end -return Managment \ No newline at end of file +return Banking \ No newline at end of file diff --git a/modules/managment/renewed-banking/server.lua b/modules/banking/renewed-banking/server.lua similarity index 77% rename from modules/managment/renewed-banking/server.lua rename to modules/banking/renewed-banking/server.lua index 677eee0..4ae9c21 100644 --- a/modules/managment/renewed-banking/server.lua +++ b/modules/banking/renewed-banking/server.lua @@ -1,19 +1,19 @@ ---@diagnostic disable: duplicate-set-field if GetResourceState('Renewed-Banking') == 'missing' then return end -Managment = Managment or {} +Banking = Banking or {} local renewed = exports['Renewed-Banking'] ---This will get the name of the Managment system being being used. ---@return string -Managment.GetManagmentName = function() +Banking.GetManagmentName = function() return 'Renewed-Banking' end ---This will return a number ---@param account string ---@return number -Managment.GetAccountMoney = function(account) +Banking.GetAccountMoney = function(account) return renewed:getAccountMoney(account) end @@ -22,7 +22,7 @@ end ---@param amount number ---@param _ string ---@return boolean -Managment.AddAccountMoney = function(account, amount, _) +Banking.AddAccountMoney = function(account, amount, _) return renewed:addAccountMoney(account, amount) end @@ -31,8 +31,8 @@ end ---@param amount number ---@param _ string ---@return boolean -Managment.RemoveAccountMoney = function(account, amount, _) +Banking.RemoveAccountMoney = function(account, amount, _) return renewed:removeAccountMoney(account, amount) end -return Managment \ No newline at end of file +return Banking \ No newline at end of file diff --git a/modules/managment/tgg-banking/server.lua b/modules/banking/tgg-banking/server.lua similarity index 76% rename from modules/managment/tgg-banking/server.lua rename to modules/banking/tgg-banking/server.lua index 30a137c..fc276e7 100644 --- a/modules/managment/tgg-banking/server.lua +++ b/modules/banking/tgg-banking/server.lua @@ -1,19 +1,19 @@ ---@diagnostic disable: duplicate-set-field if GetResourceState('tgg-banking') == 'missing' then return end -Managment = Managment or {} +Banking = Banking or {} local tgg = exports['tgg-banking'] ---This will get the name of the Managment system being being used. ---@return string -Managment.GetManagmentName = function() +Banking.GetManagmentName = function() return 'tgg-banking' end ---This will return a number ---@param account string ---@return number -Managment.GetAccountMoney = function(account) +Banking.GetAccountMoney = function(account) return tgg:GetSocietyAccountMoney(account) or 0 end @@ -22,7 +22,7 @@ end ---@param amount number ---@param _ string ---@return boolean -Managment.AddAccountMoney = function(account, amount, _) +Banking.AddAccountMoney = function(account, amount, _) return tgg:AddSocietyMoney(account, amount) end @@ -31,8 +31,8 @@ end ---@param amount number ---@param _ string ---@return boolean -Managment.RemoveAccountMoney = function(account, amount, _) +Banking.RemoveAccountMoney = function(account, amount, _) return tgg:RemoveSocietyMoney(account, amount) end -return Managment \ No newline at end of file +return Banking \ No newline at end of file diff --git a/modules/managment/tgiann-bank/server.lua b/modules/banking/tgiann-bank/server.lua similarity index 76% rename from modules/managment/tgiann-bank/server.lua rename to modules/banking/tgiann-bank/server.lua index 55f1b10..082ee73 100644 --- a/modules/managment/tgiann-bank/server.lua +++ b/modules/banking/tgiann-bank/server.lua @@ -1,19 +1,19 @@ ---@diagnostic disable: duplicate-set-field if GetResourceState('tgiann-bank') == 'missing' then return end -Managment = Managment or {} +Banking = Banking or {} local tgiann = exports["tgiann-bank"] ---This will get the name of the Managment system being being used. ---@return string -Managment.GetManagmentName = function() +Banking.GetManagmentName = function() return 'tgiann-bank' end ---This will return a number ---@param account string ---@return number -Managment.GetAccountMoney = function(account) +Banking.GetAccountMoney = function(account) return tgiann:GetJobAccountBalance(account) end @@ -22,7 +22,7 @@ end ---@param amount number ---@param _ string ---@return boolean -Managment.AddAccountMoney = function(account, amount, _) +Banking.AddAccountMoney = function(account, amount, _) return tgiann:AddJobMoney(account, amount) end @@ -31,8 +31,8 @@ end ---@param amount number ---@param _ string ---@return boolean -Managment.RemoveAccountMoney = function(account, amount, _) +Banking.RemoveAccountMoney = function(account, amount, _) return tgiann:RemoveJobMoney(account, amount) end -return Managment \ No newline at end of file +return Banking \ No newline at end of file diff --git a/modules/managment/wasabi_banking/server.lua b/modules/banking/wasabi_banking/server.lua similarity index 78% rename from modules/managment/wasabi_banking/server.lua rename to modules/banking/wasabi_banking/server.lua index 0a755b6..5d6cea6 100644 --- a/modules/managment/wasabi_banking/server.lua +++ b/modules/banking/wasabi_banking/server.lua @@ -1,19 +1,19 @@ ---@diagnostic disable: duplicate-set-field if GetResourceState('wasabi_banking') == 'missing' then return end -Managment = Managment or {} +Banking = Banking or {} local wasabi_banking = exports['wasabi_banking'] ---This will get the name of the Managment system being being used. ---@return string -Managment.GetManagmentName = function() +Banking.GetManagmentName = function() return 'wasabi_banking' end ---This will return a number ---@param account string ---@return number -Managment.GetAccountMoney = function(account) +Banking.GetAccountMoney = function(account) local balance = wasabi_banking:GetAccountBalance(account, 'society') return balance or 0 end @@ -23,7 +23,7 @@ end ---@param amount number ---@param reason string ---@return boolean -Managment.AddAccountMoney = function(account, amount, reason) +Banking.AddAccountMoney = function(account, amount, reason) return wasabi_banking:AddMoney('society', account, amount) end @@ -32,8 +32,8 @@ end ---@param amount number ---@param reason string ---@return boolean -Managment.RemoveAccountMoney = function(account, amount, reason) +Banking.RemoveAccountMoney = function(account, amount, reason) return wasabi_banking:RemoveMoney('society', account, amount) end -return Managment \ No newline at end of file +return Banking \ No newline at end of file diff --git a/modules/dialogue/_default/client/client.lua b/modules/dialogue/_default/client/client.lua index 4792b0e..4768371 100644 --- a/modules/dialogue/_default/client/client.lua +++ b/modules/dialogue/_default/client/client.lua @@ -66,7 +66,6 @@ function Dialogue.Open( name, dialogue, characterOptions, dialogueOptions, onSel SetCamCoord(cam, endLocation.x, endLocation.y, endLocation.z) RenderScriptCams(true, true, 1000, true, false) SetCamActive(cam, true) - end SendNUIMessage({ type = "open", From 503154a69c1327e1df615806ec78d75c33b4af34 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sun, 27 Jul 2025 14:22:52 -0400 Subject: [PATCH 06/54] Create hr.json --- locales/hr.json | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 locales/hr.json diff --git a/locales/hr.json b/locales/hr.json new file mode 100644 index 0000000..77fc6d0 --- /dev/null +++ b/locales/hr.json @@ -0,0 +1,37 @@ +{ + "Shops": { + "NotEnoughMoney": "Nemate dovoljno novca za kupnju ovog predmeta", + "Input": "Unos količine", + "PurchaseAmount": "Količina kupnje", + "PurchasedItem": "Kupili ste ", + "CurrencySymbol": "%s kn", + "Confirm": "Potvrdi kupnju", + "AreYouSure": "Jeste li sigurni da želite kupiti %s", + "PayByCash": "Platite %s gotovinom", + "PayByCard": "Platite %s karticom", + "CardIcon": "fa-solid fa-building-columns", + "CashIcon": "fa-solid fa-money-bill-wave", + "ShopIcon": "fa-solid fa-basket-shopping", + "ShopName": "Naziv trgovine" + }, + "UNITTEST": { + "UNITTESTA": "Ja sam %s %s", + "locale-unit-test": "Ovo je test string" + }, + "clipboard": { + "copy": "Kopirano u međuspremnik" + }, + "placeable_object": { + "no_prop_defined": "Niste definirali nijedan objekt za postavljanje", + "cant_place_here": "Ne možete postaviti ovaj objekt ovdje", + "place_object_place": "[E] Postavi \n", + "place_object_cancel": "[X] Otkažи \n", + "place_object_scroll_up": "[Scroll Up] Okreni desno \n", + "place_object_scroll_down": "[Scroll Down] Okreni lijevo \n", + "object_place": "[%s] Postavi \n", + "object_cancel": "[%s] Otkažи \n", + "object_scroll_up": "[%s] Okreni desno \n", + "object_scroll_down": "[%s] Okreni lijevo \n", + "depth_modifier": "[%s] Modifikator kontrole dubine \n" + } +} From fc8da1d5280623453cbcebf870eb0816ca076a05 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sun, 27 Jul 2025 14:30:38 -0400 Subject: [PATCH 07/54] qb progressbar returns opposite of bridge standard (ox) --- modules/progressbar/qb-progressbar/client.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/progressbar/qb-progressbar/client.lua b/modules/progressbar/qb-progressbar/client.lua index 11fb7e4..a276391 100644 --- a/modules/progressbar/qb-progressbar/client.lua +++ b/modules/progressbar/qb-progressbar/client.lua @@ -57,7 +57,7 @@ function ProgressBar.Open(options, cb, qbFormat) end local prom = promise.new() exports['progressbar']:Progress(options, function(cancelled) - if cb then cb(not cancelled) end + if cb then cb(cancelled) end prom:resolve(not cancelled) end) return Citizen.Await(prom) From 466e86bfdb8451f38a9a7fc54587403562fe88df Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Mon, 28 Jul 2025 00:10:51 -0500 Subject: [PATCH 08/54] targets and inventory update Targets: sphearzone should not take a heading, removed optional debug at the end for individual debugging Inventory: Added OpenPlayerInventory for all inventories. 2 (aka codem and qs) did not have clear documentation. Probably doesnt work --- modules/inventory/_default/client.lua | 2 ++ modules/inventory/_default/server.lua | 4 ++++ modules/inventory/codem-inventory/server.lua | 9 +++++++++ modules/inventory/core_inventory/server.lua | 10 ++++++++++ modules/inventory/jpr-inventory/server.lua | 10 ++++++++++ modules/inventory/origen_inventory/server.lua | 8 ++++++++ modules/inventory/ox_inventory/server.lua | 8 ++++++++ modules/inventory/qb-inventory/server.lua | 8 ++++++++ modules/inventory/qs-inventory/server.lua | 8 ++++++++ modules/inventory/tgiann-inventory/server.lua | 9 +++++++++ modules/target/ox_target/client.lua | 4 ++-- modules/target/qb-target/client.lua | 4 ++-- modules/target/sleepless_interact/client.lua | 4 ++-- 13 files changed, 82 insertions(+), 6 deletions(-) diff --git a/modules/inventory/_default/client.lua b/modules/inventory/_default/client.lua index 820f869..68aba63 100644 --- a/modules/inventory/_default/client.lua +++ b/modules/inventory/_default/client.lua @@ -52,4 +52,6 @@ Inventory.Items = function() return Framework.Shared.Items end + + return Inventory \ No newline at end of file diff --git a/modules/inventory/_default/server.lua b/modules/inventory/_default/server.lua index c6b24d1..6278594 100644 --- a/modules/inventory/_default/server.lua +++ b/modules/inventory/_default/server.lua @@ -193,4 +193,8 @@ Inventory.StripPNG = function(item) return item end +Inventory.OpenPlayerInventory = function(src, targetSrc) + return false, Prints.Error("OpenPlayerInventory is not implemented in this inventory, because of this we dont have a way to open a players inventory.") +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/codem-inventory/server.lua b/modules/inventory/codem-inventory/server.lua index fc652f9..2927e6e 100644 --- a/modules/inventory/codem-inventory/server.lua +++ b/modules/inventory/codem-inventory/server.lua @@ -190,4 +190,13 @@ Inventory.GetImagePath = function(item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports['codem-inventory']:OpenInventory(src, target) +end + + return Inventory \ No newline at end of file diff --git a/modules/inventory/core_inventory/server.lua b/modules/inventory/core_inventory/server.lua index 9d0956d..b3d7032 100644 --- a/modules/inventory/core_inventory/server.lua +++ b/modules/inventory/core_inventory/server.lua @@ -257,4 +257,14 @@ Inventory.Items = function() return core:getItemsList() end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + local identifier = Framework.GetPlayerIdentifier(target) + if not identifier then return false end + exports.core_inventory:openInventory(src, 'stash-'.. identifier:gsub(':',''), 'stash', nil, nil, true, nil, false) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/jpr-inventory/server.lua b/modules/inventory/jpr-inventory/server.lua index c46ae2a..e0f31ff 100644 --- a/modules/inventory/jpr-inventory/server.lua +++ b/modules/inventory/jpr-inventory/server.lua @@ -189,4 +189,14 @@ Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGrou return true end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + local identifier = Framework.GetPlayerIdentifier(target) + if not identifier then return false end + exports['jpr-inventory']:OpenInventory(src, identifier) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/origen_inventory/server.lua b/modules/inventory/origen_inventory/server.lua index b6d799c..784cb9b 100644 --- a/modules/inventory/origen_inventory/server.lua +++ b/modules/inventory/origen_inventory/server.lua @@ -239,4 +239,12 @@ Inventory.GetImagePath = function(item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports.origen_inventory:OpenInventory(src, "otherplayer", target) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/ox_inventory/server.lua b/modules/inventory/ox_inventory/server.lua index 2a35e95..973cbd5 100644 --- a/modules/inventory/ox_inventory/server.lua +++ b/modules/inventory/ox_inventory/server.lua @@ -224,4 +224,12 @@ Inventory.GetItem = function(src, item, metadata) return ox_inventory:GetItem(src, item, metadata, false) end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports.ox_inventory:openInventory('player', target) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/qb-inventory/server.lua b/modules/inventory/qb-inventory/server.lua index ae8b715..ce60468 100644 --- a/modules/inventory/qb-inventory/server.lua +++ b/modules/inventory/qb-inventory/server.lua @@ -275,4 +275,12 @@ Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGrou end end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports['qb-inventory']:OpenInventory(src, target) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/qs-inventory/server.lua b/modules/inventory/qs-inventory/server.lua index 8ae16a4..52a542c 100644 --- a/modules/inventory/qs-inventory/server.lua +++ b/modules/inventory/qs-inventory/server.lua @@ -233,4 +233,12 @@ Inventory.GetImagePath = function(item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports['qs-inventory']:OpenInventory(src, target) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/tgiann-inventory/server.lua b/modules/inventory/tgiann-inventory/server.lua index 1e38751..fadb24c 100644 --- a/modules/inventory/tgiann-inventory/server.lua +++ b/modules/inventory/tgiann-inventory/server.lua @@ -229,4 +229,13 @@ Inventory.GetItem = function(src, item, metadata) return item end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports['tgiann-inventory']:OpenInventoryById(src, target) +end + + return Inventory \ No newline at end of file diff --git a/modules/target/ox_target/client.lua b/modules/target/ox_target/client.lua index ad0367a..3437cac 100644 --- a/modules/target/ox_target/client.lua +++ b/modules/target/ox_target/client.lua @@ -155,13 +155,13 @@ end ---@param coords table ---@param radius number ---@param options table -Target.AddSphereZone = function(name, coords, radius, heading, options) +Target.AddSphereZone = function(name, coords, radius, options, debug) options = Target.FixOptions(options) local target = ox_target:addSphereZone({ coords = coords, radius = radius, name = name, - debug = targetDebug, + debug = targetDebug or debug, options = options }) table.insert(targetZones, { name = name, id = target, creator = GetInvokingResource() }) diff --git a/modules/target/qb-target/client.lua b/modules/target/qb-target/client.lua index 158ff0d..0851023 100644 --- a/modules/target/qb-target/client.lua +++ b/modules/target/qb-target/client.lua @@ -170,11 +170,11 @@ end ---@param coords table ---@param radius number ---@param options table -Target.AddSphereZone = function(name, coords, radius, options) +Target.AddSphereZone = function(name, coords, radius, options, debug) options = Target.FixOptions(options) qb_target:AddCircleZone(name, coords, radius, { name = name, - debugPoly = targetDebug, + debugPoly = targetDebug or debug, }, { options = options, distance = options.distance or 1.5, diff --git a/modules/target/sleepless_interact/client.lua b/modules/target/sleepless_interact/client.lua index b7c6882..95e6375 100644 --- a/modules/target/sleepless_interact/client.lua +++ b/modules/target/sleepless_interact/client.lua @@ -146,13 +146,13 @@ end ---@param coords table ---@param radius number ---@param options table -Target.AddSphereZone = function(name, coords, radius, heading, options) +Target.AddSphereZone = function(name, coords, radius, options, debug) options = Target.FixOptions(options) local target = sleepless_interact:addSphereZone({ coords = coords, radius = radius, name = name, - debug = targetDebug, + debug = targetDebug or debug, options = options }) table.insert(targetZones, { name = name, id = target, creator = GetInvokingResource() }) From 2174213f8d2a97e2247fc01bad8fb7e7c2ff0a35 Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Mon, 28 Jul 2025 00:21:30 -0500 Subject: [PATCH 09/54] woopsies --- modules/progressbar/lation_ui/client.lua | 2 +- modules/progressbar/ox_lib/client.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/progressbar/lation_ui/client.lua b/modules/progressbar/lation_ui/client.lua index 2a7aad0..34ac775 100644 --- a/modules/progressbar/lation_ui/client.lua +++ b/modules/progressbar/lation_ui/client.lua @@ -99,7 +99,7 @@ function ProgressBar.Open(options, cb, isQBInput) local success = exports.lation_ui:progressBar(options) - if cb then cb(not success) end + if cb then cb(success) end return success end diff --git a/modules/progressbar/ox_lib/client.lua b/modules/progressbar/ox_lib/client.lua index 60bb24d..36b6b77 100644 --- a/modules/progressbar/ox_lib/client.lua +++ b/modules/progressbar/ox_lib/client.lua @@ -60,7 +60,7 @@ function ProgressBar.Open(options, cb, isQBInput) local style = options.style or 'bar' local success = style == 'circle' and exports.ox_lib:progressCircle(options) or exports.ox_lib:progressBar(options) - if cb then cb(not success) end + if cb then cb(success) end return success end From eb8a7e444984329982682f2a00bc9c4902637702 Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Mon, 28 Jul 2025 00:21:57 -0500 Subject: [PATCH 10/54] forgot 1 --- modules/progressbar/qb-progressbar/client.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/progressbar/qb-progressbar/client.lua b/modules/progressbar/qb-progressbar/client.lua index a276391..67095a0 100644 --- a/modules/progressbar/qb-progressbar/client.lua +++ b/modules/progressbar/qb-progressbar/client.lua @@ -57,7 +57,7 @@ function ProgressBar.Open(options, cb, qbFormat) end local prom = promise.new() exports['progressbar']:Progress(options, function(cancelled) - if cb then cb(cancelled) end + if cb then cb( not cancelled) end prom:resolve(not cancelled) end) return Citizen.Await(prom) From 88b4daa2e88f757dddeb53dc823e2f617521810f Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Mon, 28 Jul 2025 01:37:52 -0400 Subject: [PATCH 11/54] migrate cache.ped to PlayerPedId() --- lib/placers/client/object_Placer.lua | 3 ++- lib/utility/client/utility.lua | 27 ++++++++++--------- modules/dispatch/_default/client/client.lua | 7 ++--- modules/dispatch/bub-mdt/client/client.lua | 5 ++-- .../linden_outlawalert/client/client.lua | 3 ++- modules/doorlock/qb-doorlock/client.lua | 3 ++- modules/doorlock/rcore_doorlock/client.lua | 3 ++- 7 files changed, 30 insertions(+), 21 deletions(-) diff --git a/lib/placers/client/object_Placer.lua b/lib/placers/client/object_Placer.lua index 70891be..1bf3984 100644 --- a/lib/placers/client/object_Placer.lua +++ b/lib/placers/client/object_Placer.lua @@ -36,6 +36,7 @@ Placeable.PlaceObject = function(object, distance, snapToGround, allowedMats, of local propObject = type(object) == 'string' and joaat(object) or object local heading = 0.0 local checkDist = distance or 10.0 + local ped = PlayerPedId() Utility.LoadModel(propObject) @@ -60,7 +61,7 @@ Placeable.PlaceObject = function(object, distance, snapToGround, allowedMats, of end SetEntityCoords(activePlacementProp, coords.x, coords.y, coords.z, false, false, false, false) - local distCheck = #(GetEntityCoords(cache.ped) - coords) + local distCheck = #(GetEntityCoords(ped) - coords) SetEntityHeading(activePlacementProp, heading) if snapToGround then diff --git a/lib/utility/client/utility.lua b/lib/utility/client/utility.lua index 5b41346..9808f49 100644 --- a/lib/utility/client/utility.lua +++ b/lib/utility/client/utility.lua @@ -312,10 +312,11 @@ end ---Reload the player's skin and remove attached objects ---@return boolean function Utility.ReloadSkin() - local skinData = Utility.GetEntitySkinData(cache.ped) - Utility.SetEntitySkinData(cache.ped, skinData) + local ped = PlayerPedId() + local skinData = Utility.GetEntitySkinData(ped) + Utility.SetEntitySkinData(ped, skinData) for _, props in pairs(GetGamePool("CObject")) do - if IsEntityAttachedToEntity(cache.ped, props) then + if IsEntityAttachedToEntity(ped, props) then SetEntityAsMissionEntity(props, true, true) DeleteObject(props) DeleteEntity(props) @@ -366,6 +367,7 @@ end ---@param conditionFunction function|nil ---@param afterTeleportFunction function|nil function Utility.TeleportPlayer(coords, conditionFunction, afterTeleportFunction) + local ped = PlayerPedId() if conditionFunction ~= nil then if not conditionFunction() then return @@ -373,18 +375,18 @@ function Utility.TeleportPlayer(coords, conditionFunction, afterTeleportFunction end DoScreenFadeOut(2500) Wait(2500) - SetEntityCoords(cache.ped, coords.x, coords.y, coords.z, false, false, false, false) + SetEntityCoords(ped, coords.x, coords.y, coords.z, false, false, false, false) if coords.w then - SetEntityHeading(cache.ped, coords.w) + SetEntityHeading(ped, coords.w) end - FreezeEntityPosition(cache.ped, true) + FreezeEntityPosition(ped, true) local count = 0 - while not HasCollisionLoadedAroundEntity(cache.ped) and count <= 30000 do + while not HasCollisionLoadedAroundEntity(ped) and count <= 30000 do RequestCollisionAtCoord(coords.x, coords.y, coords.z) Wait(0) count = count + 1 end - FreezeEntityPosition(cache.ped, false) + FreezeEntityPosition(ped, false) DoScreenFadeIn(1000) if afterTeleportFunction ~= nil then afterTeleportFunction() @@ -406,8 +408,8 @@ end function Utility.GetClosestPlayer(coords, distanceScope, includeMe) local players = GetActivePlayers() local closestPlayer = 0 - local selfPed = cache.ped - local selfCoords = coords or GetEntityCoords(cache.ped) + local selfPed = PlayerPedId() + local selfCoords = coords or GetEntityCoords(selfPed) local closestDistance = distanceScope or 5 for _, player in ipairs(players) do @@ -434,12 +436,13 @@ function Utility.GetClosestVehicle(coords, distanceScope, includePlayerVeh) local vehicleEntity = nil local vehicleNetID = nil local vehicleCoords = nil - local selfCoords = coords or GetEntityCoords(cache.ped) + local ped = PlayerPedId() + local selfCoords = coords or GetEntityCoords(ped) local closestDistance = distanceScope or 5 local includeMyVeh = includePlayerVeh or false local gamePoolVehicles = GetGamePool("CVehicle") - local playerVehicle = IsPedInAnyVehicle(cache.ped, false) and GetVehiclePedIsIn(cache.ped, false) or 0 + local playerVehicle = IsPedInAnyVehicle(ped, false) and GetVehiclePedIsIn(ped, false) or 0 for i = 1, #gamePoolVehicles do local thisVehicle = gamePoolVehicles[i] diff --git a/modules/dispatch/_default/client/client.lua b/modules/dispatch/_default/client/client.lua index ab2434e..15bccc0 100644 --- a/modules/dispatch/_default/client/client.lua +++ b/modules/dispatch/_default/client/client.lua @@ -5,15 +5,16 @@ Dispatch = Dispatch or {} ---@param data table The data to send to the dispatch system. ---@return nil Dispatch.SendAlert = function(data) + local ped = PlayerPedId() TriggerServerEvent('community_bridge:Server:DispatchAlert', { sprite = data.blipData.sprite or 161, color = data.blipData.color or 1, scale = data.blipData.scale or 0.8, vehicle = data.vehicle or nil, plate = data.vehicle and GetVehicleNumberPlateText(data.vehicle) or nil, - ped = data.ped or cache.ped, - pedCoords = data.pedCoords or GetEntityCoords(cache.ped), - coords = data.coords or GetEntityCoords(cache.ped), + ped = data.ped or ped, + pedCoords = data.pedCoords or GetEntityCoords(ped), + coords = data.coords or GetEntityCoords(ped), message = data.message or "An Alert Has Been Made", code = data.code or '10-80', icon = data.icon or 'fas fa-question', diff --git a/modules/dispatch/bub-mdt/client/client.lua b/modules/dispatch/bub-mdt/client/client.lua index a17f3f5..8bdedda 100644 --- a/modules/dispatch/bub-mdt/client/client.lua +++ b/modules/dispatch/bub-mdt/client/client.lua @@ -3,14 +3,15 @@ if GetResourceState('bub-mdt') == 'missing' then return end Dispatch = Dispatch or {} Dispatch.SendAlert = function(data) + local ped = PlayerPedId() local alertData = { code = data.code or '10-80', offense = data.message, - coords = data.coords or GetEntityCoords(cache.ped), + coords = data.coords or GetEntityCoords(ped), info = { label = data.code or '10-80', icon = data.icon or 'fas fa-question' }, blip = data.blipData.sprite or 1, isEmergency = data.priority == 1 and true or false, - blipCoords = data.coords or cache.ped and GetEntityCoords(cache.ped) or { x = 0, y = 0}, + blipCoords = data.coords or ped and GetEntityCoords(ped) or { x = 0, y = 0}, } exports["bub-mdt"]:CustomAlert(alertData) end diff --git a/modules/dispatch/linden_outlawalert/client/client.lua b/modules/dispatch/linden_outlawalert/client/client.lua index 4b63501..c783e98 100644 --- a/modules/dispatch/linden_outlawalert/client/client.lua +++ b/modules/dispatch/linden_outlawalert/client/client.lua @@ -3,6 +3,7 @@ if GetResourceState('linden_outlawalert') == 'missing' then return end Dispatch = Dispatch or {} Dispatch.SendAlert = function(data) + local ped = PlayerPedId() TriggerServerEvent('wf-alerts:svNotify', { dispatchData = { displayCode = data.code or '211', @@ -14,7 +15,7 @@ Dispatch.SendAlert = function(data) info = data.message or "Alert" }, caller = 'Anonymous', - coords = data.coords or GetEntityCoords(cache.ped) + coords = data.coords or GetEntityCoords(ped) }) end diff --git a/modules/doorlock/qb-doorlock/client.lua b/modules/doorlock/qb-doorlock/client.lua index c21442b..a7356db 100644 --- a/modules/doorlock/qb-doorlock/client.lua +++ b/modules/doorlock/qb-doorlock/client.lua @@ -6,10 +6,11 @@ Doorlock = Doorlock or {} ---This will get the closest door to the ped ---@return string | nil Doorlock.GetClosestDoor = function() + local ped = PlayerPedId() local closestDoor = exports["qb-doorlock"]:GetClosestDoor() if Table.CheckPopulated(closestDoor) then return closestDoor end local allDoors = exports["qb-doorlock"]:GetDoorList() - local pedCoords = GetEntityCoords(cache.ped) + local pedCoords = GetEntityCoords(ped) local door = 0 local doorDist = 1000.0 for doorID, data in pairs(allDoors) do diff --git a/modules/doorlock/rcore_doorlock/client.lua b/modules/doorlock/rcore_doorlock/client.lua index 06e5a7d..5c9cd6c 100644 --- a/modules/doorlock/rcore_doorlock/client.lua +++ b/modules/doorlock/rcore_doorlock/client.lua @@ -6,8 +6,9 @@ Doorlock = Doorlock or {} ---This will get the closest door to the ped ---@return string | nil Doorlock.GetClosestDoor = function() + local ped = PlayerPedId() local allDoors = exports.rcore_doorlock:getLoadedDoors() - local pedCoords = GetEntityCoords(cache.ped) + local pedCoords = GetEntityCoords(ped) local door = 0 local doorDist = 1000.0 for _, data in pairs(allDoors) do From a62cb880b074f23b7551b78a0d488d93cf181363 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Mon, 28 Jul 2025 01:38:25 -0400 Subject: [PATCH 12/54] mr gorbachev tear down this wall of commented out code --- modules/clothing/esx_skin/shared.lua | 64 +------------------------ modules/clothing/qb-clothing/shared.lua | 62 +----------------------- 2 files changed, 2 insertions(+), 124 deletions(-) diff --git a/modules/clothing/esx_skin/shared.lua b/modules/clothing/esx_skin/shared.lua index f4cec6d..53d5845 100644 --- a/modules/clothing/esx_skin/shared.lua +++ b/modules/clothing/esx_skin/shared.lua @@ -4,8 +4,6 @@ if GetResourceState('rcore_clothing') ~= 'missing' then return end Clothing = Clothing or {} --- {"glasses_2":0,"shoes_1":70,"dad":0,"shoes_2":2,"pants_1":28,"eye_squint":0,"ears_1":-1,"hair_color_1":61,"eyebrows_6":0,"bodyb_3":-1,"beard_1":11,"complexion_2":0,"arms_2":0,"hair_1":76,"nose_1":0,"blush_2":0,"bracelets_2":0,"blush_1":0,"jaw_2":0,"helmet_1":-1,"eyebrows_3":0,"watches_1":-1,"eyebrows_4":0,"jaw_1":0,"lipstick_1":0,"eyebrows_1":0,"nose_4":0,"age_2":0,"torso_1":23,"hair_2":0,"chin_2":0,"arms":1,"chain_1":22,"nose_2":0,"cheeks_1":2,"tshirt_1":4,"glasses_1":0,"pants_2":3,"lipstick_4":0,"chin_13":0,"beard_4":0,"beard_3":0,"chain_2":2,"cheeks_3":6,"sex":0,"lipstick_3":0,"makeup_1":0,"hair_color_2":29,"mask_2":0,"chin_1":0,"eyebrows_5":0,"bodyb_2":0,"sun_2":0,"watches_2":0,"sun_1":0,"chin_4":0,"nose_3":0,"helmet_2":0,"bags_2":0,"moles_2":0,"mask_1":0,"blemishes_2":0,"chest_1":0,"cheeks_2":-10,"age_1":0,"chest_2":0,"beard_2":10,"torso_2":2,"blush_3":0,"bproof_1":0,"moles_1":0,"chin_3":0,"lip_thickness":-2,"lipstick_2":0,"chest_3":0,"complexion_1":0,"bodyb_4":0,"neck_thickness":0,"bproof_2":0,"makeup_3":0,"tshirt_2":2,"makeup_2":0,"makeup_4":0,"bracelets_1":-1,"decals_2":0,"nose_6":0,"bodyb_1":-1,"bags_1":0,"blemishes_1":0,"decals_1":0,"mom":21,"eyebrows_2":0,"eye_color":0,"skin_md_weight":50,"face_md_weight":50,"nose_5":10,"ears_2":0} - Components = {} Components.Map = { [1] = 'mask', -- componentId @@ -141,64 +139,4 @@ function Clothing.ConvertToDefault(esxClothing) local components = Components.ConvertToDefault(esxClothing) local props = Props.ConvertToDefault(esxClothing) return { components = components, props = props } -end - --- Clothing = {} - --- StoredOldClothing = {} - --- Clothing.SetAppearance = function(clothingData) --- if GetEntityModel(cache.ped) == `mp_m_freemode_01` then --- clothingData = clothingData.male --- else --- clothingData = clothingData.female --- end --- local repackedTable = {} --- local componentMap = { --- [1] = "mask", --- [3] = "arms", --- [4] = "pants", --- [5] = "bag", --- [6] = "shoes", --- [7] = "accessory", --- [8] = "t-shirt", --- [9] = "vest", --- [10] = "decals", --- [11] = "torso2" --- } - --- local propMap = { --- [0] = "hat", --- [1] = "glass", --- [2] = "ear", --- [6] = "watch", --- [7] = "bracelet" --- } - --- local specialMap = { --- eye_color_id = "eye_color", --- moles_id = "moles", --- ageing_id = "ageing", --- hair_id = "hair", --- face_id = "face" --- } - --- for _, data in pairs(clothingData) do --- if componentMap[data.component_id] then --- repackedTable[componentMap[data.component_id]] = {drawable = data.drawable, texture = data.texture} --- elseif propMap[data.prop_id] then --- repackedTable[propMap[data.prop_id]] = {drawable = data.drawable, texture = data.texture} --- elseif specialMap[data.eye_color_id] then --- repackedTable[specialMap[data.eye_color_id]] = {drawable = data.drawable, texture = data.texture} --- elseif specialMap[data.moles_id] then --- repackedTable[specialMap[data.moles_id]] = {drawable = data.drawable, texture = data.texture} --- elseif specialMap[data.ageing_id] then --- repackedTable[specialMap[data.ageing_id]] = {drawable = data.drawable, texture = data.texture} --- elseif specialMap[data.hair_id] then --- repackedTable[specialMap[data.hair_id]] = {drawable = data.drawable, texture = data.texture} --- elseif specialMap[data.face_id] then --- repackedTable[specialMap[data.face_id]] = {drawable = data.drawable, texture = data.texture} --- end --- end --- TriggerEvent('esx-clothing:client:loadOutfit', repackedTable) --- end +end \ No newline at end of file diff --git a/modules/clothing/qb-clothing/shared.lua b/modules/clothing/qb-clothing/shared.lua index 6a7a8aa..394e0b3 100644 --- a/modules/clothing/qb-clothing/shared.lua +++ b/modules/clothing/qb-clothing/shared.lua @@ -125,64 +125,4 @@ function Clothing.ConvertToDefault(qbClothing) local components = Components.ConvertToDefault(qbClothing) local props = Props.ConvertToDefault(qbClothing) return { components = components, props = props } -end - --- Clothing = {} - --- StoredOldClothing = {} - --- Clothing.SetAppearance = function(clothingData) --- if GetEntityModel(cache.ped) == `mp_m_freemode_01` then --- clothingData = clothingData.male --- else --- clothingData = clothingData.female --- end --- local repackedTable = {} --- local componentMap = { --- [1] = "mask", --- [3] = "arms", --- [4] = "pants", --- [5] = "bag", --- [6] = "shoes", --- [7] = "accessory", --- [8] = "t-shirt", --- [9] = "vest", --- [10] = "decals", --- [11] = "torso2" --- } - --- local propMap = { --- [0] = "hat", --- [1] = "glass", --- [2] = "ear", --- [6] = "watch", --- [7] = "bracelet" --- } - --- local specialMap = { --- eye_color_id = "eye_color", --- moles_id = "moles", --- ageing_id = "ageing", --- hair_id = "hair", --- face_id = "face" --- } - --- for _, data in pairs(clothingData) do --- if componentMap[data.component_id] then --- repackedTable[componentMap[data.component_id]] = {drawable = data.drawable, texture = data.texture} --- elseif propMap[data.prop_id] then --- repackedTable[propMap[data.prop_id]] = {drawable = data.drawable, texture = data.texture} --- elseif specialMap[data.eye_color_id] then --- repackedTable[specialMap[data.eye_color_id]] = {drawable = data.drawable, texture = data.texture} --- elseif specialMap[data.moles_id] then --- repackedTable[specialMap[data.moles_id]] = {drawable = data.drawable, texture = data.texture} --- elseif specialMap[data.ageing_id] then --- repackedTable[specialMap[data.ageing_id]] = {drawable = data.drawable, texture = data.texture} --- elseif specialMap[data.hair_id] then --- repackedTable[specialMap[data.hair_id]] = {drawable = data.drawable, texture = data.texture} --- elseif specialMap[data.face_id] then --- repackedTable[specialMap[data.face_id]] = {drawable = data.drawable, texture = data.texture} --- end --- end --- TriggerEvent('qb-clothing:client:loadOutfit', repackedTable) --- end +end \ No newline at end of file From 2fd5c7c08f1ca86617bf8e1f0573e0db5358ccbd Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Mon, 28 Jul 2025 00:58:02 -0500 Subject: [PATCH 13/54] Update client_entity.lua Added skip to remove so we dont call external on remove. --- lib/entities/client/client_entity.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/entities/client/client_entity.lua b/lib/entities/client/client_entity.lua index 1b7e706..4d6e24f 100644 --- a/lib/entities/client/client_entity.lua +++ b/lib/entities/client/client_entity.lua @@ -45,7 +45,7 @@ local function SpawnEntity(entityData) end end -local function RemoveEntity(entityData) +local function RemoveEntity(entityData, skip) entityData = entityData and entityData.args or entityData if not entityData then return end ClientEntityActions.StopAction(entityData.id) @@ -55,7 +55,7 @@ local function RemoveEntity(entityData) SetEntityAsMissionEntity(entityHandle, false, false) DeleteEntity(entityHandle) end - if entityData.OnRemove then + if not skip and entityData.OnRemove then entityData.OnRemove(entityData) end end @@ -239,7 +239,7 @@ AddEventHandler('onResourceStop', function(resourceName) if resourceName == GetCurrentResourceName() then for id, entityData in pairs(Entities) do Point.Remove(id) -- Clean up point registration - RemoveEntity(entityData) -- Clean up spawned game entity + RemoveEntity(entityData, true) -- Clean up spawned game entity end Entities = {} -- Clear local cache end From 6047c6d88c6267efd307711fd467ab469b2756d3 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Mon, 28 Jul 2025 03:30:46 -0400 Subject: [PATCH 14/54] banking in manifest --- fxmanifest.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index e124d02..806abc0 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -25,7 +25,7 @@ server_scripts { 'modules/inventory/**/server.lua', 'modules/doorlock/**/server.lua', 'modules/phone/**/server.lua', - 'modules/managment/**/server.lua', + 'modules/banking/**/server.lua', 'modules/dispatch/**/server.lua', 'modules/clothing/**/server.lua', 'modules/shops/**/server.lua', From a1e65a7dff1ae24eb5a662ffbe3a86e66adad81f Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Tue, 29 Jul 2025 05:22:55 -0500 Subject: [PATCH 15/54] made some changes to input and target targets now accept event fixed a check for .action passed to ox fix options input will now return in qbs format if qb is used (passed as true).. this makes converting qb resources infinitely simpler --- modules/input/ox_lib/client.lua | 11 ++++++++++- modules/input/qb-input/client.lua | 2 +- modules/menu/ox_lib/client.lua | 2 +- modules/target/ox_target/client.lua | 14 ++++++++++---- modules/target/qb-target/client.lua | 12 +++++++++++- 5 files changed, 33 insertions(+), 8 deletions(-) diff --git a/modules/input/ox_lib/client.lua b/modules/input/ox_lib/client.lua index 926efeb..3919fdf 100644 --- a/modules/input/ox_lib/client.lua +++ b/modules/input/ox_lib/client.lua @@ -8,7 +8,16 @@ Input = {} function Input.Open(title, data, isQBFormat, submitText) local inputs = data.inputs if isQBFormat then - return lib.inputDialog(title, QBToOxInput(inputs)) + local convertedData = {} + local returnData = lib.inputDialog(title, QBToOxInput(inputs)) + for i, v in pairs(inputs) do + for k, j in pairs(returnData or {}) do + if k == v.name then + convertedData[v.name] = j + end + end + end + return convertedData else return lib.inputDialog(title, data) end diff --git a/modules/input/qb-input/client.lua b/modules/input/qb-input/client.lua index b227315..3742d57 100644 --- a/modules/input/qb-input/client.lua +++ b/modules/input/qb-input/client.lua @@ -24,7 +24,7 @@ function Input.Open(title, data, isQBFormat, submitText) for i, v in pairs(input) do for k, j in pairs(returnData) do if k == v.name then - convertedData[tonumber(i)] = j + convertedData[v.name] = j end end end diff --git a/modules/menu/ox_lib/client.lua b/modules/menu/ox_lib/client.lua index 5899892..5e097f1 100644 --- a/modules/menu/ox_lib/client.lua +++ b/modules/menu/ox_lib/client.lua @@ -25,7 +25,7 @@ local function QBToOxMenu(id, menu) description = v.txt, icon = v.icon, args = v.params.args, - onSelect = function(selected, secondary, args) + onSelect = v.action or function(selected, secondary, args) local params = menu[id]?.options?[selected]?.params if not params then return end local event = params.event diff --git a/modules/target/ox_target/client.lua b/modules/target/ox_target/client.lua index 3437cac..7211e39 100644 --- a/modules/target/ox_target/client.lua +++ b/modules/target/ox_target/client.lua @@ -22,8 +22,13 @@ Target = Target or {} Target.FixOptions = function(options) for k, v in pairs(options) do local action = v.onSelect or v.action - if not action then - print(("Target option (%s) %s is missing an 'onSelect' or 'action' function."):format(k, v.label)) + if not action then + local _type = v.type + if _type and _type == "server" then + v.serverEvent = v.event + v.event = nil + end + else local select = function(entityOrData) if type(entityOrData) == 'table' then @@ -31,9 +36,10 @@ Target.FixOptions = function(options) end return action(entityOrData) end - options[k].onSelect = select - options[k].groups = v.job or v.groups + v.onSelect = select + end + v.groups = v.job or v.groups end return options end diff --git a/modules/target/qb-target/client.lua b/modules/target/qb-target/client.lua index 0851023..ed8fe1f 100644 --- a/modules/target/qb-target/client.lua +++ b/modules/target/qb-target/client.lua @@ -24,14 +24,24 @@ local qb_target = exports['qb-target'] Target.FixOptions = function(options) for k, v in pairs(options) do local action = v.onSelect or v.action - local select = function(entityOrData) + local select = action and function(entityOrData) if type(entityOrData) == 'table' then return action(entityOrData.entity) end return action(entityOrData) end + if v.serverEvent then + v.type = "server" + v.event = v.serverEvent + elseif v.event then + v.type = "client" + v.event = v.event + print("Fixing options for target:", k, "with event:", v.event) + end options[k].action = select options[k].job = v.job or v.groups + options[k].jobType = v.jobType + print("Fixing options for target:", k, "with job:", options[k].job, "and jobType:", options[k].jobType) end return options end From 4e02625d70ae7de10aa4c2196df7fe558e34d554 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 29 Jul 2025 11:25:38 -0400 Subject: [PATCH 16/54] add support for qb-fuel --- modules/fuel/qb-fuel/client.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 modules/fuel/qb-fuel/client.lua diff --git a/modules/fuel/qb-fuel/client.lua b/modules/fuel/qb-fuel/client.lua new file mode 100644 index 0000000..581e7e6 --- /dev/null +++ b/modules/fuel/qb-fuel/client.lua @@ -0,0 +1,29 @@ +---@diagnostic disable: duplicate-set-field +local resourceName = "qb-fuel" +if GetResourceState(resourceName) == 'missing' then return end +Fuel = Fuel or {} + +---This will get the name of the Fuel being used (if a supported Fuel). +---@return string +Fuel.GetResourceName = function() + return resourceName +end + +---This will get the fuel level of the vehicle. +---@param vehicle number The vehicle entity ID. +---@return number fuel The fuel level of the vehicle. +Fuel.GetFuel = function(vehicle) + if not DoesEntityExist(vehicle) then return 0.0 end + return exports['qb-fuel']:GetFuel(vehicle) +end + +---This will set the fuel level of the vehicle. +---@param vehicle number The vehicle entity ID. +---@param fuel number The fuel level to set. +---@return nil +Fuel.SetFuel = function(vehicle, fuel, type) + if not DoesEntityExist(vehicle) then return end + return exports['qb-fuel']:SetFuel(vehicle, fuel) +end + +return Fuel \ No newline at end of file From 868a193ceabe3453db790e708f2fbe7db14bc20e Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 29 Jul 2025 12:55:48 -0400 Subject: [PATCH 17/54] Update client.lua --- modules/fuel/legacyfuel/client.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/fuel/legacyfuel/client.lua b/modules/fuel/legacyfuel/client.lua index fc95740..273f17d 100644 --- a/modules/fuel/legacyfuel/client.lua +++ b/modules/fuel/legacyfuel/client.lua @@ -1,6 +1,7 @@ ---@diagnostic disable: duplicate-set-field local resourceName = "LegacyFuel" if GetResourceState(resourceName) == 'missing' then return end +if GetResourceState("qb-fuel") == 'started' then return end Fuel = Fuel or {} ---This will get the name of the Fuel being used (if a supported Fuel). From a5799df7cb0c3c375c14bf8fb5a171f98166c565 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 29 Jul 2025 12:56:27 -0400 Subject: [PATCH 18/54] Update client.lua --- modules/target/qb-target/client.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/target/qb-target/client.lua b/modules/target/qb-target/client.lua index ed8fe1f..615a14a 100644 --- a/modules/target/qb-target/client.lua +++ b/modules/target/qb-target/client.lua @@ -41,7 +41,6 @@ Target.FixOptions = function(options) options[k].action = select options[k].job = v.job or v.groups options[k].jobType = v.jobType - print("Fixing options for target:", k, "with job:", options[k].job, "and jobType:", options[k].jobType) end return options end From 94484e882b27cc386306d70afe8481b61e1eba84 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Wed, 30 Jul 2025 13:28:20 -0400 Subject: [PATCH 19/54] remove random print --- modules/target/qb-target/client.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/target/qb-target/client.lua b/modules/target/qb-target/client.lua index 615a14a..ddc1a6a 100644 --- a/modules/target/qb-target/client.lua +++ b/modules/target/qb-target/client.lua @@ -30,13 +30,12 @@ Target.FixOptions = function(options) end return action(entityOrData) end - if v.serverEvent then + if v.serverEvent then v.type = "server" v.event = v.serverEvent elseif v.event then v.type = "client" v.event = v.event - print("Fixing options for target:", k, "with event:", v.event) end options[k].action = select options[k].job = v.job or v.groups From 69703e803fb92c7acde1730610d0424248d223e9 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Wed, 30 Jul 2025 14:46:27 -0400 Subject: [PATCH 20/54] feat(version): improve version comparison and patch notes display - Added CompareVersions function for accurate semantic version comparison. - Refactored patch notes fetching into fetchPatchNotes, supporting both GitHub and Tebex sources. - Improved error handling for invalid repository formats and missing version metadata. - Enhanced update notification logic to use latest GitHub release and display patch notes for newer versions. - Now triggers version check on resource start using updated logic. - Fully backwards compatible --- modules/version/server/VersionChecker.lua | 117 ++++++++++++++++++---- 1 file changed, 97 insertions(+), 20 deletions(-) diff --git a/modules/version/server/VersionChecker.lua b/modules/version/server/VersionChecker.lua index f9a6e16..eb84f8f 100644 --- a/modules/version/server/VersionChecker.lua +++ b/modules/version/server/VersionChecker.lua @@ -1,36 +1,113 @@ Version = Version or {} ----Pass a github username and repo name to check for the latest version of the resource. ---- ----Tebex is a optional boolean to determine if the message should be for a escrowed resource or not. ---- ----Example Version.VersionChecker("TheOrderFivem/community_bridge", false) +local function padVersion(v) + local parts = {} + for n in v:gmatch("%d+") do + table.insert(parts, tonumber(n)) + end + while #parts < 3 do + table.insert(parts, 0) + end + return parts +end + +function CompareVersions(v1, v2) + local a, b = padVersion(v1), padVersion(v2) + for i = 1, 3 do + if a[i] < b[i] then return -1 + elseif a[i] > b[i] then return 1 + end + end + return 0 +end + +local function fetchPatchNotes(branch, resource, username, reponame, localVersion, tebex, actualRepoPath) + local rawUrl = ('https://raw.githubusercontent.com/%s/%s/%s/resources.json'):format(username, reponame, branch) + PerformHttpRequest(rawUrl, function(noteStatus, noteBody) + if noteStatus == 200 then + local patchData = json.decode(noteBody) + if not patchData then return end + + local allVersions = patchData[resource] + + if allVersions and type(allVersions) == "table" then + local notesToPrint = {} + + for versionStr, notes in pairs(allVersions) do + if CompareVersions(versionStr, localVersion) > 0 and type(notes) == "table" then + table.insert(notesToPrint, {version = versionStr, notes = notes}) + end + end + + table.sort(notesToPrint, function(a, b) + return CompareVersions(a.version, b.version) < 0 + end) + + if #notesToPrint > 0 then + if tebex then + rawUrl = "https://portal.cfx.re/assets/granted-assets" + elseif actualRepoPath then + local repoUser, repoName = actualRepoPath:match("([^/]+)/([^/]+)") + if repoUser and repoName then + rawUrl = ('https://github.com/%s/%s/releases/latest'):format(repoUser, repoName) + end + end + print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from %s^7'):format(reponame, localVersion, rawUrl)) + print('^3Patch Notes:^7') + for _, entry in ipairs(notesToPrint) do + print(('^2Version %s:^7'):format(entry.version)) + for _, line in ipairs(entry.notes) do + print((' - %s'):format(line)) + end + end + end + + end + elseif branch == "main" then + fetchPatchNotes("master", resource, username, reponame, localVersion, tebex) + end + end, 'GET') +end + +--- Checks for updates to a resource by comparing the local version (from fxmanifest.lua) with the latest release on GitHub, and optionally prints patch notes if using the template. +--- Example - Version.VersionChecker("TheOrderFivem/patchnotes", true, true, "community_bridge", "TheOrderFivem/community_bridge") ---@param repoPath string ----@param tebex boolean | nil +---@param tebex boolean +---@param showPatchNotes boolean +---@param actualResourceName string +---@param actualRepoPathIfGithub string this is the githubAccount/repoName if the resource is hosted on github, otherwise it will use the repoPath initially passed, this is not needed for tebex = true ---@return nil -function Version.VersionChecker(repoPath, tebex) +function Version.VersionChecker(repoPath, tebex, showPatchNotes, actualResourceName, actualRepoPathIfGithub) local username, reponame = repoPath:match("([^/]+)/([^/]+)") - local resource = reponame and repoPath:match("([^/]+)$") - if not username or not reponame or not resource then + if not username or not reponame then return Prints.Error('^1Invalid repository format. Expected format: "username/reponame"^0') end - local version = GetResourceMetadata(resource, "version", 0):match('%d+%.%d+%.%d+') - if not version then return end + local resource = actualResourceName or reponame + local localVersionRaw = GetResourceMetadata(resource, "version", 0) + if not localVersionRaw then + return print(('^1[ERROR]^7 No version metadata found for resource "%s". Ensure fxmanifest.lua contains a valid version string.'):format(resource)) + end + local localVersion = localVersionRaw:match('%d+%.%d+%.%d+') or localVersionRaw - PerformHttpRequest(('https://api.github.com/repos/%s/%s/releases/latest'):format(username, reponame), function(status, response) - if status ~= 200 then return end - local latest = json.decode(response).tag_name:match('%d+%.%d+%.%d+') - if not latest or latest == version or version:gsub('%D', '') >= latest:gsub('%D', '') then return end + if not showPatchNotes then + PerformHttpRequest(('https://api.github.com/repos/%s/%s/releases/latest'):format(username, reponame), function(status, response) + if status ~= 200 then return end + local latest = json.decode(response).tag_name:match('%d+%.%d+%.%d+') + if not latest or latest == localVersion or localVersion:gsub('%D', '') >= latest:gsub('%D', '') then return end - local url = tebex and "https://portal.cfx.re/assets/granted-assets" or json.decode(response).html_url - print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from %s^7'):format(resource, version, url)) - end, 'GET') + local url = tebex and "https://portal.cfx.re/assets/granted-assets" or json.decode(response).html_url + print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from %s^7'):format(reponame, localVersion, url)) + end, 'GET') + return + end + + fetchPatchNotes("main", resource, username, reponame, localVersion, tebex, actualRepoPathIfGithub) end AddEventHandler('onResourceStart', function(resourceName) if GetCurrentResourceName() ~= resourceName then return end - Version.VersionChecker("TheOrderFivem/community_bridge") + Version.VersionChecker("TheOrderFivem/patchnotes", false, true, "community_bridge", "TheOrderFivem/community_bridge") end) -return Version +return Version \ No newline at end of file From f42f853c813365201230852c73abf23aba1dfa14 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Wed, 30 Jul 2025 17:31:51 -0400 Subject: [PATCH 21/54] Update VersionChecker.lua --- modules/version/server/VersionChecker.lua | 175 ++++++++++++++-------- 1 file changed, 115 insertions(+), 60 deletions(-) diff --git a/modules/version/server/VersionChecker.lua b/modules/version/server/VersionChecker.lua index eb84f8f..0d0e74f 100644 --- a/modules/version/server/VersionChecker.lua +++ b/modules/version/server/VersionChecker.lua @@ -11,98 +11,153 @@ local function padVersion(v) return parts end -function CompareVersions(v1, v2) +local function compareVersions(v1, v2) local a, b = padVersion(v1), padVersion(v2) for i = 1, 3 do - if a[i] < b[i] then return -1 - elseif a[i] > b[i] then return 1 + if a[i] < b[i] then + return -1 + elseif a[i] > b[i] then + return 1 end end return 0 end -local function fetchPatchNotes(branch, resource, username, reponame, localVersion, tebex, actualRepoPath) - local rawUrl = ('https://raw.githubusercontent.com/%s/%s/%s/resources.json'):format(username, reponame, branch) - PerformHttpRequest(rawUrl, function(noteStatus, noteBody) +local function parseVersion(versionString) + return versionString:match('%d+%.%d+%.%d+') or versionString +end + +local function buildGithubApiUrl(repoPath) + local username, reponame = repoPath:match("([^/]+)/([^/]+)") + return ('https://api.github.com/repos/%s/%s/releases/latest'):format(username, reponame) +end + +local function buildPatchNotesUrl(branch, repoPath) + local username, reponame = repoPath:match("([^/]+)/([^/]+)") + return ('https://raw.githubusercontent.com/%s/%s/%s/resources.json'):format(username, reponame, branch) +end + +local function getDownloadUrl(repoPath, tebex, actualRepoPath) + if tebex then + return "https://portal.cfx.re/assets/granted-assets" + elseif actualRepoPath and actualRepoPath ~= false then + local repoUser, repoName = actualRepoPath:match("([^/]+)/([^/]+)") + if repoUser and repoName then + return ('https://github.com/%s/%s/releases/latest'):format(repoUser, repoName) + end + end + return nil +end + +local function printUpdateAvailable(resource, localVersion, downloadUrl) + print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from %s^7'):format(resource, localVersion, downloadUrl)) +end + +local function printPatchNotes(notesToPrint) + print('^3Patch Notes:^7') + for _, entry in ipairs(notesToPrint) do + print(('^2Version %s:^7'):format(entry.version)) + for _, line in ipairs(entry.notes) do + print((' - %s'):format(line)) + end + end +end + +local function printError(message) + print(('^1[ERROR]^7 %s'):format(message)) +end + +local function processVersions(allVersions, localVersion) + local notesToPrint = {} + + for versionStr, notes in pairs(allVersions) do + if compareVersions(versionStr, localVersion) > 0 and type(notes) == "table" then + table.insert(notesToPrint, { version = versionStr, notes = notes }) + end + end + + table.sort(notesToPrint, function(a, b) + return compareVersions(a.version, b.version) < 0 + end) + + return notesToPrint +end + +local function fetchPatchNotes(branch, resource, repoPath, localVersion, tebex, actualRepoPath) + local url = buildPatchNotesUrl(branch, repoPath) + + PerformHttpRequest(url, function(noteStatus, noteBody) if noteStatus == 200 then local patchData = json.decode(noteBody) if not patchData then return end local allVersions = patchData[resource] - if allVersions and type(allVersions) == "table" then - local notesToPrint = {} - - for versionStr, notes in pairs(allVersions) do - if CompareVersions(versionStr, localVersion) > 0 and type(notes) == "table" then - table.insert(notesToPrint, {version = versionStr, notes = notes}) - end - end - - table.sort(notesToPrint, function(a, b) - return CompareVersions(a.version, b.version) < 0 - end) + local notesToPrint = processVersions(allVersions, localVersion) if #notesToPrint > 0 then - if tebex then - rawUrl = "https://portal.cfx.re/assets/granted-assets" - elseif actualRepoPath then - local repoUser, repoName = actualRepoPath:match("([^/]+)/([^/]+)") - if repoUser and repoName then - rawUrl = ('https://github.com/%s/%s/releases/latest'):format(repoUser, repoName) - end - end - print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from %s^7'):format(reponame, localVersion, rawUrl)) - print('^3Patch Notes:^7') - for _, entry in ipairs(notesToPrint) do - print(('^2Version %s:^7'):format(entry.version)) - for _, line in ipairs(entry.notes) do - print((' - %s'):format(line)) - end - end + local downloadUrl = getDownloadUrl(repoPath, tebex, actualRepoPath) or url + printUpdateAvailable(resource, localVersion, downloadUrl) + printPatchNotes(notesToPrint) end - end elseif branch == "main" then - fetchPatchNotes("master", resource, username, reponame, localVersion, tebex) + fetchPatchNotes("master", resource, repoPath, localVersion, tebex, actualRepoPath) end end, 'GET') end +local function checkSimpleUpdate(repoPath, resource, localVersion, isTebex) + local url = buildGithubApiUrl(repoPath) + + PerformHttpRequest(url, function(status, response) + if status ~= 200 then return end + + local latest = parseVersion(json.decode(response).tag_name) + if not latest or latest == localVersion or localVersion:gsub('%D', '') >= latest:gsub('%D', '') then + return + end + + local downloadUrl = isTebex and "https://portal.cfx.re/assets/granted-assets" or json.decode(response).html_url + printUpdateAvailable(resource, localVersion, downloadUrl) + end, 'GET') +end + +local function validateRepoPath(repoPath) + local username, reponame = repoPath:match("([^/]+)/([^/]+)") + if not username or not reponame then + return false, 'Invalid repository format. Expected format: "username/reponame"' + end + return true, username, reponame +end + +local function getLocalVersion(resource) + local localVersionRaw = GetResourceMetadata(resource, "version", 0) + if not localVersionRaw then + return nil, ('No version metadata found for resource "%s". Ensure fxmanifest.lua contains a valid version string.'):format(resource) + end + return parseVersion(localVersionRaw) +end + --- Checks for updates to a resource by comparing the local version (from fxmanifest.lua) with the latest release on GitHub, and optionally prints patch notes if using the template. --- Example - Version.VersionChecker("TheOrderFivem/patchnotes", true, true, "community_bridge", "TheOrderFivem/community_bridge") ---@param repoPath string ----@param tebex boolean +---@param isTebex boolean ---@param showPatchNotes boolean ---@param actualResourceName string ---@param actualRepoPathIfGithub string this is the githubAccount/repoName if the resource is hosted on github, otherwise it will use the repoPath initially passed, this is not needed for tebex = true ---@return nil -function Version.VersionChecker(repoPath, tebex, showPatchNotes, actualResourceName, actualRepoPathIfGithub) - local username, reponame = repoPath:match("([^/]+)/([^/]+)") - if not username or not reponame then - return Prints.Error('^1Invalid repository format. Expected format: "username/reponame"^0') - end +function Version.VersionChecker(repoPath, isTebex, showPatchNotes, actualResourceName, actualRepoPathIfGithub) + local isValid, username, reponame = validateRepoPath(repoPath) + if not isValid then return printError(username) end local resource = actualResourceName or reponame - local localVersionRaw = GetResourceMetadata(resource, "version", 0) - if not localVersionRaw then - return print(('^1[ERROR]^7 No version metadata found for resource "%s". Ensure fxmanifest.lua contains a valid version string.'):format(resource)) - end - local localVersion = localVersionRaw:match('%d+%.%d+%.%d+') or localVersionRaw + local localVersion, errorMsg = getLocalVersion(resource) + if not localVersion then return printError(errorMsg) end - if not showPatchNotes then - PerformHttpRequest(('https://api.github.com/repos/%s/%s/releases/latest'):format(username, reponame), function(status, response) - if status ~= 200 then return end - local latest = json.decode(response).tag_name:match('%d+%.%d+%.%d+') - if not latest or latest == localVersion or localVersion:gsub('%D', '') >= latest:gsub('%D', '') then return end + if not showPatchNotes then return checkSimpleUpdate(repoPath, resource, localVersion, isTebex) end - local url = tebex and "https://portal.cfx.re/assets/granted-assets" or json.decode(response).html_url - print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from %s^7'):format(reponame, localVersion, url)) - end, 'GET') - return - end - - fetchPatchNotes("main", resource, username, reponame, localVersion, tebex, actualRepoPathIfGithub) + fetchPatchNotes("main", resource, repoPath, localVersion, isTebex, actualRepoPathIfGithub) end AddEventHandler('onResourceStart', function(resourceName) @@ -110,4 +165,4 @@ AddEventHandler('onResourceStart', function(resourceName) Version.VersionChecker("TheOrderFivem/patchnotes", false, true, "community_bridge", "TheOrderFivem/community_bridge") end) -return Version \ No newline at end of file +return Version From 2d02e8b0dff0fc2ec8fdf9eae1a7c54b1a374d29 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Wed, 30 Jul 2025 21:34:46 -0400 Subject: [PATCH 22/54] Update VersionChecker.lua --- modules/version/server/VersionChecker.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/version/server/VersionChecker.lua b/modules/version/server/VersionChecker.lua index 0d0e74f..0c2cb54 100644 --- a/modules/version/server/VersionChecker.lua +++ b/modules/version/server/VersionChecker.lua @@ -42,9 +42,7 @@ local function getDownloadUrl(repoPath, tebex, actualRepoPath) return "https://portal.cfx.re/assets/granted-assets" elseif actualRepoPath and actualRepoPath ~= false then local repoUser, repoName = actualRepoPath:match("([^/]+)/([^/]+)") - if repoUser and repoName then - return ('https://github.com/%s/%s/releases/latest'):format(repoUser, repoName) - end + if repoUser and repoName then return ('https://github.com/%s/%s/releases/latest'):format(repoUser, repoName) end end return nil end From fa9ea6e6eb63276eb77baacb60f94de7b5ba08c3 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sun, 3 Aug 2025 15:22:33 -0400 Subject: [PATCH 23/54] image path tweaks --- modules/inventory/_default/client.lua | 8 ++++++++ modules/inventory/tgiann-inventory/client.lua | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/inventory/_default/client.lua b/modules/inventory/_default/client.lua index 68aba63..f7f152e 100644 --- a/modules/inventory/_default/client.lua +++ b/modules/inventory/_default/client.lua @@ -32,6 +32,7 @@ end ---@param item string ---@return string Inventory.GetImagePath = function(item) + print("No get image path for this inventory, using default.") return "https://avatars.githubusercontent.com/u/47620135" end @@ -42,6 +43,13 @@ Inventory.StripPNG = function(item) return item end +Inventory.StripWebp = function(item) + if string.find(item, ".webp") then + item = string.gsub(item, ".webp", "") + end + return item +end + ---This will return the entire items table from the inventory. ---@return table Inventory.Items = function() diff --git a/modules/inventory/tgiann-inventory/client.lua b/modules/inventory/tgiann-inventory/client.lua index cc230c3..5102a87 100644 --- a/modules/inventory/tgiann-inventory/client.lua +++ b/modules/inventory/tgiann-inventory/client.lua @@ -39,10 +39,11 @@ end ---@param item string ---@return string Inventory.GetImagePath = function(item) - item = Inventory.StripPNG(item) - local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item)) - local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item)) - local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item) + local pngItem = Inventory.StripPNG(item) + local webpItem = Inventory.StripWebp(item) + local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", pngItem)) + local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", webpItem)) + local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", pngItem) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", webpItem) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end From 5abebe13c6baf3743465f152924832a8fe3e6035 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sun, 3 Aug 2025 16:23:19 -0400 Subject: [PATCH 24/54] image pathing fixed on tgiann this -- "nui://inventory_images/html/images/%s.png" Is not the path, it its instead nui://inventory_images/images/%s.png" Also strip webp function added. And indexing itemdata was required. --- modules/inventory/_default/client.lua | 8 ++++++++ modules/inventory/_default/server.lua | 11 +++++++++++ modules/inventory/tgiann-inventory/client.lua | 9 +++++---- modules/inventory/tgiann-inventory/server.lua | 12 ++++++------ 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/modules/inventory/_default/client.lua b/modules/inventory/_default/client.lua index f7f152e..3d989f7 100644 --- a/modules/inventory/_default/client.lua +++ b/modules/inventory/_default/client.lua @@ -36,6 +36,10 @@ Inventory.GetImagePath = function(item) return "https://avatars.githubusercontent.com/u/47620135" end +---This will remove the file extension from the item name if present. +---example: "item.png" will become "item" +---@param item string +---@return string Inventory.StripPNG = function(item) if string.find(item, ".png") then item = string.gsub(item, ".png", "") @@ -43,6 +47,10 @@ Inventory.StripPNG = function(item) return item end +---This will remove the file extension from the item name if present. +---example: "item.webp" will become "item" +---@param item string +---@return string Inventory.StripWebp = function(item) if string.find(item, ".webp") then item = string.gsub(item, ".webp", "") diff --git a/modules/inventory/_default/server.lua b/modules/inventory/_default/server.lua index 6278594..ccc4df1 100644 --- a/modules/inventory/_default/server.lua +++ b/modules/inventory/_default/server.lua @@ -193,6 +193,17 @@ Inventory.StripPNG = function(item) return item end +---This will remove the file extension from the item name if present. +---example: "item.webp" will become "item" +---@param item string +---@return string +Inventory.StripWebp = function(item) + if string.find(item, ".webp") then + item = string.gsub(item, ".webp", "") + end + return item +end + Inventory.OpenPlayerInventory = function(src, targetSrc) return false, Prints.Error("OpenPlayerInventory is not implemented in this inventory, because of this we dont have a way to open a players inventory.") end diff --git a/modules/inventory/tgiann-inventory/client.lua b/modules/inventory/tgiann-inventory/client.lua index 5102a87..ad4c874 100644 --- a/modules/inventory/tgiann-inventory/client.lua +++ b/modules/inventory/tgiann-inventory/client.lua @@ -10,13 +10,14 @@ Inventory = Inventory or {} Inventory.GetItemInfo = function(item) local itemData = tgiann:GetItemList() if not itemData[item] then return {} end + itemData = itemData[item] return { name = itemData.name or "Missing Name", label = itemData.label or "Missing Label", stack = itemData.unique or "false", weight = itemData.weight or "0", description = itemData.description or "none", - image = itemData.image or Inventory.GetImagePath(item), + image = Inventory.GetImagePath(item), } end @@ -41,9 +42,9 @@ end Inventory.GetImagePath = function(item) local pngItem = Inventory.StripPNG(item) local webpItem = Inventory.StripWebp(item) - local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", pngItem)) - local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", webpItem)) - local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", pngItem) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", webpItem) + local pngPath = LoadResourceFile("inventory_images", string.format("/images/%s.png", pngItem)) + local webpPath = LoadResourceFile("inventory_images", string.format("/images/%s.webp", webpItem)) + local imagePath = pngPath and string.format("nui://inventory_images/images/%s.png", pngItem) or webpPath and string.format("nui://inventory_images/images/%s.webp", webpItem) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end diff --git a/modules/inventory/tgiann-inventory/server.lua b/modules/inventory/tgiann-inventory/server.lua index fadb24c..d2613ab 100644 --- a/modules/inventory/tgiann-inventory/server.lua +++ b/modules/inventory/tgiann-inventory/server.lua @@ -200,18 +200,18 @@ Inventory.ClearStash = function(id, _type) return true end ----This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus) +---This will get the image path for this item, if not found will return placeholder. ---@param item string ---@return string Inventory.GetImagePath = function(item) - item = Inventory.StripPNG(item) - local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item)) - local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item)) - local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item) + local pngItem = Inventory.StripPNG(item) + local webpItem = Inventory.StripWebp(item) + local pngPath = LoadResourceFile("inventory_images", string.format("/images/%s.png", pngItem)) + local webpPath = LoadResourceFile("inventory_images", string.format("/images/%s.webp", webpItem)) + local imagePath = pngPath and string.format("nui://inventory_images/images/%s.png", pngItem) or webpPath and string.format("nui://inventory_images/images/%s.webp", webpItem) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end - ---UNUSED: ---This will return generic item data from the specified inventory, with the items total count. --- From 4d6958aa86614ab91311770268fc5daac62c84ed Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Mon, 4 Aug 2025 01:32:30 -0400 Subject: [PATCH 25/54] community_bridge:Server:OnPlayerJobChange job change serverside event --- modules/framework/es_extended/server.lua | 6 ++++++ modules/framework/qb-core/server.lua | 6 ++++++ modules/framework/qbx_core/server.lua | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/modules/framework/es_extended/server.lua b/modules/framework/es_extended/server.lua index 8920d36..0652bf7 100644 --- a/modules/framework/es_extended/server.lua +++ b/modules/framework/es_extended/server.lua @@ -474,6 +474,12 @@ RegisterNetEvent("esx:playerLogout", function(src) TriggerEvent("community_bridge:Server:OnPlayerUnload", src) end) +RegisterNetEvent("esx:setJob", function(src, job, lastJob) + src = src or source + if not job or not lastJob then return end + TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name) +end) + AddEventHandler("playerDropped", function() local src = source TriggerEvent("community_bridge:Server:OnPlayerUnload", src) diff --git a/modules/framework/qb-core/server.lua b/modules/framework/qb-core/server.lua index 95f71b7..885abbb 100644 --- a/modules/framework/qb-core/server.lua +++ b/modules/framework/qb-core/server.lua @@ -572,6 +572,12 @@ RegisterNetEvent("QBCore:Server:OnPlayerUnload", function(src) TriggerEvent("community_bridge:Server:OnPlayerUnload", src) end) +RegisterNetEvent("QBCore:Server:OnJobUpdate", function(src, job) + src = src or source + if not job then return end + TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name) +end) + AddEventHandler("playerDropped", function() local src = source TriggerEvent("community_bridge:Server:OnPlayerUnload", src) diff --git a/modules/framework/qbx_core/server.lua b/modules/framework/qbx_core/server.lua index af425b8..d7b37a4 100644 --- a/modules/framework/qbx_core/server.lua +++ b/modules/framework/qbx_core/server.lua @@ -481,6 +481,12 @@ RegisterNetEvent("QBCore:Server:OnPlayerUnload", function(src) TriggerEvent("community_bridge:Server:OnPlayerUnload", src) end) +RegisterNetEvent("QBCore:Server:OnJobUpdate", function(src, job) + src = src or source + if not job then return end + TriggerEvent("community_bridge:Server:OnPlayerJobChange", src, job.name) +end) + AddEventHandler("playerDropped", function() local src = source TriggerEvent("community_bridge:Server:OnPlayerUnload", src) From d8f15990524d325e22c85e4a0f67be627c460067 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 5 Aug 2025 00:01:32 -0400 Subject: [PATCH 26/54] Update points.lua --- lib/points/client/points.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/points/client/points.lua b/lib/points/client/points.lua index 06f9769..10d3207 100644 --- a/lib/points/client/points.lua +++ b/lib/points/client/points.lua @@ -154,9 +154,9 @@ function Point.StartLoop() insidePoints[point.id] = nil end - if point.onNearby then - point.onNearby(GridCells[cellKey]?.points, waitTime) - end + -- if point.onNearby then + -- point.onNearby(GridCells[cellKey]?.points, waitTime) + -- end end end end From e1a43ed9184b467dca096c71db43960a44a591c7 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 5 Aug 2025 15:55:49 -0400 Subject: [PATCH 27/54] Restore original version checker for compatibility; refactor export logic with reduced variable passing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Reinstated the original version checker to maintain compatibility. - Reworked the export approach: the new export method and the legacy one are now split rather than merged. - Patch‑note data is handled separately, as seen in the example structure at resources.json (e.g. https://github.com/MrNewb/patchnotes/blob/main/resources.json). - Minimized variable passing by leveraging JSON template references directly, reducing redundancy. --- modules/version/server/VersionChecker.lua | 144 +++++++++++----------- 1 file changed, 73 insertions(+), 71 deletions(-) diff --git a/modules/version/server/VersionChecker.lua b/modules/version/server/VersionChecker.lua index 0c2cb54..bf83fa0 100644 --- a/modules/version/server/VersionChecker.lua +++ b/modules/version/server/VersionChecker.lua @@ -1,9 +1,13 @@ Version = Version or {} -local function padVersion(v) +local function parseVersion(versionString) + return versionString and versionString:match('%d+%.%d+%.%d+') or versionString +end + +local function padVersion(version) local parts = {} - for n in v:gmatch("%d+") do - table.insert(parts, tonumber(n)) + for num in version:gmatch("%d+") do + table.insert(parts, tonumber(num)) end while #parts < 3 do table.insert(parts, 0) @@ -23,26 +27,17 @@ local function compareVersions(v1, v2) return 0 end -local function parseVersion(versionString) - return versionString:match('%d+%.%d+%.%d+') or versionString -end - -local function buildGithubApiUrl(repoPath) - local username, reponame = repoPath:match("([^/]+)/([^/]+)") - return ('https://api.github.com/repos/%s/%s/releases/latest'):format(username, reponame) -end - local function buildPatchNotesUrl(branch, repoPath) local username, reponame = repoPath:match("([^/]+)/([^/]+)") return ('https://raw.githubusercontent.com/%s/%s/%s/resources.json'):format(username, reponame, branch) end -local function getDownloadUrl(repoPath, tebex, actualRepoPath) - if tebex then +local function getDownloadUrl(repoPath, isTebex, actualRepoPath) + if isTebex then return "https://portal.cfx.re/assets/granted-assets" - elseif actualRepoPath and actualRepoPath ~= false then - local repoUser, repoName = actualRepoPath:match("([^/]+)/([^/]+)") - if repoUser and repoName then return ('https://github.com/%s/%s/releases/latest'):format(repoUser, repoName) end + elseif actualRepoPath then + local username, reponame = actualRepoPath:match("([^/]+)/([^/]+)") + if username and reponame then return ('https://github.com/%s/%s/releases/latest'):format(username, reponame) end end return nil end @@ -61,8 +56,20 @@ local function printPatchNotes(notesToPrint) end end -local function printError(message) - print(('^1[ERROR]^7 %s'):format(message)) +local function validateRepoPath(repoPath) + local username, reponame = repoPath:match("([^/]+)/([^/]+)") + if not username or not reponame then return false, print('Invalid repository format. Expected format: username/reponame') end + return true, username, reponame +end + +local function getLocalVersion(resource) + local localVersionRaw = GetResourceMetadata(resource, "version", 0) + if not localVersionRaw then + return nil, print('No version metadata found for resource "%s". Ensure fxmanifest.lua contains a valid version string.'):format(resource) + end + local version = parseVersion(localVersionRaw) + if not version then return nil, print('Invalid version format for resource "%s". Expected format: "x.x.x"'):format(resource) end + return version end local function processVersions(allVersions, localVersion) @@ -81,7 +88,7 @@ local function processVersions(allVersions, localVersion) return notesToPrint end -local function fetchPatchNotes(branch, resource, repoPath, localVersion, tebex, actualRepoPath) +local function fetchPatchNotes(branch, resource, repoPath, localVersion) local url = buildPatchNotesUrl(branch, repoPath) PerformHttpRequest(url, function(noteStatus, noteBody) @@ -89,78 +96,73 @@ local function fetchPatchNotes(branch, resource, repoPath, localVersion, tebex, local patchData = json.decode(noteBody) if not patchData then return end - local allVersions = patchData[resource] - if allVersions and type(allVersions) == "table" then + local resourceData = patchData[resource] + if resourceData and type(resourceData) == "table" then + local actualRepoPath = resourceData.repo or resourceData.actualRepoPath + local isTebex = not actualRepoPath -- If no repo path, it's Tebex + local allVersions = resourceData.versions or resourceData -- Support both new and old format local notesToPrint = processVersions(allVersions, localVersion) if #notesToPrint > 0 then - local downloadUrl = getDownloadUrl(repoPath, tebex, actualRepoPath) or url + local downloadUrl = getDownloadUrl(repoPath, isTebex, actualRepoPath) or url printUpdateAvailable(resource, localVersion, downloadUrl) printPatchNotes(notesToPrint) end end elseif branch == "main" then - fetchPatchNotes("master", resource, repoPath, localVersion, tebex, actualRepoPath) + -- Fallback to master branch if main doesn't exist + fetchPatchNotes("master", resource, repoPath, localVersion) end end, 'GET') end -local function checkSimpleUpdate(repoPath, resource, localVersion, isTebex) - local url = buildGithubApiUrl(repoPath) - - PerformHttpRequest(url, function(status, response) - if status ~= 200 then return end - - local latest = parseVersion(json.decode(response).tag_name) - if not latest or latest == localVersion or localVersion:gsub('%D', '') >= latest:gsub('%D', '') then - return - end - - local downloadUrl = isTebex and "https://portal.cfx.re/assets/granted-assets" or json.decode(response).html_url - printUpdateAvailable(resource, localVersion, downloadUrl) - end, 'GET') -end - -local function validateRepoPath(repoPath) +--- Pass a github username and repo name to check for the latest version of the resource. +--- Tebex is a optional boolean to determine if the message should be for a escrowed resource or not. +--- Example: Version.VersionChecker("TheOrderFivem/community_bridge", false) +--- @param repoPath string +--- @param tebex boolean | nil +--- @return nil +function Version.VersionChecker(repoPath, tebex) local username, reponame = repoPath:match("([^/]+)/([^/]+)") - if not username or not reponame then - return false, 'Invalid repository format. Expected format: "username/reponame"' - end - return true, username, reponame + local resource = reponame and repoPath:match("([^/]+)$") + if not username or not reponame or not resource then return print('^1Invalid repository format. Expected format: "username/reponame"^0') end + + local version = GetResourceMetadata(resource, "version", 0) + if not version then return end + + version = version:match('%d+%.%d+%.%d+') + if not version then return end + + PerformHttpRequest(('https://api.github.com/repos/%s/%s/releases/latest'):format(username, reponame), + function(status, response) + if status ~= 200 then return end + local latest = json.decode(response).tag_name:match('%d+%.%d+%.%d+') + if not latest or latest == version or version:gsub('%D', '') >= latest:gsub('%D', '') then return end + + local url = tebex and "https://portal.cfx.re/assets/granted-assets" or json.decode(response).html_url + print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from %s^7'):format(resource, version, url)) + end, + 'GET') end -local function getLocalVersion(resource) - local localVersionRaw = GetResourceMetadata(resource, "version", 0) - if not localVersionRaw then - return nil, ('No version metadata found for resource "%s". Ensure fxmanifest.lua contains a valid version string.'):format(resource) - end - return parseVersion(localVersionRaw) -end - ---- Checks for updates to a resource by comparing the local version (from fxmanifest.lua) with the latest release on GitHub, and optionally prints patch notes if using the template. ---- Example - Version.VersionChecker("TheOrderFivem/patchnotes", true, true, "community_bridge", "TheOrderFivem/community_bridge") ----@param repoPath string ----@param isTebex boolean ----@param showPatchNotes boolean ----@param actualResourceName string ----@param actualRepoPathIfGithub string this is the githubAccount/repoName if the resource is hosted on github, otherwise it will use the repoPath initially passed, this is not needed for tebex = true ----@return nil -function Version.VersionChecker(repoPath, isTebex, showPatchNotes, actualResourceName, actualRepoPathIfGithub) +--- Advanced version checker with patch notes support +--- Reads Tebex information and repo path directly from the resources.json file +--- @param repoPath string GitHub repository path for patch notes in format "username/reponame" +--- @param resourceName string The actual resource name to check +--- @return nil +function Version.AdvancedVersionChecker(repoPath, resourceName) local isValid, username, reponame = validateRepoPath(repoPath) - if not isValid then return printError(username) end + if not isValid then return print(('^1[ERROR]^7 %s'):format(username)) end - local resource = actualResourceName or reponame + local resource = resourceName local localVersion, errorMsg = getLocalVersion(resource) - if not localVersion then return printError(errorMsg) end - - if not showPatchNotes then return checkSimpleUpdate(repoPath, resource, localVersion, isTebex) end - - fetchPatchNotes("main", resource, repoPath, localVersion, isTebex, actualRepoPathIfGithub) + if not localVersion then return print(('^1[ERROR]^7 %s'):format(username)) end + fetchPatchNotes("main", resource, repoPath, localVersion) end AddEventHandler('onResourceStart', function(resourceName) if GetCurrentResourceName() ~= resourceName then return end - Version.VersionChecker("TheOrderFivem/patchnotes", false, true, "community_bridge", "TheOrderFivem/community_bridge") + Version.AdvancedVersionChecker("TheOrderFivem/patchnotes", resourceName) end) -return Version +return Version \ No newline at end of file From d0f9fb7ca3c2580a55c475b67599a1e68d0b2c74 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 5 Aug 2025 16:05:47 -0400 Subject: [PATCH 28/54] Update VersionChecker.lua comment out old --- modules/version/server/VersionChecker.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/version/server/VersionChecker.lua b/modules/version/server/VersionChecker.lua index bf83fa0..afcb88c 100644 --- a/modules/version/server/VersionChecker.lua +++ b/modules/version/server/VersionChecker.lua @@ -162,6 +162,7 @@ end AddEventHandler('onResourceStart', function(resourceName) if GetCurrentResourceName() ~= resourceName then return end + -- Version.VersionChecker("TheOrderFivem/community_bridge", false) Version.AdvancedVersionChecker("TheOrderFivem/patchnotes", resourceName) end) From 140bad5b3491527e1e6aa7d0f234085da09172b0 Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Tue, 5 Aug 2025 20:57:26 -0500 Subject: [PATCH 29/54] made woopsie to entities --- lib/entities/client/client_entity.lua | 21 ++++--- lib/logs/server/logs.lua | 48 ++++++++++++++ lib/placers/client/placeable_object.lua | 83 +++++++++++++------------ locales/en.json | 4 +- modules/menu/ox_lib/client.lua | 22 ++++++- modules/target/ox_target/client.lua | 1 + 6 files changed, 130 insertions(+), 49 deletions(-) diff --git a/lib/entities/client/client_entity.lua b/lib/entities/client/client_entity.lua index 4d6e24f..9a8a754 100644 --- a/lib/entities/client/client_entity.lua +++ b/lib/entities/client/client_entity.lua @@ -45,19 +45,26 @@ local function SpawnEntity(entityData) end end -local function RemoveEntity(entityData, skip) +local function RemoveEntity(entityData) + print(string.format("[ClientEntity] Removing entity %s", entityData.id)) entityData = entityData and entityData.args or entityData if not entityData then return end - ClientEntityActions.StopAction(entityData.id) + -- ClientEntityActions.StopAction(entityData.id) + print(string.format("[ClientEntity] Stopping actions for entity %s", entityData.id, entityData.OnRemove)) + for k, v in pairs(entityData) do + print(string.format("RemoveEntity %s", k)) + end + print(json.encode(skip)) + if entityData.OnRemove then + print(string.format("[ClientEntity] Calling OnRemove for entity %s", entityData.id)) + entityData.OnRemove(entityData) + end if entityData.spawned and DoesEntityExist(entityData.spawned) then local entityHandle = entityData.spawned entityData.spawned = nil SetEntityAsMissionEntity(entityHandle, false, false) DeleteEntity(entityHandle) - end - if not skip and entityData.OnRemove then - entityData.OnRemove(entityData) - end + end end --- Registers an entity received from the server and sets up proximity spawning. @@ -239,7 +246,7 @@ AddEventHandler('onResourceStop', function(resourceName) if resourceName == GetCurrentResourceName() then for id, entityData in pairs(Entities) do Point.Remove(id) -- Clean up point registration - RemoveEntity(entityData, true) -- Clean up spawned game entity + RemoveEntity(entityData) -- Clean up spawned game entity end Entities = {} -- Clear local cache end diff --git a/lib/logs/server/logs.lua b/lib/logs/server/logs.lua index ec4a92b..c947446 100644 --- a/lib/logs/server/logs.lua +++ b/lib/logs/server/logs.lua @@ -55,5 +55,53 @@ Logs.Send = function(src, message) end end +Logs.Notify = function(src, url, image, message) + if not src or not message then return end + local logType = LogSystem or "built-in" + if logType == "built-in" then + local firstName, lastName = Framework.GetPlayerName(src) + PerformHttpRequest(url, function(err, text, headers) end, 'POST', json.encode( + { + username = string.format("%s %s", firstName, lastName), + avatar_url = image or 'https://avatars.githubusercontent.com/u/192999457?s=400&u=da632e8f64c85def390cfd1a73c3b664d6882b38&v=4', + embeds = { + { + color = "15769093", + title = GetInvokingResource(), + -- url = 'https://discord.gg/Gm6rYEXUsn', + thumbnail = { url = LogoForEmbed }, + fields = { + { + name = '**Player ID**', + value = src, + inline = true, + }, + { + name = '**Player Identifier**', + value = Framework.GetPlayerIdentifier(src), + inline = true, + }, + { + name = 'Log Message', + value = "```"..message.."```", + inline = false, + }, + }, + timestamp = os.date('!%Y-%m-%dT%H:%M:%S'), + footer = { + text = "Community_Bridge | ", + icon_url = 'https://avatars.githubusercontent.com/u/192999457?s=400&u=da632e8f64c85def390cfd1a73c3b664d6882b38&v=4', + }, + } + } + }), { ['Content-Type']= 'application/json' }) + elseif logType == "qb" then + return TriggerEvent('qb-log:server:CreateLog', GetCurrentResourceName(), GetCurrentResourceName(), 'green', message) + elseif logType == "ox_lib" then + return lib.logger(src, GetCurrentResourceName(), message) + end +end + + exports('Logs', Logs) return Logs diff --git a/lib/placers/client/placeable_object.lua b/lib/placers/client/placeable_object.lua index ccfc6d9..46064d1 100644 --- a/lib/placers/client/placeable_object.lua +++ b/lib/placers/client/placeable_object.lua @@ -12,7 +12,7 @@ RegisterKeyMapping('+rotate_left', locale('placeable_object.rotate_left'), 'keyb RegisterKeyMapping('+rotate_right', locale('placeable_object.rotate_right'), 'keyboard', 'RIGHT') RegisterKeyMapping('+scroll_up', locale('placeable_object.object_scroll_up'), 'mouse_wheel', 'IOM_WHEEL_UP') RegisterKeyMapping('+scroll_down', locale('placeable_object.object_scroll_down'), 'mouse_wheel', 'IOM_WHEEL_DOWN') -RegisterKeyMapping('+depth_modifier', locale('placeable_object.depth_modifier'), 'keyboard', 'LCONTROL') +RegisterKeyMapping('+depth_modifier', locale('placeable_object.depth_modifier'), 'keyboard', 'LCONTROL') local state = { isPlacing = false, @@ -44,6 +44,15 @@ local state = { } } +local placementText = { + string.format(locale('placeable_object.object_place'), Utility.GetCommandKey('+place_object')), + string.format(locale('placeable_object.object_cancel'), Utility.GetCommandKey('+cancel_placement')), + string.format(locale('placeable_object.rotate_clockwise'), Utility.GetCommandKey('+scroll_up')), + string.format(locale('placeable_object.rotate_counter_clockwise'), Utility.GetCommandKey('+scroll_down')), + string.format(locale('placeable_object.depth_modifier'), Utility.GetCommandKey('+depth_modifier')) + +} + -- Command handlers for key mappings RegisterCommand('+place_object', function() if state.isPlacing then @@ -554,15 +563,14 @@ local function placementLoop() state.keys.placeObject = false -- Reset the key state local canPlace = checkMaterialAndBoundary() if canPlace then - Wait(100) local coords = GetEntityCoords(state.currentEntity) - if not state.settings.allowVertical or state.snapToGround then - local groundZ, _z = GetGroundZFor_3dCoord(coords.x, coords.y, coords.z + 50, false) - if groundZ then - coords = vector3(coords.x, coords.y, _z) - end - end - + -- if not state.settings.allowVertical or state.snapToGround then + -- local groundZ, _z = GetGroundZFor_3dCoord(coords.x, coords.y, coords.z + 50, false) + -- if groundZ then + + -- end + -- end + coords = vector3(coords.x, coords.y, coords.z - 0.2) -- Adjust Z to ground level local rotation = GetEntityRotation(state.currentEntity) if state.promise then state.promise:resolve({ @@ -616,15 +624,15 @@ local function placementLoop() end -- Show help text for placement controls - local placementText = { - string.format(locale('placeable_object.place_object_place'), Bridge.Utility.GetCommandKey('+place_object')), - string.format(locale('placeable_object.place_object_cancel'), Bridge.Utility.GetCommandKey('+cancel_placement')), - -- string.format(locale('placeable_object.rotate_left'), Bridge.Utility.GetCommandKey('+rotate_left')), - -- string.format(locale('placeable_object.rotate_right'), Bridge.Utility.GetCommandKey('+rotate_right')), - string.format(locale('placeable_object.place_object_scroll_up'), Bridge.Utility.GetCommandKey('+scroll_up')), - string.format(locale('placeable_object.place_object_scroll_down'), Bridge.Utility.GetCommandKey('+scroll_down')), - string.format(locale('placeable_object.depth_modifier'), Bridge.Utility.GetCommandKey('+depth_modifier')) - } + -- local placementText = { + -- string.format(locale('placeable_object.place_object_place'), Bridge.Utility.GetCommandKey('+place_object')), + -- string.format(locale('placeable_object.place_object_cancel'), Bridge.Utility.GetCommandKey('+cancel_placement')), + -- -- string.format(locale('placeable_object.rotate_left'), Bridge.Utility.GetCommandKey('+rotate_left')), + -- -- string.format(locale('placeable_object.rotate_right'), Bridge.Utility.GetCommandKey('+rotate_right')), + -- string.format(locale('placeable_object.place_object_scroll_up'), Bridge.Utility.GetCommandKey('+scroll_up')), + -- string.format(locale('placeable_object.place_object_scroll_down'), Bridge.Utility.GetCommandKey('+scroll_down')), + -- string.format(locale('placeable_object.depth_modifier'), Bridge.Utility.GetCommandKey('+depth_modifier')) + -- } Bridge.Notify.ShowHelpText(type(placementText) == 'table' and table.concat(placementText)) -- -- Draw entity bounding box @@ -644,18 +652,24 @@ end ---@param model - Model name or hash ---@param settings - Configuration table: --[[ - depth (3.0): Starting distance from player, - allowVertical (false): Enable height controls, - allowMovement (false): Enable WASD mode, - disableSphere (false): Hide position indicator, - boundary: Area restriction {min = vector3(), max = vector3()}, - allowedMats: Surface materials {"concrete", "grass"}, - depthStep (0.1): Step size for depth adjustment, - rotationStep (0.5): Step size for rotation, - heightStep (0.5): Step size for height adjustment, - movementStep (0.1): Step size for normal movement, - movementStepFast (0.5): Step size for fast movement (with shift), - maxDepth (50.0): Maximum distance from player, + { + depth = 3.0, -- Starting distance from player + allowVertical = false, -- Enable height controls (Q/E, Alt to toggle ground snap) + allowMovement = false, -- Enable WASD movement mode + allowNormal = false, -- Allow switching back to normal mode from movement + disableSphere = false, -- Hide position indicator sphere + drawBoundary = false, -- Draw boundary box/polygon + drawInBoundary = false, -- Draw entity outline (green/red) based on boundary/material + boundary = nil, -- Area restriction (box: {min=vector3(), max=vector3()}, polygon: {points={...}, minZ, maxZ}) + allowedMats = nil, -- Allowed surface materials (e.g. {"concrete", "grass"}) + customCheck = nil, -- Custom function(pos, entity, settings) -> bool + depthStep = 0.1, -- Step size for depth adjustment (scroll + modifier) + rotationStep = 0.5, -- Step size for rotation (scroll) + heightStep = 0.5, -- Step size for height adjustment (Q/E) + movementStep = 0.1, -- Step size for WASD movement + movementStepFast = 0.5, -- Step size for fast movement (WASD + Shift) + maxDepth = 5.0, -- Maximum distance from player + } --]] ---@returns Promise with: {entity, coords, heading, placed, cancelled} --[[ @@ -724,15 +738,6 @@ function PlaceableObject.Create(model, settings) state.isPlacing = true -- Show help text for placement controls - local placementText = { - string.format(locale('placeable_object.place_object_place'), Bridge.Utility.GetCommandKey('+place_object')), - string.format(locale('placeable_object.place_object_cancel'), Bridge.Utility.GetCommandKey('+cancel_placement')), - -- string.format(locale('placeable_object.rotate_left'), Bridge.Utility.GetCommandKey('+rotate_left')), - -- string.format(locale('placeable_object.rotate_right'), Bridge.Utility.GetCommandKey('+rotate_right')), - string.format(locale('placeable_object.place_object_scroll_up'), Bridge.Utility.GetCommandKey('+scroll_up')), - string.format(locale('placeable_object.place_object_scroll_down'), Bridge.Utility.GetCommandKey('+scroll_down')), - string.format(locale('placeable_object.depth_modifier'), Bridge.Utility.GetCommandKey('+depth_modifier')) - } Bridge.Notify.ShowHelpText(type(placementText) == 'table' and table.concat(placementText)) placementLoop() diff --git a/locales/en.json b/locales/en.json index a29e42d..e7d0781 100644 --- a/locales/en.json +++ b/locales/en.json @@ -30,8 +30,8 @@ "place_object_scroll_down": "[Scroll Down] Turn left \n", "object_place": "[%s] Place \n", "object_cancel": "[%s] Cancel \n", - "object_scroll_up": "[%s] Turn right \n", - "object_scroll_down": "[%s] Turn left \n", + "rotate_clockwise": "[%s] Rotate Clockwise \n", + "rotate_counter_clockwise": "[%s] Rotate Counter-Clockwise \n", "depth_modifier": "[%s] Depth Control Modifier \n" } } \ No newline at end of file diff --git a/modules/menu/ox_lib/client.lua b/modules/menu/ox_lib/client.lua index 5e097f1..6b65140 100644 --- a/modules/menu/ox_lib/client.lua +++ b/modules/menu/ox_lib/client.lua @@ -55,4 +55,24 @@ end GetMenuResourceName = function() return resourceName -end \ No newline at end of file +end + + +-- RegisterCommand('menutest', function() +-- local test1 = function() +-- print("Test 1 executed") +-- end + +-- Bridge.Menu.Open({ +-- title = "test", +-- description = "test", +-- options = { +-- { +-- title = "test", +-- description = "test", +-- icon = "fas fa-box-open", +-- onSelect = test1 +-- }, +-- } +-- }) +-- end) \ No newline at end of file diff --git a/modules/target/ox_target/client.lua b/modules/target/ox_target/client.lua index 7211e39..28551ed 100644 --- a/modules/target/ox_target/client.lua +++ b/modules/target/ox_target/client.lua @@ -40,6 +40,7 @@ Target.FixOptions = function(options) end v.groups = v.job or v.groups + -- print(json.encode(v)) end return options end From b1556d13fb9d29ae9d9317ce200ffb257161ddd3 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Thu, 7 Aug 2025 00:47:51 -0400 Subject: [PATCH 30/54] draft GetPlayerSourcesByJob --- modules/framework/_default/server.lua | 53 ++++++++++++++++++++++++ modules/framework/es_extended/server.lua | 14 ++----- modules/framework/qb-core/server.lua | 12 +----- modules/framework/qbx_core/server.lua | 11 +---- 4 files changed, 60 insertions(+), 30 deletions(-) diff --git a/modules/framework/_default/server.lua b/modules/framework/_default/server.lua index 5d895be..0cedf7c 100644 --- a/modules/framework/_default/server.lua +++ b/modules/framework/_default/server.lua @@ -1,3 +1,56 @@ Framework = Framework or {} +local jobsRegisteredTable = {} +local invertedJobsRegisteredTable = {} + +---This is an internal function that will be used to retrieve job counts later. +---@param jobName string +---@return number +Framework.GetJobCount = function(jobName) + return #jobsRegisteredTable[jobName] or 0 +end + +---This will return a list of player sources for a given job. +---@param jobName string +---@return table +Framework.GetPlayerSourcesByJob = function(jobName) + if not jobsRegisteredTable[jobName] then return {} end + return jobsRegisteredTable[jobName] +end + +---This will update the cached tables for job counts. +---This is used to track how many players are in a job. +---@param src number +---@param jobName string +Framework.AddJobCount = function(src, jobName) + if not jobsRegisteredTable[jobName] then jobsRegisteredTable[jobName] = {} end + if jobsRegisteredTable[jobName][src] then return false end + jobsRegisteredTable[jobName][src] = true + invertedJobsRegisteredTable[src] = jobName + return true, #jobsRegisteredTable[jobName] +end + +---This will return the job name for a given source. +---This is an internal function that will be used to retrieve job names in situations where player data is unavailable. +---@param src number +Framework.SearchJobCountBySource = function(src) + if not invertedJobsRegisteredTable[src] then return nil end + return invertedJobsRegisteredTable[src] +end + +---This will remove the job count for a given source. +---@param src number +---@param jobName string | nil +Framework.RemoveJobCount = function(src, jobName) + if not jobName then + jobName = Framework.SearchJobCountBySource(src) + end + if not jobName then return false end + if not jobsRegisteredTable[jobName] then return false end + if not jobsRegisteredTable[jobName][src] then return false end + invertedJobsRegisteredTable[src] = nil + jobsRegisteredTable[jobName][src] = nil + return true, #jobsRegisteredTable[jobName] +end + return Framework \ No newline at end of file diff --git a/modules/framework/es_extended/server.lua b/modules/framework/es_extended/server.lua index 0652bf7..c38d242 100644 --- a/modules/framework/es_extended/server.lua +++ b/modules/framework/es_extended/server.lua @@ -336,18 +336,10 @@ Framework.SetPlayerDuty = function(src, status) end ---This will get a table of player sources that have the specified job name. ----@param job any +---@param job string ---@return table Framework.GetPlayersByJob = function(job) - local players = GetPlayers() - local playerList = {} - for _, src in pairs(players) do - local xPlayer = Framework.GetPlayer(src) - if xPlayer and xPlayer.getJob().name == job then - table.insert(playerList, src) - end - end - return playerList + return Framework.GetPlayerSourcesByJob(job) or {} end -- Sets the player's job to the specified name and grade. @@ -363,7 +355,7 @@ Framework.SetPlayerJob = function(src, name, grade) return end xPlayer.setJob(name, grade, true) - return true + return true end ---This will add money based on the type of account (money/bank) diff --git a/modules/framework/qb-core/server.lua b/modules/framework/qb-core/server.lua index 885abbb..6b8049f 100644 --- a/modules/framework/qb-core/server.lua +++ b/modules/framework/qb-core/server.lua @@ -361,18 +361,10 @@ Framework.GetPlayerGang = function(src) end ---This will get a table of player sources that have the specified job name. ----@param job any +---@param job string ---@return table Framework.GetPlayersByJob = function(job) - local playerList = {} - local players = QBCore.Functions.GetPlayers() - for _, src in pairs(players) do - local player = Framework.GetPlayer(src).PlayerData - if player.job.name == job then - table.insert(playerList, src) - end - end - return playerList + return Framework.GetPlayerSourcesByJob(job) or {} end ---Depricated: Returns the job name, label, grade name, and grade level of the player. diff --git a/modules/framework/qbx_core/server.lua b/modules/framework/qbx_core/server.lua index d7b37a4..47a1ce2 100644 --- a/modules/framework/qbx_core/server.lua +++ b/modules/framework/qbx_core/server.lua @@ -286,18 +286,11 @@ Framework.GetPlayerGang = function(src) return player.gang.name end ----This will return a table of all players with the specified job. +---This will get a table of player sources that have the specified job name. ---@param job string ---@return table Framework.GetPlayersByJob = function(job) - local playerList = {} - local players = QBox:GetQBPlayers() - for src, player in pairs(players) do - if player.PlayerData.job.name == job then - table.insert(playerList, src) - end - end - return playerList + return Framework.GetPlayerSourcesByJob(job) or {} end ---Depricated: Returns the job name, label, grade name, and grade level of the player. From a63837bd1fab92efb463a4766ecf809e0d755e4d Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Thu, 7 Aug 2025 01:50:50 -0400 Subject: [PATCH 31/54] Refactored model/anim checks, utility functions, and text rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified EnsureModelLoaded to skip validation and request loops if the model is already loaded Condensed SafeAddBlip, SafeRemoveBlip, etc. into dedicated utility functions Removed AddTextEntryOnce and SafeAddTextEntry — native existence checks were redundant Replaced repetitive table inserts with keyed tables using tostring(number) to avoid unnecessary loops Added HasAnimDictLoaded check to RequestAnimDict to prevent redundant request loops Introduced FloatingHelpText in utilities (aesthetic improvement) Updated DrawText: replaced outdated logic, switched 1 to true for clarity/preference --- lib/utility/client/utility.lua | 178 ++++++++++++--------------------- 1 file changed, 62 insertions(+), 116 deletions(-) diff --git a/lib/utility/client/utility.lua b/lib/utility/client/utility.lua index 9808f49..8bc0562 100644 --- a/lib/utility/client/utility.lua +++ b/lib/utility/client/utility.lua @@ -1,12 +1,9 @@ ----@class Utility Utility = Utility or {} local blipIDs = {} local spawnedPeds = {} Locales = Locales or Require('modules/locales/shared.lua') --- === Local Helpers === - ---Get the hash of a model (string or number) ---@param model string|number ---@return number @@ -22,6 +19,7 @@ end ---@return boolean, number local function ensureModelLoaded(model) local hash = getModelHash(model) + if HasModelLoaded(hash) then return true, hash end if not IsModelValid(hash) and not IsModelInCdimage(hash) then return false, hash end RequestModel(hash) local count = 0 @@ -32,84 +30,6 @@ local function ensureModelLoaded(model) return HasModelLoaded(hash), hash end ----Add a text entry if possible ----@param key string ----@param text string -local function addTextEntryOnce(key, text) - if not AddTextEntry then return end - AddTextEntry(key, text) -end - ----Create a blip safely and store its reference ----@param coords vector3 ----@param sprite number ----@param color number ----@param scale number ----@param label string ----@param shortRange boolean ----@param displayType number ----@return number -local function safeAddBlip(coords, sprite, color, scale, label, shortRange, displayType) - local blip = AddBlipForCoord(coords.x, coords.y, coords.z) - SetBlipSprite(blip, sprite or 8) - SetBlipColour(blip, color or 3) - SetBlipScale(blip, scale or 0.8) - SetBlipDisplay(blip, displayType or 2) - SetBlipAsShortRange(blip, shortRange) - addTextEntryOnce(label, label) - BeginTextCommandSetBlipName(label) - EndTextCommandSetBlipName(blip) - table.insert(blipIDs, blip) - return blip -end - ----Create a entiyty blip safely and store its reference ----@param entity number ----@param sprite number ----@param color number ----@param scale number ----@param label string ----@param shortRange boolean ----@param displayType number ----@return number -local function safeAddEntityBlip(entity, sprite, color, scale, label, shortRange, displayType) - local blip = AddBlipForEntity(entity) - SetBlipSprite(blip, sprite or 8) - SetBlipColour(blip, color or 3) - SetBlipScale(blip, scale or 0.8) - SetBlipDisplay(blip, displayType or 2) - SetBlipAsShortRange(blip, shortRange) - ShowHeadingIndicatorOnBlip(blip, true) - addTextEntryOnce(label, label) - BeginTextCommandSetBlipName(label) - EndTextCommandSetBlipName(blip) - table.insert(blipIDs, blip) - return blip -end - ----Remove a blip safely from the stored list ----@param blip number ----@return boolean -local function safeRemoveBlip(blip) - for i, storedBlip in ipairs(blipIDs) do - if storedBlip == blip then - RemoveBlip(storedBlip) - table.remove(blipIDs, i) - return true - end - end - return false -end - ----Add a text entry if possible (shortcut) ----@param text string -local function safeAddTextEntry(text) - if not AddTextEntry then return end - AddTextEntry(text, text) -end - --- === Public Utility Functions === - ---Create a prop with the given model and coordinates ---@param model string|number ---@param coords vector3 @@ -147,11 +67,7 @@ function Utility.CreateVehicle(model, coords, heading, networked) SetVehicleNeedsToBeHotwired(vehicle, false) SetVehRadioStation(vehicle, "OFF") SetModelAsNoLongerNeeded(hash) - return vehicle, { - networkid = NetworkGetNetworkIdFromEntity(vehicle) or 0, - coords = GetEntityCoords(vehicle), - heading = GetEntityHeading(vehicle), - } + return vehicle, {networkid = NetworkGetNetworkIdFromEntity(vehicle) or 0,coords = GetEntityCoords(vehicle),heading = GetEntityHeading(vehicle),} end ---Create a ped with the given model and coordinates @@ -166,7 +82,7 @@ function Utility.CreatePed(model, coords, heading, networked, settings) if not loaded then return nil, Prints and Prints.Error and Prints.Error("Model Has Not Loaded") end local spawnedEntity = CreatePed(0, hash, coords.x, coords.y, coords.z, heading, networked, false) SetModelAsNoLongerNeeded(hash) - table.insert(spawnedPeds, spawnedEntity) + spawnedPeds[tostring(spawnedEntity)] = true return spawnedEntity end @@ -174,7 +90,7 @@ end ---@param text string ---@return boolean function Utility.StartBusySpinner(text) - safeAddTextEntry(text) + AddTextEntry(text, text) BeginTextCommandBusyString(text) AddTextComponentSubstringPlayerName(text) EndTextCommandBusyString(0) @@ -201,7 +117,17 @@ end ---@param displayType number ---@return number function Utility.CreateBlip(coords, sprite, color, scale, label, shortRange, displayType) - return safeAddBlip(coords, sprite, color, scale, label, shortRange, displayType) + local blip = AddBlipForCoord(coords.x, coords.y, coords.z) + SetBlipSprite(blip, sprite or 8) + SetBlipColour(blip, color or 3) + SetBlipScale(blip, scale or 0.8) + SetBlipDisplay(blip, displayType or 2) + SetBlipAsShortRange(blip, shortRange) + AddTextEntry(label, label) + BeginTextCommandSetBlipName(label) + EndTextCommandSetBlipName(blip) + blipIDs[tostring(blip)] = true + return blip end ---Create a blip on the provided entity @@ -214,14 +140,28 @@ end ---@param displayType number ---@return number function Utility.CreateEntityBlip(entity, sprite, color, scale, label, shortRange, displayType) - return safeAddEntityBlip(entity, sprite, color, scale, label, shortRange, displayType) + local blip = AddBlipForEntity(entity) + SetBlipSprite(blip, sprite or 8) + SetBlipColour(blip, color or 3) + SetBlipScale(blip, scale or 0.8) + SetBlipDisplay(blip, displayType or 2) + SetBlipAsShortRange(blip, shortRange) + ShowHeadingIndicatorOnBlip(blip, true) + AddTextEntry(label, label) + BeginTextCommandSetBlipName(label) + EndTextCommandSetBlipName(blip) + blipIDs[tostring(blip)] = true + return blip end ---Remove a blip if it exists ---@param blip number ---@return boolean function Utility.RemoveBlip(blip) - return safeRemoveBlip(blip) + if not blipIDs[tostring(blip)] then return false end + RemoveBlip(blip) + blipIDs[tostring(blip)] = nil + return true end ---Load a model into memory @@ -235,6 +175,7 @@ end ---@param dict string ---@return boolean function Utility.RequestAnimDict(dict) + if HasAnimDictLoaded(dict) then return true end RequestAnimDict(dict) local count = 0 while not HasAnimDictLoaded(dict) and count < 30000 do @@ -248,18 +189,12 @@ end ---@param entity number ---@return boolean function Utility.RemovePed(entity) - local success = false - if DoesEntityExist(entity) then - DeleteEntity(entity) - end - for i, storedEntity in ipairs(spawnedPeds) do - if storedEntity == entity then - table.remove(spawnedPeds, i) - success = true - break - end - end - return success + if not spawnedPeds[tostring(entity)] then return false end + spawnedPeds[tostring(entity)] = nil + if not DoesEntityExist(entity) then return false end + SetEntityAsMissionEntity(entity, true, true) + DeleteEntity(entity) + return true end ---Show a native input menu and return the result @@ -269,7 +204,7 @@ end function Utility.NativeInputMenu(text, length) local maxLength = Math and Math.Clamp and Math.Clamp(length, 1, 50) or math.min(math.max(length or 10, 1), 50) local menuText = text or 'enter text' - safeAddTextEntry(menuText) + AddTextEntry(menuText, menuText) DisplayOnscreenKeyboard(1, menuText, "", "", "", "", "", maxLength) while (UpdateOnscreenKeyboard() == 0) do DisableAllControlActions(0) @@ -315,7 +250,8 @@ function Utility.ReloadSkin() local ped = PlayerPedId() local skinData = Utility.GetEntitySkinData(ped) Utility.SetEntitySkinData(ped, skinData) - for _, props in pairs(GetGamePool("CObject")) do + local poolObject = GetGamePool("CObject") + for _, props in pairs(poolObject) do if IsEntityAttachedToEntity(ped, props) then SetEntityAsMissionEntity(props, true, true) DeleteObject(props) @@ -329,11 +265,23 @@ end ---@param text string ---@param duration number function Utility.HelpText(text, duration) - safeAddTextEntry(text) + AddTextEntry(text, text) BeginTextCommandDisplayHelp(text) EndTextCommandDisplayHelp(0, false, true, duration or 5000) end +---Show a floating help text in the world +---@param text string The text to show +---@param coords table The coords to show the message at +---@return nil +function Utility.FloatingHelpText(text, coords) + AddTextEntry("community_bridge_"..text, "community_bridge_"..text) + SetFloatingHelpTextWorldPosition(1, coords.x, coords.y, coords.z) + SetFloatingHelpTextStyle(1, 1, 2, -1, 3, 0) + BeginTextCommandDisplayHelp("community_bridge_"..text) + EndTextCommandDisplayHelp(2, false, false, -1) +end + ---Draw 3D help text in the world ---@param coords vector3 ---@param text string @@ -343,10 +291,10 @@ function Utility.Draw3DHelpText(coords, text, scale) if onScreen then SetTextScale(scale or 0.35, scale or 0.35) SetTextFont(4) - SetTextProportional(1) + SetTextProportional(true) SetTextColour(255, 255, 255, 215) SetTextEntry("STRING") - SetTextCentre(1) + SetTextCentre(true) AddTextComponentString(text) DrawText(x, y) local factor = (string.len(text)) / 370 @@ -357,7 +305,7 @@ end ---Show a native notification ---@param text string function Utility.NotifyText(text) - safeAddTextEntry(text) + AddTextEntry(text, text) SetNotificationTextEntry(text) DrawNotification(false, true) end @@ -376,9 +324,7 @@ function Utility.TeleportPlayer(coords, conditionFunction, afterTeleportFunction DoScreenFadeOut(2500) Wait(2500) SetEntityCoords(ped, coords.x, coords.y, coords.z, false, false, false, false) - if coords.w then - SetEntityHeading(ped, coords.w) - end + if coords.w then SetEntityHeading(ped, coords.w) end FreezeEntityPosition(ped, true) local count = 0 while not HasCollisionLoadedAroundEntity(ped) and count <= 30000 do @@ -627,13 +573,13 @@ end AddEventHandler('onResourceStop', function(resource) if resource ~= GetCurrentResourceName() then return end for _, blip in pairs(blipIDs) do - if blip and DoesBlipExist(blip) then - RemoveBlip(blip) + if blip and DoesBlipExist(tonumber(blip)) then + RemoveBlip(tonumber(blip)) end end for _, ped in pairs(spawnedPeds) do - if ped and DoesEntityExist(ped) then - DeleteEntity(ped) + if ped and DoesEntityExist(tonumber(ped)) then + DeleteEntity(tonumber(ped)) end end end) From 249f1c40324b850d49e9525208690ef4eae8add0 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Thu, 7 Aug 2025 02:19:20 -0400 Subject: [PATCH 32/54] Update server_entity.lua --- lib/entities/server/server_entity.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/entities/server/server_entity.lua b/lib/entities/server/server_entity.lua index a4a0827..e6784a8 100644 --- a/lib/entities/server/server_entity.lua +++ b/lib/entities/server/server_entity.lua @@ -29,7 +29,7 @@ end function ServerEntity.Create(id, entityType, model, coords, rotation, meta) local self = ServerEntity.New(id, entityType, model, coords, rotation, meta) if not self then - print("Failed to create entity with ID: " .. tostring(id)) + -- print("Failed to create entity with ID: " .. tostring(id)) return nil end TriggerClientEvent("community_bridge:client:CreateEntity", -1, self) @@ -68,7 +68,7 @@ end -- @param data table The data fields to update. function ServerEntity.Update(id, data) local entity = Entities[id] - print("Updating entity: ", id, entity) + -- print("Updating entity: ", id, entity) if not entity then return false end for key, value in pairs(data) do @@ -84,7 +84,7 @@ end -- @param actionName string The name of the action to trigger (must match a function in ClientEntityActions). -- @param ... any Additional arguments for the action function. function ServerEntity.TriggerAction(entityId, actionName, endPosition, ...) - print("Triggering action: ", entityId, actionName, ...) + -- print("Triggering action: ", entityId, actionName, ...) local entity = Entities[entityId] if not entity then print(string.format("[ServerEntity] Attempted to trigger action '%s' on non-existent entity %s", actionName, entityId)) From 4f9a4a06c8fe3e37939347a38086b8b3b68794ce Mon Sep 17 00:00:00 2001 From: randomz <41997047+RandomZFx@users.noreply.github.com> Date: Fri, 8 Aug 2025 23:47:13 -0500 Subject: [PATCH 33/54] Update server.lua Converted String amount to Number to ensure AddItem was properly working. (tested on live server item was not being given due to that issue) --- modules/shops/_default/server.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/shops/_default/server.lua b/modules/shops/_default/server.lua index c44b668..768bc5a 100644 --- a/modules/shops/_default/server.lua +++ b/modules/shops/_default/server.lua @@ -51,7 +51,7 @@ Shops.CompleteCheckout = function(src, shopName, item, amount, paymentType) local mathStuff = tonumber(itemData.price) * tonumber(amount) if balance < mathStuff then return Notify.SendNotify(src, ilocale('Shops.NotEnoughMoney'), "error", 5000) end if not Framework.RemoveAccountBalance(src, paymentType, mathStuff) then return end - Inventory.AddItem(src, itemData.name, amount) + Inventory.AddItem(src, itemData.name, tonumber(amount)) local itemLabel = Inventory.GetItemInfo(itemData.name).label Notify.SendNotify(src, ilocale('Shops.PurchasedItem')..itemLabel, "success", 5000) end @@ -63,4 +63,4 @@ RegisterNetEvent("community_bridge:completeCheckout", function(shopName, item, a Shops.CompleteCheckout(src, shopName, item, amount, paymentType) end) -return Shops \ No newline at end of file +return Shops From 35d18972e6418e4c2ce15f0571728d4cec5e37be Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 9 Aug 2025 23:40:27 -0400 Subject: [PATCH 34/54] Update points.lua --- lib/points/client/points.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/points/client/points.lua b/lib/points/client/points.lua index 10d3207..79d2d2f 100644 --- a/lib/points/client/points.lua +++ b/lib/points/client/points.lua @@ -11,7 +11,7 @@ local GRID_SIZE = 500.0 -- Size of each grid cell local CELL_BUFFER = 1 -- Number of adjacent cells to check -- Consider adding these optimizations -local ADAPTIVE_WAIT = true -- Adjust wait time based on player speed +local ADAPTIVE_WAIT = false -- Adjust wait time based on player speed ---This is an internal function, do not call this externally function Point.GetCellKey(coords) From af33909794b963c10d1e89be86067b48e946d2e0 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Mon, 11 Aug 2025 00:46:26 -0400 Subject: [PATCH 35/54] qs inv image path tweak --- modules/inventory/qs-inventory/client.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/inventory/qs-inventory/client.lua b/modules/inventory/qs-inventory/client.lua index b63fc9a..31775f2 100644 --- a/modules/inventory/qs-inventory/client.lua +++ b/modules/inventory/qs-inventory/client.lua @@ -18,7 +18,7 @@ Inventory.GetItemInfo = function(item) stack = itemData.unique or "false", weight = itemData.weight or "0", description = itemData.description or "none", - image = itemData.image or Inventory.GetImagePath(item), + image = Inventory.GetImagePath(item), } end From e30dceb540506134e6fe233ffaf68d2ef0cf986f Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 12 Aug 2025 18:08:49 -0400 Subject: [PATCH 36/54] CanCarryItem checks on additem --- modules/inventory/ox_inventory/server.lua | 1 + modules/inventory/qb-inventory/server.lua | 1 + modules/inventory/tgiann-inventory/server.lua | 1 + 3 files changed, 3 insertions(+) diff --git a/modules/inventory/ox_inventory/server.lua b/modules/inventory/ox_inventory/server.lua index 973cbd5..f4702b4 100644 --- a/modules/inventory/ox_inventory/server.lua +++ b/modules/inventory/ox_inventory/server.lua @@ -17,6 +17,7 @@ Inventory.Stashes = Inventory.Stashes or {} ---@param metadata table ---@return boolean Inventory.AddItem = function(src, item, count, slot, metadata) + if not ox_inventory:CanCarryItem(src, item, count, metadata) then return false end TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata}) return ox_inventory:AddItem(src, item, count, metadata) end diff --git a/modules/inventory/qb-inventory/server.lua b/modules/inventory/qb-inventory/server.lua index ce60468..eb92534 100644 --- a/modules/inventory/qb-inventory/server.lua +++ b/modules/inventory/qb-inventory/server.lua @@ -21,6 +21,7 @@ end ---@param metadata table ---@return boolean Inventory.AddItem = function(src, item, count, slot, metadata) + if getInventoryNewVersion() then if not qbInventory:CanAddItem(src, item, count) then return false end end TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add', count) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata}) return qbInventory:AddItem(src, item, count, slot, metadata, 'community_bridge') diff --git a/modules/inventory/tgiann-inventory/server.lua b/modules/inventory/tgiann-inventory/server.lua index d2613ab..4393d58 100644 --- a/modules/inventory/tgiann-inventory/server.lua +++ b/modules/inventory/tgiann-inventory/server.lua @@ -14,6 +14,7 @@ Inventory.Stashes = Inventory.Stashes or {} ---@param metadata table ---@return boolean Inventory.AddItem = function(src, item, count, slot, metadata) + if not tgiann:CanCarryItem(src, item, count) then return false end TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata}) return tgiann:AddItem(src, item, count, slot, metadata, false) end From de5353b329d444bf010c2c8486c7cbc2999801dc Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 12 Aug 2025 18:10:13 -0400 Subject: [PATCH 37/54] tweak dispatch for ps --- .../dispatch/ps-dispatch/client/client.lua | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/modules/dispatch/ps-dispatch/client/client.lua b/modules/dispatch/ps-dispatch/client/client.lua index 835fcea..142bc21 100644 --- a/modules/dispatch/ps-dispatch/client/client.lua +++ b/modules/dispatch/ps-dispatch/client/client.lua @@ -5,27 +5,24 @@ Dispatch = Dispatch or {} Dispatch.SendAlert = function(data) local alertData = { - message = data.message, + message = data.message or "No message provided", code = data.code or '10-80', icon = data.icon or 'fas fa-question', - priority = 2, - coords = data.coords, + priority = data.priority or 2, + coords = data.coords or GetEntityCoords(PlayerPedId()), vehicle = data.vehicle, plate = data.plate, - alertTime = (data.time or 10000) / 1000, - alert = { - radius = 0, - recipientList = data.jobs, - sprite = data.blipData.sprite, - color = data.blipData.color, - scale = data.blipData.scale, - length = 2, - sound = "Lose_1st", - sound2 = "GTAO_FM_Events_Soundset", - offset = false, - flash = false - }, - jobs = data.jobs + alertTime = data.time and (data.time / 1000) or nil, + radius = data.blipData and data.blipData.radius or 0, + sprite = data.blipData and data.blipData.sprite or 161, + color = data.blipData and data.blipData.color or 84, + scale = data.blipData and data.blipData.scale or 1.0, + length = 2, + sound = "Lose_1st", + sound2 = "GTAO_FM_Events_Soundset", + offset = false, + flash = data.blipData and data.blipData.flash or false, + jobs = data.jobs or data.job or "police" } exports["ps-dispatch"]:CustomAlert(alertData) end From 29c19f3cb4dcbb3be8142ceb614bc696ecbcb885 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 12 Aug 2025 20:20:49 -0400 Subject: [PATCH 38/54] Update client_entity.lua --- lib/entities/client/client_entity.lua | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/entities/client/client_entity.lua b/lib/entities/client/client_entity.lua index 9a8a754..45d9755 100644 --- a/lib/entities/client/client_entity.lua +++ b/lib/entities/client/client_entity.lua @@ -40,31 +40,30 @@ local function SpawnEntity(entityData) else SetModelAsNoLongerNeeded(model) end + -- if entityData.OnSpawn then + -- entityData.OnSpawn(entityData) + -- end if entityData.OnSpawn then - entityData.OnSpawn(entityData) + pcall(function (...) + return entityData.OnSpawn(entityData) + end) end end local function RemoveEntity(entityData) - print(string.format("[ClientEntity] Removing entity %s", entityData.id)) entityData = entityData and entityData.args or entityData if not entityData then return end - -- ClientEntityActions.StopAction(entityData.id) - print(string.format("[ClientEntity] Stopping actions for entity %s", entityData.id, entityData.OnRemove)) - for k, v in pairs(entityData) do - print(string.format("RemoveEntity %s", k)) - end - print(json.encode(skip)) if entityData.OnRemove then - print(string.format("[ClientEntity] Calling OnRemove for entity %s", entityData.id)) - entityData.OnRemove(entityData) + pcall(function (...) + return entityData.OnRemove(entityData) + end) end if entityData.spawned and DoesEntityExist(entityData.spawned) then local entityHandle = entityData.spawned entityData.spawned = nil - SetEntityAsMissionEntity(entityHandle, false, false) + SetEntityAsMissionEntity(entityHandle, true, true) DeleteEntity(entityHandle) - end + end end --- Registers an entity received from the server and sets up proximity spawning. From e11ef1242db4a8ecabb15709e11c93bc58a13a0e Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Tue, 12 Aug 2025 19:23:15 -0500 Subject: [PATCH 39/54] tweaks --- lib/entities/client/client_entity.lua | 31 +++++++++++ lib/logs/server/logs.lua | 76 +++++++++++++++------------ lib/particles/server/particles.lua | 2 +- lib/utility/client/utility.lua | 10 ++-- 4 files changed, 80 insertions(+), 39 deletions(-) diff --git a/lib/entities/client/client_entity.lua b/lib/entities/client/client_entity.lua index 45d9755..9d330ea 100644 --- a/lib/entities/client/client_entity.lua +++ b/lib/entities/client/client_entity.lua @@ -183,6 +183,37 @@ function ClientEntity.OnCreate(_type, func) table.insert(ClientEntity.OnCreates[_type], func) end +function ClientEntity.SetOnSpawn(id, func) + local entityData = Entities[id] + if not entityData then + print(string.format("[ClientEntity] SetOnSpawn: Entity %s does not exist", id)) + return + end + entityData.OnSpawn = func +end + +function ClientEntity.SetOnRemove(id, func) + local entityData = Entities[id] + if not entityData then + print(string.format("[ClientEntity] SetOnRemove: Entity %s does not exist", id)) + return + end + entityData.OnRemove = func +end + +function ClientEntity.UpdateCoords(id, coords) + local entityData = Entities[id] + if not entityData then + print(string.format("[ClientEntity] UpdateCoords: Entity %s does not exist", id)) + return + end + entityData.coords = coords + Point.UpdateCoords(id, coords) + if entityData.spawned and DoesEntityExist(entityData.spawned) then + SetEntityCoords(entityData.spawned, coords.x, coords.y, coords.z, false, false, false, true) + end +end + -- Network Event Handlers RegisterNetEvent("community_bridge:client:CreateEntity", function(entityData) ClientEntity.Create(entityData) diff --git a/lib/logs/server/logs.lua b/lib/logs/server/logs.lua index c947446..5fc0cec 100644 --- a/lib/logs/server/logs.lua +++ b/lib/logs/server/logs.lua @@ -55,46 +55,54 @@ Logs.Send = function(src, message) end end +local embeds = {} Logs.Notify = function(src, url, image, message) if not src or not message then return end local logType = LogSystem or "built-in" if logType == "built-in" then + embeds[url] = embeds[url] or {} + local embed = embeds[url].embed or {} local firstName, lastName = Framework.GetPlayerName(src) - PerformHttpRequest(url, function(err, text, headers) end, 'POST', json.encode( - { - username = string.format("%s %s", firstName, lastName), - avatar_url = image or 'https://avatars.githubusercontent.com/u/192999457?s=400&u=da632e8f64c85def390cfd1a73c3b664d6882b38&v=4', - embeds = { + + table.insert(embed, { + color = "15769093", + title = GetInvokingResource(), + -- url = 'https://discord.gg/Gm6rYEXUsn', + thumbnail = { url = LogoForEmbed }, + fields = { { - color = "15769093", - title = GetInvokingResource(), - -- url = 'https://discord.gg/Gm6rYEXUsn', - thumbnail = { url = LogoForEmbed }, - fields = { - { - name = '**Player ID**', - value = src, - inline = true, - }, - { - name = '**Player Identifier**', - value = Framework.GetPlayerIdentifier(src), - inline = true, - }, - { - name = 'Log Message', - value = "```"..message.."```", - inline = false, - }, - }, - timestamp = os.date('!%Y-%m-%dT%H:%M:%S'), - footer = { - text = "Community_Bridge | ", - icon_url = 'https://avatars.githubusercontent.com/u/192999457?s=400&u=da632e8f64c85def390cfd1a73c3b664d6882b38&v=4', - }, - } - } - }), { ['Content-Type']= 'application/json' }) + name = '**Player ID**', + value = src, + inline = true, + }, + { + name = '**Player Identifier**', + value = Framework.GetPlayerIdentifier(src), + inline = true, + }, + { + name = 'Log Message', + value = "```"..message.."```", + inline = false, + }, + }, + timestamp = os.date('!%Y-%m-%dT%H:%M:%S'), + footer = { + text = "Community_Bridge | ", + icon_url = 'https://avatars.githubusercontent.com/u/192999457?s=400&u=da632e8f64c85def390cfd1a73c3b664d6882b38&v=4', + }, + }) + embeds[url].embed = embed + if embeds[url].inProgress then return end + embeds[url].inProgress = true + SetTimeout(5000, function() + PerformHttpRequest(url, function(err, text, headers) end, 'POST', json.encode({ + username = string.format("%s %s", firstName, lastName), + avatar_url = image or 'https://avatars.githubusercontent.com/u/192999457?s=400&u=da632e8f64c85def390cfd1a73c3b664d6882b38&v=4', + embeds = embeds[url].embed + }), { ['Content-Type']= 'application/json' }) + embeds[url].inProgress = false + end) elseif logType == "qb" then return TriggerEvent('qb-log:server:CreateLog', GetCurrentResourceName(), GetCurrentResourceName(), 'green', message) elseif logType == "ox_lib" then diff --git a/lib/particles/server/particles.lua b/lib/particles/server/particles.lua index f71ab68..71fa9ce 100644 --- a/lib/particles/server/particles.lua +++ b/lib/particles/server/particles.lua @@ -8,7 +8,7 @@ function Particle.New(data) assert(data.dict, "Invalid particle data. Must contain string dict.") assert(data.ptfx, "Invalid particle data. Must contain string ptfx.") - local _id = data.id or id.CreateUniqueId(Particles) + local _id = data.id or Bridge.Ids.CreateUniqueId(Particles) data = { id = _id, dict = data.dict, diff --git a/lib/utility/client/utility.lua b/lib/utility/client/utility.lua index 8bc0562..45cbe7f 100644 --- a/lib/utility/client/utility.lua +++ b/lib/utility/client/utility.lua @@ -270,16 +270,18 @@ function Utility.HelpText(text, duration) EndTextCommandDisplayHelp(0, false, true, duration or 5000) end +local doingstuff = false + ---Show a floating help text in the world ---@param text string The text to show ---@param coords table The coords to show the message at ---@return nil -function Utility.FloatingHelpText(text, coords) - AddTextEntry("community_bridge_"..text, "community_bridge_"..text) - SetFloatingHelpTextWorldPosition(1, coords.x, coords.y, coords.z) +function Utility.FloatingHelpText(text, coords) + AddTextEntry("community_bridge_"..text, text) + SetFloatingHelpTextWorldPosition(1, coords.x, coords.y, coords.z) SetFloatingHelpTextStyle(1, 1, 2, -1, 3, 0) BeginTextCommandDisplayHelp("community_bridge_"..text) - EndTextCommandDisplayHelp(2, false, false, -1) + EndTextCommandDisplayHelp(2, false, false, 100) end ---Draw 3D help text in the world From 1a2e780effb73b635b61844c300b1e607b8eb03b Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 12 Aug 2025 21:32:17 -0400 Subject: [PATCH 40/54] Lithuanian support --- locales/lt.json | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 locales/lt.json diff --git a/locales/lt.json b/locales/lt.json new file mode 100644 index 0000000..59ac559 --- /dev/null +++ b/locales/lt.json @@ -0,0 +1,37 @@ +{ + "Shops": { + "NotEnoughMoney": "Neturite pakankamai pinigų šiam daiktui nusipirkti", + "Input": "Kiekio įvestis", + "PurchaseAmount": "Pirkimo kiekis", + "PurchasedItem": "Jūs nusipirkote ", + "CurrencySymbol": "%s €", + "Confirm": "Patvirtinti pirkimą", + "AreYouSure": "Ar tikrai norite nusipirkti %s", + "PayByCash": "Sumokėti %s grynaisiais", + "PayByCard": "Sumokėti %s kortele", + "CardIcon": "fa-solid fa-building-columns", + "CashIcon": "fa-solid fa-money-bill-wave", + "ShopIcon": "fa-solid fa-basket-shopping", + "ShopName": "Parduotuvės pavadinimas" + }, + "UNITTEST": { + "UNITTESTA": "Aš esu %s %s", + "locale-unit-test": "Tai yra testavimo eilutė" + }, + "clipboard": { + "copy": "Nukopijuota į iškarpinę" + }, + "placeable_object": { + "no_prop_defined": "Nenurodėte jokio objekto, kurį reikia pastatyti", + "cant_place_here": "Čia negalite pastatyti šio objekto", + "place_object_place": "[E] Pastatyti \n", + "place_object_cancel": "[X] Atšaukti \n", + "place_object_scroll_up": "[Slinkti aukštyn] Pasukti dešinėn \n", + "place_object_scroll_down": "[Slinkti žemyn] Pasukti kairėn \n", + "object_place": "[%s] Pastatyti \n", + "object_cancel": "[%s] Atšaukti \n", + "rotate_clockwise": "[%s] Sukti pagal laikrodžio rodyklę \n", + "rotate_counter_clockwise": "[%s] Sukti prieš laikrodžio rodyklę \n", + "depth_modifier": "[%s] Gylio kontrolės modifikatorius \n" + } +} From 7a598dd8d81758b1eb2c618bb78a4066ce7155e9 Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Fri, 15 Aug 2025 13:28:13 -0500 Subject: [PATCH 41/54] update for fivem appearance should be working for esx now --- lib/entities/client/client_entity.lua | 6 ----- modules/clothing/fivem-appearance/server.lua | 23 ++++++++++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/entities/client/client_entity.lua b/lib/entities/client/client_entity.lua index 9d330ea..0b2c8c1 100644 --- a/lib/entities/client/client_entity.lua +++ b/lib/entities/client/client_entity.lua @@ -9,9 +9,6 @@ ClientEntity = {} -- Renamed from BaseEntity local function SpawnEntity(entityData) entityData = entityData and entityData.args if entityData.spawned and DoesEntityExist(entityData.spawned) then return end -- Already spawned - -- for k, v in pairs(entityData.args) do - -- print(string.format("SpawnEntity %s: %s", k, v)) - -- end local loaded, model = Utility.LoadModel(entityData.model) if not loaded then print(string.format("[ClientEntity] Failed to load model %s for entity %s", entityData.model, entityData.id)) @@ -40,9 +37,6 @@ local function SpawnEntity(entityData) else SetModelAsNoLongerNeeded(model) end - -- if entityData.OnSpawn then - -- entityData.OnSpawn(entityData) - -- end if entityData.OnSpawn then pcall(function (...) return entityData.OnSpawn(entityData) diff --git a/modules/clothing/fivem-appearance/server.lua b/modules/clothing/fivem-appearance/server.lua index 0520880..34ce624 100644 --- a/modules/clothing/fivem-appearance/server.lua +++ b/modules/clothing/fivem-appearance/server.lua @@ -18,13 +18,22 @@ function Clothing.GetFullAppearanceData(src) if Clothing.Players[citId] then return Clothing.Players[citId] end - local result = MySQL.query.await('SELECT * FROM playerskins WHERE citizenid = ? AND active = ?', { citId, 1 }) - if result[1] == nil then return end - - local model = result[1].model - local skinData = json.decode(result[1].skin) - local converted = skinData - + local result = nil + local model = GetEntityModel(GetPlayerPed(src)) + local skinData = nil + local converted = nil + if Bridge.Framework.GetFrameworkName() == "es_extended" then + result = MySQL.query.await('SELECT skin FROM users WHERE identifier = ?', { citId }) + if not result or not result[1] then return end + skinData = json.decode(result[1].skin) + converted = skinData + else + result = MySQL.query.await('SELECT * FROM playerskins WHERE citizenid = ? AND active = ?', { citId, 1 }) + if not result or not result[1] then return end + model = result[1].model + skinData = json.decode(result[1].skin) + converted = skinData + end -- Store complete data in the cache Clothing.Players[citId] = { model = model, From bdde5124ffde35af567e888df46d5aa041f35ea3 Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Fri, 15 Aug 2025 23:54:55 -0500 Subject: [PATCH 42/54] Simplified Points Reduced code and calculations should hopefully be more performant --- lib/init.lua | 3 +- lib/points/client/points.lua | 446 ++++++++++++++++----------------- lib/points/client/pointsv2.lua | 152 +++++++++++ 3 files changed, 377 insertions(+), 224 deletions(-) create mode 100644 lib/points/client/pointsv2.lua diff --git a/lib/init.lua b/lib/init.lua index e22e837..23f448f 100644 --- a/lib/init.lua +++ b/lib/init.lua @@ -47,6 +47,7 @@ cLib = { Math = Math or Require("lib/utility/shared/math.lua"), LA = LA or Require("lib/utility/shared/la.lua"), Perlin = Perlin or Require("lib/utility/shared/perlin.lua"), + -- Zones = Poly or Require("lib/zones/shared/zones.lua"), -- Action = Action or Require("lib/entities/shared/actions.lua"), } @@ -71,7 +72,7 @@ cLib.Placeable = Placeable or Require("lib/placers/client/object_placer.lua") cLib.Utility = Utility or Require("lib/utility/client/utility.lua") cLib.PlaceableObject = ObjectPlacer or Require("lib/placers/client/placeable_object.lua") cLib.Raycast = Raycast or Require("lib/raycast/client/raycast.lua") -cLib.Point = Point or Require("lib/points/client/points.lua") +cLib.Point = Point or Require("lib/points/client/pointsv2.lua") cLib.Particle = Particle or Require("lib/particles/client/particles.lua") cLib.Cache = Cache or Require("lib/cache/client/cache.lua") cLib.ClientEntity = ClientEntity or Require("lib/entities/client/client_entity.lua") diff --git a/lib/points/client/points.lua b/lib/points/client/points.lua index 79d2d2f..569d29c 100644 --- a/lib/points/client/points.lua +++ b/lib/points/client/points.lua @@ -1,255 +1,255 @@ --- Grid-based point system -Point = {} -local ActivePoints = {} -local GridCells = {} -local LoopStarted = false -local insidePoints = {} -local data = {} -- 👈 Move this outside the function +-- -- Grid-based point system +-- Point = {} +-- local ActivePoints = {} +-- local GridCells = {} +-- local LoopStarted = false +-- local insidePoints = {} +-- local data = {} -- 👈 Move this outside the function --- Grid configuration -local GRID_SIZE = 500.0 -- Size of each grid cell -local CELL_BUFFER = 1 -- Number of adjacent cells to check +-- -- Grid configuration +-- local GRID_SIZE = 500.0 -- Size of each grid cell +-- local CELL_BUFFER = 1 -- Number of adjacent cells to check --- Consider adding these optimizations -local ADAPTIVE_WAIT = false -- Adjust wait time based on player speed +-- -- Consider adding these optimizations +-- local ADAPTIVE_WAIT = false -- Adjust wait time based on player speed ----This is an internal function, do not call this externally -function Point.GetCellKey(coords) - local cellX = math.floor(coords.x / GRID_SIZE) - local cellY = math.floor(coords.y / GRID_SIZE) - return cellX .. ":" .. cellY -end +-- ---This is an internal function, do not call this externally +-- function Point.GetCellKey(coords) +-- local cellX = math.floor(coords.x / GRID_SIZE) +-- local cellY = math.floor(coords.y / GRID_SIZE) +-- return cellX .. ":" .. cellY +-- end ----This is an internal function, do not call this externally -function Point.RegisterInGrid(point) - local cellKey = Point.GetCellKey(point.coords) +-- ---This is an internal function, do not call this externally +-- function Point.RegisterInGrid(point) +-- local cellKey = Point.GetCellKey(point.coords) - -- Initialize cell if it doesn't exist - GridCells[cellKey] = GridCells[cellKey] or { - points = {}, - count = 0 - } +-- -- Initialize cell if it doesn't exist +-- GridCells[cellKey] = GridCells[cellKey] or { +-- points = {}, +-- count = 0 +-- } - -- Add point to cell - GridCells[cellKey].points[point.id] = point - GridCells[cellKey].count = GridCells[cellKey].count + 1 +-- -- Add point to cell +-- GridCells[cellKey].points[point.id] = point +-- GridCells[cellKey].count = GridCells[cellKey].count + 1 - -- Store cell reference in point - point.cellKey = cellKey -end +-- -- Store cell reference in point +-- point.cellKey = cellKey +-- end ----This is an internal function, do not call this externally -function Point.UpdateInGrid(point, oldCellKey) - -- Remove from old cell if cell key changed - if oldCellKey and oldCellKey ~= point.cellKey then - if GridCells[oldCellKey] and GridCells[oldCellKey].points[point.id] then - GridCells[oldCellKey].points[point.id] = nil - GridCells[oldCellKey].count = GridCells[oldCellKey].count - 1 +-- ---This is an internal function, do not call this externally +-- function Point.UpdateInGrid(point, oldCellKey) +-- -- Remove from old cell if cell key changed +-- if oldCellKey and oldCellKey ~= point.cellKey then +-- if GridCells[oldCellKey] and GridCells[oldCellKey].points[point.id] then +-- GridCells[oldCellKey].points[point.id] = nil +-- GridCells[oldCellKey].count = GridCells[oldCellKey].count - 1 - -- Clean up empty cells - if GridCells[oldCellKey].count <= 0 then - GridCells[oldCellKey] = nil - end - end +-- -- Clean up empty cells +-- if GridCells[oldCellKey].count <= 0 then +-- GridCells[oldCellKey] = nil +-- end +-- end - -- Add to new cell - Point.RegisterInGrid(point) - end -end +-- -- Add to new cell +-- Point.RegisterInGrid(point) +-- end +-- end ----Gets nearby cells based on the coords ----@param coords table ----@return table -function Point.GetNearbyCells(coords) - local cellX = math.floor(coords.x / GRID_SIZE) - local cellY = math.floor(coords.y / GRID_SIZE) - local nearbyCells = {} +-- ---Gets nearby cells based on the coords +-- ---@param coords table +-- ---@return table +-- function Point.GetNearbyCells(coords) +-- local cellX = math.floor(coords.x / GRID_SIZE) +-- local cellY = math.floor(coords.y / GRID_SIZE) +-- local nearbyCells = {} - -- Get current and adjacent cells - for x = cellX - CELL_BUFFER, cellX + CELL_BUFFER do - for y = cellY - CELL_BUFFER, cellY + CELL_BUFFER do - local key = x .. ":" .. y - if GridCells[key] then - table.insert(nearbyCells, key) - end - end - end +-- -- Get current and adjacent cells +-- for x = cellX - CELL_BUFFER, cellX + CELL_BUFFER do +-- for y = cellY - CELL_BUFFER, cellY + CELL_BUFFER do +-- local key = x .. ":" .. y +-- if GridCells[key] then +-- table.insert(nearbyCells, key) +-- end +-- end +-- end - return nearbyCells -end +-- return nearbyCells +-- end ----Returns all points in the same cell as the given point ----This will require you to pass the point object ----@param point table ----@return table -function Point.CheckPointsInSameCell(point) - local cellKey = point.cellKey - if not GridCells[cellKey] then return {} end +-- ---Returns all points in the same cell as the given point +-- ---This will require you to pass the point object +-- ---@param point table +-- ---@return table +-- function Point.CheckPointsInSameCell(point) +-- local cellKey = point.cellKey +-- if not GridCells[cellKey] then return {} end - local nearbyPoints = {} - for id, otherPoint in pairs(GridCells[cellKey].points) do - if id ~= point.id then - local distance = #(point.coords - otherPoint.coords) - if distance < (point.distance + otherPoint.distance) then - nearbyPoints[id] = otherPoint - end - end - end +-- local nearbyPoints = {} +-- for id, otherPoint in pairs(GridCells[cellKey].points) do +-- if id ~= point.id then +-- local distance = #(point.coords - otherPoint.coords) +-- if distance < (point.distance + otherPoint.distance) then +-- nearbyPoints[id] = otherPoint +-- end +-- end +-- end - return nearbyPoints -end +-- return nearbyPoints +-- end ----Internal function that starts the loop. Do not call this function directly. -function Point.StartLoop() - if LoopStarted then return false end - LoopStarted = true - -- Remove the "local data = {}" line from here - CreateThread(function() - while LoopStarted do - local playerPed = PlayerPedId() - while playerPed == -1 do - Wait(100) - playerPed = PlayerPedId() - end - local playerCoords = GetEntityCoords(playerPed) - local targetsExist = false - local playerCellKey = Point.GetCellKey(playerCoords) - local nearbyCells = Point.GetNearbyCells(playerCoords) +-- ---Internal function that starts the loop. Do not call this function directly. +-- function Point.StartLoop() +-- if LoopStarted then return false end +-- LoopStarted = true +-- -- Remove the "local data = {}" line from here +-- CreateThread(function() +-- while LoopStarted do +-- local playerPed = PlayerPedId() +-- while playerPed == -1 do +-- Wait(100) +-- playerPed = PlayerPedId() +-- end +-- local playerCoords = GetEntityCoords(playerPed) +-- local targetsExist = false +-- local playerCellKey = Point.GetCellKey(playerCoords) +-- local nearbyCells = Point.GetNearbyCells(playerCoords) - local playerSpeed = GetEntitySpeed(playerPed) - local maxWeight = 1000 - local waitTime = ADAPTIVE_WAIT and math.max(maxWeight/10, maxWeight - playerSpeed * maxWeight/10) or maxWeight - -- Process only points in nearby cells - for _, cellKey in ipairs(nearbyCells) do - if GridCells[cellKey] then - for id, point in pairs(GridCells[cellKey].points) do - targetsExist = true +-- local playerSpeed = GetEntitySpeed(playerPed) +-- local maxWeight = 1000 +-- local waitTime = ADAPTIVE_WAIT and math.max(maxWeight/10, maxWeight - playerSpeed * maxWeight/10) or maxWeight +-- -- Process only points in nearby cells +-- for _, cellKey in ipairs(nearbyCells) do +-- if GridCells[cellKey] then +-- for id, point in pairs(GridCells[cellKey].points) do +-- targetsExist = true - -- Update entity position if needed - local oldCellKey = point.cellKey - if point.isEntity then - point.coords = GetEntityCoords(point.target) - point.cellKey = Point.GetCellKey(point.coords) - Point.UpdateInGrid(point, oldCellKey) - end - local coords = point.coords and vector3(point.coords.x, point.coords.y, point.coords.z) or vector3(0, 0, 0) - local distance = #(playerCoords - coords) - --local distance = #(playerCoords - point.coords) +-- -- Update entity position if needed +-- local oldCellKey = point.cellKey +-- if point.isEntity then +-- point.coords = GetEntityCoords(point.target) +-- point.cellKey = Point.GetCellKey(point.coords) +-- Point.UpdateInGrid(point, oldCellKey) +-- end +-- local coords = point.coords and vector3(point.coords.x, point.coords.y, point.coords.z) or vector3(0, 0, 0) +-- local distance = #(playerCoords - coords) +-- --local distance = #(playerCoords - point.coords) - -- Check if player entered/exited the point - if distance < point.distance then - if not point.inside then - point.inside = true - data[point.id] = data[point.id] or point.args or {} - data[point.id] = point.onEnter(point, data[point.id]) - insidePoints[point.id] = point - end - -- Modified main loop exit handler - elseif point.inside then - point.inside = false - data[point.id] = data[point.id] or point.args or {} - local result = point.onExit(point, data[point.id]) - data[point.id] = result ~= nil and result or data[point.id] -- ← Use consistent fallback - point.args = data[point.id] -- ← Update point.args to match data[point.id] - insidePoints[point.id] = nil - end +-- -- Check if player entered/exited the point +-- if distance < point.distance then +-- if not point.inside then +-- point.inside = true +-- data[point.id] = data[point.id] or point.args or {} +-- data[point.id] = point.onEnter(point, data[point.id]) +-- insidePoints[point.id] = point +-- end +-- -- Modified main loop exit handler +-- elseif point.inside then +-- point.inside = false +-- data[point.id] = data[point.id] or point.args or {} +-- local result = point.onExit(point, data[point.id]) +-- data[point.id] = result ~= nil and result or data[point.id] -- ← Use consistent fallback +-- point.args = data[point.id] -- ← Update point.args to match data[point.id] +-- insidePoints[point.id] = nil +-- end - -- if point.onNearby then - -- point.onNearby(GridCells[cellKey]?.points, waitTime) - -- end - end - end - end +-- -- if point.onNearby then +-- -- point.onNearby(GridCells[cellKey]?.points, waitTime) +-- -- end +-- end +-- end +-- end - for id, insidepoint in pairs(insidePoints) do - local pos = insidepoint.coords and vector3(insidepoint.coords.x, insidepoint.coords.y, insidepoint.coords.z) or vector3(0, 0, 0) - local dist = #(playerCoords - pos) - if dist > insidepoint.distance then - insidepoint.inside = false - data[insidepoint.id] = data[insidepoint.id] or insidepoint.args or {} - local result = insidepoint.onExit(insidepoint, data[insidepoint.id]) - data[insidepoint.id] = result ~= nil and result or data[insidepoint.id] - insidepoint.args = data[insidepoint.id] -- ← Keep data in sync - insidePoints[insidepoint.id] = nil - end - end - Wait(waitTime) -- Faster updates when moving quickly - end - end) - return true -end +-- for id, insidepoint in pairs(insidePoints) do +-- local pos = insidepoint.coords and vector3(insidepoint.coords.x, insidepoint.coords.y, insidepoint.coords.z) or vector3(0, 0, 0) +-- local dist = #(playerCoords - pos) +-- if dist > insidepoint.distance then +-- insidepoint.inside = false +-- data[insidepoint.id] = data[insidepoint.id] or insidepoint.args or {} +-- local result = insidepoint.onExit(insidepoint, data[insidepoint.id]) +-- data[insidepoint.id] = result ~= nil and result or data[insidepoint.id] +-- insidepoint.args = data[insidepoint.id] -- ← Keep data in sync +-- insidePoints[insidepoint.id] = nil +-- end +-- end +-- Wait(waitTime) -- Faster updates when moving quickly +-- end +-- end) +-- return true +-- end ----Create a point based on a vector or entityID ----@param id string ----@param target number || vector3 ----@param distance number ----@param _onEnter function ----@param _onExit function ----@param _onNearby function ----@param data self ----@return table -function Point.Register(id, target, distance, args, _onEnter, _onExit, _onNearby) - local isEntity = type(target) == "number" - local coords = isEntity and GetEntityCoords(target) or target +-- ---Create a point based on a vector or entityID +-- ---@param id string +-- ---@param target number || vector3 +-- ---@param distance number +-- ---@param _onEnter function +-- ---@param _onExit function +-- ---@param _onNearby function +-- ---@param data self +-- ---@return table +-- function Point.Register(id, target, distance, args, _onEnter, _onExit, _onNearby) +-- local isEntity = type(target) == "number" +-- local coords = isEntity and GetEntityCoords(target) or target - local self = {} - self.id = id - self.target = target -- Store entity ID or Vector3 - self.isEntity = isEntity - self.coords = coords - self.distance = distance - self.onEnter = _onEnter or function() end - self.onExit = _onExit or function() end - self.onNearby = _onNearby or function() end - self.inside = false -- Track if player is inside - self.args = args or {} +-- local self = {} +-- self.id = id +-- self.target = target -- Store entity ID or Vector3 +-- self.isEntity = isEntity +-- self.coords = coords +-- self.distance = distance +-- self.onEnter = _onEnter or function() end +-- self.onExit = _onExit or function() end +-- self.onNearby = _onNearby or function() end +-- self.inside = false -- Track if player is inside +-- self.args = args or {} - ActivePoints[id] = self - Point.RegisterInGrid(self) - Point.StartLoop() - return self -end +-- ActivePoints[id] = self +-- Point.RegisterInGrid(self) +-- Point.StartLoop() +-- return self +-- end ----Remove an exsisting point by its id ----@param id string -function Point.Remove(id) - local point = ActivePoints[id] - if point then - local cellKey = point.cellKey - if GridCells[cellKey] and GridCells[cellKey].points[id] then - GridCells[cellKey].points[id] = nil - GridCells[cellKey].count = GridCells[cellKey].count - 1 +-- ---Remove an exsisting point by its id +-- ---@param id string +-- function Point.Remove(id) +-- local point = ActivePoints[id] +-- if point then +-- local cellKey = point.cellKey +-- if GridCells[cellKey] and GridCells[cellKey].points[id] then +-- GridCells[cellKey].points[id] = nil +-- GridCells[cellKey].count = GridCells[cellKey].count - 1 - if GridCells[cellKey].count <= 0 then - GridCells[cellKey] = nil - end - end +-- if GridCells[cellKey].count <= 0 then +-- GridCells[cellKey] = nil +-- end +-- end - ActivePoints[id] = nil - end -end +-- ActivePoints[id] = nil +-- end +-- end ----Returnes a point by its id ----@param id string ----@return table -function Point.Get(id) - return ActivePoints[id] -end +-- ---Returnes a point by its id +-- ---@param id string +-- ---@return table +-- function Point.Get(id) +-- return ActivePoints[id] +-- end -function Point.UpdateCoords(id, coords) - local point = ActivePoints[id] - if point then - point.coords = coords - local oldCellKey = point.cellKey - point.cellKey = Point.GetCellKey(coords) - Point.UpdateInGrid(point, oldCellKey) - end -end +-- function Point.UpdateCoords(id, coords) +-- local point = ActivePoints[id] +-- if point then +-- point.coords = coords +-- local oldCellKey = point.cellKey +-- point.cellKey = Point.GetCellKey(coords) +-- Point.UpdateInGrid(point, oldCellKey) +-- end +-- end ----Returns all points ----@return table -function Point.GetAll() - return ActivePoints -end +-- ---Returns all points +-- ---@return table +-- function Point.GetAll() +-- return ActivePoints +-- end -return Point \ No newline at end of file +-- return Point \ No newline at end of file diff --git a/lib/points/client/pointsv2.lua b/lib/points/client/pointsv2.lua new file mode 100644 index 0000000..1af43fd --- /dev/null +++ b/lib/points/client/pointsv2.lua @@ -0,0 +1,152 @@ + +local GRIDE_SIZE_X = 8968.83 / 2 +local GRIDE_SIZE_Y = 126200.40 / 2 +local CELL_SIZE = 500 + +local Grid = {} +Grid.Generated = false +local Grids = {} +Point = {} +Point.All = {} + +function Grid.Generate() + if Grid.Generated then return end + Grid.Generated = true + local numOfCellsX = math.ceil(GRIDE_SIZE_X / CELL_SIZE) + local numOfCellsY = math.ceil(GRIDE_SIZE_Y / CELL_SIZE) + + for x = -numOfCellsX, numOfCellsX do + Grids[x] = {} + for y = -numOfCellsY, numOfCellsY do + Grids[x][y] = {} + end + end +end + +function Grid.GetCellId(coords) + local cellX = math.floor(coords.x / CELL_SIZE) + 1 + local cellY = math.floor(coords.y / CELL_SIZE) + 1 + return string.format("%d_%d", cellX, cellY) +end + +function Grid.GetCellByCoords(coords) + local cellX = math.floor(coords.x / CELL_SIZE) + 1 + local cellY = math.floor(coords.y / CELL_SIZE) + 1 + + if Grids[cellX] and Grids[cellX][cellY] then + return Grids[cellX][cellY] + end + + return nil +end + +local Points = {} +Points.Started = false +function Point.StartLoop() + if Points.Started then return end + Points.Started = true + + CreateThread(function() + while Points.Started do + local playerPed = PlayerPedId() + if playerPed ~= -1 then + local coords = GetEntityCoords(playerPed) + local cell = Grid.GetCellByCoords(coords) + for _, point in pairs(cell or {}) do + if point.isEntity then + local entity = point.target + if DoesEntityExist(entity) then + local entityCoords = GetEntityCoords(entity) + local distance = #(coords - entityCoords) + if distance < point.distance then + if not point.inside then + point.inside = true + point.args = point?.onEnter(point, point.args) or point.args + end + elseif point.inside then + point.inside = false + point.args = point?.onExit(point, point.args) or point.args + end + end + else + local distance = #(coords.xyz - point.coords.xyz) + if distance < point.distance then + if not point.inside then + point.inside = true + point.args = point?.onEnter(point, point.args) or point.args + end + elseif point.inside then + point.inside = false + point.args = point?.onExit(point, point.args) or point.args + end + end + end + end + Wait(1000) + end + end) +end + +function Point.Register(id, target, distance, args, _onEnter, _onExit) + local isEntity = type(target) == "number" + local coords = isEntity and GetEntityCoords(target) or target + print(target) + Grid.Generate() + local self = {} + self.id = id + self.target = target -- Store entity ID or Vector3 + self.isEntity = isEntity + self.coords = coords + self.distance = distance + self.onEnter = _onEnter or function() end + self.onExit = _onExit or function() end + self.inside = false -- Track if player is inside + self.args = args or {} + local grid = Grid.GetCellByCoords(coords) + self.cellKey = Grid.GetCellId(coords) + grid[self.cellKey] = self + Point.All[id] = self + Point.StartLoop() + return self +end + +function Point.Remove(id) + local point = Point.All[id] + if not point then return false end + + -- Remove from grid + local grid = Grid.GetCellByCoords(point.coords) + if grid then + grid[point.cellKey] = nil + end + + Point.All[id] = nil + return true +end + +function Point.Get(id) + return Point.All[id] +end + +function Point.UpdateCoords(id, coords) + local point = Point.All[id] + if not point then return end + + local newGrid = Grid.GetCellByCoords(coords) + if not newGrid or newGrid[point.cellKey] then return end + local oldGrid = Grid.GetCellByCoords(point.coords) + if oldGrid then + oldGrid[point.cellKey] = nil + end + -- Add to new grid + point.coords = coords + point.cellKey = string.format("%d_%d", newGrid.x, newGrid.y) + newGrid[point.cellKey] = point + return true +end + +function Point.GetAll() + return Point.All +end + +return Point \ No newline at end of file From 255462493f6e10e253965e65ea6d3d59408000a0 Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Fri, 15 Aug 2025 23:57:31 -0500 Subject: [PATCH 43/54] cache error fix --- lib/cache/shared/cache.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/cache/shared/cache.lua b/lib/cache/shared/cache.lua index dfd76d1..3fd9abd 100644 --- a/lib/cache/shared/cache.lua +++ b/lib/cache/shared/cache.lua @@ -128,11 +128,8 @@ local function trackResource(resourceName, type, data) for _, cb in ipairs(resourceTracker.callbacks[resourceName] or {}) do local targetCache = Cache.Caches[cb.cacheName] if targetCache then - table.remove(targetCache.OnChange, cb.index) - debugPrint(("Removed OnChange callback from cache '%s' - resource '%s' stopped"):format( - cb.cacheName, - resourceName - )) + targetCache.OnChange[cb.index] = nil + debugPrint(("Removed callback '%s' from cache '%s' - resource '%s' stopped"):format(cb.index, cb.cacheName, resourceName)) end end From 972399ebf6506233a33a0272539304fecb5ce520 Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Fri, 15 Aug 2025 23:58:29 -0500 Subject: [PATCH 44/54] forogt a print --- lib/points/client/pointsv2.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/points/client/pointsv2.lua b/lib/points/client/pointsv2.lua index 1af43fd..7793f71 100644 --- a/lib/points/client/pointsv2.lua +++ b/lib/points/client/pointsv2.lua @@ -90,7 +90,6 @@ end function Point.Register(id, target, distance, args, _onEnter, _onExit) local isEntity = type(target) == "number" local coords = isEntity and GetEntityCoords(target) or target - print(target) Grid.Generate() local self = {} self.id = id From defc7c0e8b470e14984e021af2526052374f3785 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 16 Aug 2025 01:03:45 -0400 Subject: [PATCH 45/54] blip tweak --- lib/utility/client/utility.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/utility/client/utility.lua b/lib/utility/client/utility.lua index 45cbe7f..8379c8f 100644 --- a/lib/utility/client/utility.lua +++ b/lib/utility/client/utility.lua @@ -126,7 +126,7 @@ function Utility.CreateBlip(coords, sprite, color, scale, label, shortRange, dis AddTextEntry(label, label) BeginTextCommandSetBlipName(label) EndTextCommandSetBlipName(blip) - blipIDs[tostring(blip)] = true + blipIDs[tostring(blip)] = blip return blip end @@ -150,7 +150,7 @@ function Utility.CreateEntityBlip(entity, sprite, color, scale, label, shortRang AddTextEntry(label, label) BeginTextCommandSetBlipName(label) EndTextCommandSetBlipName(blip) - blipIDs[tostring(blip)] = true + blipIDs[tostring(blip)] = blip return blip end @@ -158,8 +158,8 @@ end ---@param blip number ---@return boolean function Utility.RemoveBlip(blip) - if not blipIDs[tostring(blip)] then return false end - RemoveBlip(blip) + if not blipIDs[tostring(blip)] then return false, print("NO BLIP BY ID") end + RemoveBlip(blipIDs[tostring(blip)]) blipIDs[tostring(blip)] = nil return true end From 0fc872a10211e02d53993f7597e21b5b5e3c3120 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 16 Aug 2025 05:56:25 -0400 Subject: [PATCH 46/54] patch for vector4 --- lib/points/client/pointsv2.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/points/client/pointsv2.lua b/lib/points/client/pointsv2.lua index 7793f71..fd5dd0f 100644 --- a/lib/points/client/pointsv2.lua +++ b/lib/points/client/pointsv2.lua @@ -69,7 +69,7 @@ function Point.StartLoop() end end else - local distance = #(coords.xyz - point.coords.xyz) + local distance = #(vector3(coords.x, coords.y, coords.z) - vector3(point.coords.x, point.coords.y, point.coords.z)) if distance < point.distance then if not point.inside then point.inside = true From 58242b421399cff29ec66d330bd1115ba2fb3b48 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 16 Aug 2025 07:04:00 -0400 Subject: [PATCH 47/54] possible fix Before only one point could exist per cell. This corrects that but im unsure on the impact to performance or grids --- lib/points/client/pointsv2.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/points/client/pointsv2.lua b/lib/points/client/pointsv2.lua index fd5dd0f..5500047 100644 --- a/lib/points/client/pointsv2.lua +++ b/lib/points/client/pointsv2.lua @@ -102,7 +102,8 @@ function Point.Register(id, target, distance, args, _onEnter, _onExit) self.inside = false -- Track if player is inside self.args = args or {} local grid = Grid.GetCellByCoords(coords) - self.cellKey = Grid.GetCellId(coords) + -- OLD CODE: self.cellKey = Grid.GetCellId(coords) -- This caused points to overwrite each other in same cell + self.cellKey = id -- Use unique ID instead of cell coordinates grid[self.cellKey] = self Point.All[id] = self Point.StartLoop() @@ -132,14 +133,17 @@ function Point.UpdateCoords(id, coords) if not point then return end local newGrid = Grid.GetCellByCoords(coords) - if not newGrid or newGrid[point.cellKey] then return end + if not newGrid then return end + -- OLD CODE: if not newGrid or newGrid[point.cellKey] then return end -- This prevented adding points to cells with existing points + local oldGrid = Grid.GetCellByCoords(point.coords) if oldGrid then oldGrid[point.cellKey] = nil end -- Add to new grid point.coords = coords - point.cellKey = string.format("%d_%d", newGrid.x, newGrid.y) + -- OLD CODE: point.cellKey = string.format("%d_%d", newGrid.x, newGrid.y) -- This used cell coordinates instead of unique ID + point.cellKey = id -- Keep using the unique ID newGrid[point.cellKey] = point return true end From 6106f76b2d9a7bf6eed35dd3fa73a0a25d2d45e8 Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Sat, 16 Aug 2025 19:27:06 -0500 Subject: [PATCH 48/54] small mistake got rid of cellkey as it was clamped to a 10 meter radius, replaced with id --- lib/points/client/pointsv2.lua | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/points/client/pointsv2.lua b/lib/points/client/pointsv2.lua index 7793f71..8f39415 100644 --- a/lib/points/client/pointsv2.lua +++ b/lib/points/client/pointsv2.lua @@ -32,12 +32,7 @@ end function Grid.GetCellByCoords(coords) local cellX = math.floor(coords.x / CELL_SIZE) + 1 local cellY = math.floor(coords.y / CELL_SIZE) + 1 - - if Grids[cellX] and Grids[cellX][cellY] then - return Grids[cellX][cellY] - end - - return nil + return Grids[cellX][cellY] end local Points = {} @@ -102,8 +97,7 @@ function Point.Register(id, target, distance, args, _onEnter, _onExit) self.inside = false -- Track if player is inside self.args = args or {} local grid = Grid.GetCellByCoords(coords) - self.cellKey = Grid.GetCellId(coords) - grid[self.cellKey] = self + grid[id] = self Point.All[id] = self Point.StartLoop() return self @@ -116,7 +110,7 @@ function Point.Remove(id) -- Remove from grid local grid = Grid.GetCellByCoords(point.coords) if grid then - grid[point.cellKey] = nil + grid[point.id] = nil end Point.All[id] = nil @@ -132,15 +126,14 @@ function Point.UpdateCoords(id, coords) if not point then return end local newGrid = Grid.GetCellByCoords(coords) - if not newGrid or newGrid[point.cellKey] then return end + if not newGrid or newGrid[point.id] then return end local oldGrid = Grid.GetCellByCoords(point.coords) if oldGrid then - oldGrid[point.cellKey] = nil + oldGrid[point.id] = nil end -- Add to new grid point.coords = coords - point.cellKey = string.format("%d_%d", newGrid.x, newGrid.y) - newGrid[point.cellKey] = point + newGrid[point.id] = point return true end From 9b2b7de2b4fbcea92fe1f3a278ed60e9edc8079d Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sun, 17 Aug 2025 02:32:07 -0400 Subject: [PATCH 49/54] fix job duty Issue noticed by randomzz, pr did not use proper job.name so went ahead and corrected. --- modules/framework/es_extended/server.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/framework/es_extended/server.lua b/modules/framework/es_extended/server.lua index c38d242..d0adad1 100644 --- a/modules/framework/es_extended/server.lua +++ b/modules/framework/es_extended/server.lua @@ -330,7 +330,7 @@ Framework.SetPlayerDuty = function(src, status) local xPlayer = Framework.GetPlayer(src) if not xPlayer then return false end local job = xPlayer.getJob() - if not job.onDuty then return false end + if job.name == 'unemployed' then return false end xPlayer.setJob(job.name, job.grade, status) return true end From fd28d9a1a617b8dadfe631b0ae14ecf153d9bbe8 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Mon, 18 Aug 2025 02:18:52 -0400 Subject: [PATCH 50/54] attempt to add piotreq_gpt (dispatch compatability) --- .../dispatch/piotreq_gpt/client/client.lua | 10 +++++ .../dispatch/piotreq_gpt/server/server.lua | 39 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 modules/dispatch/piotreq_gpt/client/client.lua create mode 100644 modules/dispatch/piotreq_gpt/server/server.lua diff --git a/modules/dispatch/piotreq_gpt/client/client.lua b/modules/dispatch/piotreq_gpt/client/client.lua new file mode 100644 index 0000000..c0bc509 --- /dev/null +++ b/modules/dispatch/piotreq_gpt/client/client.lua @@ -0,0 +1,10 @@ +---@diagnostic disable: duplicate-set-field +if GetResourceState('piotreq_gpt') == 'missing' then return end +Dispatch = Dispatch or {} + +Dispatch.SendAlert = function(data) + if not data then return end + TriggerServerEvent('community_bridge:Server:piotreq_gpt', data) +end + +return Dispatch \ No newline at end of file diff --git a/modules/dispatch/piotreq_gpt/server/server.lua b/modules/dispatch/piotreq_gpt/server/server.lua new file mode 100644 index 0000000..a960eb0 --- /dev/null +++ b/modules/dispatch/piotreq_gpt/server/server.lua @@ -0,0 +1,39 @@ +if GetResourceState('piotreq_gpt') == 'missing' then return end +Dispatch = Dispatch or {} + +Dispatch.SendAlert = function(src, alertData) + -- No clue if this works, but itd be nice to have someone test it. + --https://piotreq-scripts.gitbook.io/piotreq-scripts/assets-and-guides/police-mdt/dispatch-system + exports['piotreq_gpt']:SendAlert(src, { + title = alertData.message or "No message provided", + code = alertData.code or '10-80', + icon = alertData.icon or 'fas fa-question', + info = { + {icon = alertData.icon or 'fas fa-question', data = alertData.message or "No additional info", isStreet = false}, + }, + --jobs = alertData.jobs or "police", + blip = { -- optional + scale = alertData.blipData and alertData.blipData.scale or 1.0, + sprite = alertData.blipData and alertData.blipData.sprite or 161, + category = 1, -- default 1 + color = alertData.blipData and alertData.blipData.color or 84, + hidden = false, -- default false (hidden on legend) + priority = alertData.priority or 5, -- default 5 + short = true, -- as short range? default true + alpha = 200, -- default 255 + name = alertData.message or "Dispatch Alert" + }, + type = 'normal', -- default normal + canAnswer = true, -- default false + maxOfficers = 6, -- default 4 + time = 10,-- 10 minutes, default 5 + notifyTime = 8000, -- 8 seconds, default 7 + }) +end + +RegisterNetEvent('community_bridge:Server:piotreq_gpt', function(data) + local src = source + Dispatch.SendAlert(src, data) +end) + +return Dispatch \ No newline at end of file From cdeba0652d403ab0b1954dd4001aef13e01b6dc2 Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Mon, 18 Aug 2025 18:32:38 -0500 Subject: [PATCH 51/54] Community Feedback on cache serverid in cache is pointless and will never change unit tests are not actually unit tests so i renamed to examples. --- .../cache_test.lua => examples/cache.lua | 0 .../callbacks.lua | 0 .../input_test.lua => examples/input.lua | 0 .../locale_test.lua => examples/locale.lua | 0 .../particle.lua | 0 .../placeableObject.lua | 0 lib/cache/client/cache.lua | 32 ++++--------------- lib/utility/client/utility.lua | 5 +-- 8 files changed, 9 insertions(+), 28 deletions(-) rename unit_tests/cache_test.lua => examples/cache.lua (100%) rename unit_tests/callbacks_test.lua => examples/callbacks.lua (100%) rename unit_tests/input_test.lua => examples/input.lua (100%) rename unit_tests/locale_test.lua => examples/locale.lua (100%) rename unit_tests/particle_test.lua => examples/particle.lua (100%) rename unit_tests/placeable_object.lua => examples/placeableObject.lua (100%) diff --git a/unit_tests/cache_test.lua b/examples/cache.lua similarity index 100% rename from unit_tests/cache_test.lua rename to examples/cache.lua diff --git a/unit_tests/callbacks_test.lua b/examples/callbacks.lua similarity index 100% rename from unit_tests/callbacks_test.lua rename to examples/callbacks.lua diff --git a/unit_tests/input_test.lua b/examples/input.lua similarity index 100% rename from unit_tests/input_test.lua rename to examples/input.lua diff --git a/unit_tests/locale_test.lua b/examples/locale.lua similarity index 100% rename from unit_tests/locale_test.lua rename to examples/locale.lua diff --git a/unit_tests/particle_test.lua b/examples/particle.lua similarity index 100% rename from unit_tests/particle_test.lua rename to examples/particle.lua diff --git a/unit_tests/placeable_object.lua b/examples/placeableObject.lua similarity index 100% rename from unit_tests/placeable_object.lua rename to examples/placeableObject.lua diff --git a/lib/cache/client/cache.lua b/lib/cache/client/cache.lua index 4b4b430..44a0235 100644 --- a/lib/cache/client/cache.lua +++ b/lib/cache/client/cache.lua @@ -3,33 +3,22 @@ local PlayerPedId = PlayerPedId local GetVehiclePedIsIn = GetVehiclePedIsIn local GetVehicleMaxNumberOfPassengers = GetVehicleMaxNumberOfPassengers local GetPedInVehicleSeat = GetPedInVehicleSeat -local GetPlayerServerId = GetPlayerServerId local GetSelectedPedWeapon = GetSelectedPedWeapon -local PlayerId = PlayerId - - --- Comparison functions for client-side state - ---- Get the player's ped ID ----@return integer -function GetPed() - return PlayerPedId() -end --- Get the vehicle the player is in, if any ---@return integer | nil function GetVehicle() - local ped = Cache.Get("Ped") -- Use cached ped for efficiency - if not ped then return end -- Or handle error/default case + local ped = PlayerPedId() + if not ped then return end return GetVehiclePedIsIn(ped, false) end --- Get the seat of the player in the vehicle if the vehicle is occupied ---@return integer | nil function GetVehicleSeat() - local vehicle = Cache.Get("Vehicle") + local vehicle = GetVehicle() if not vehicle then return end - local ped = Cache.Get("Ped") + local ped = PlayerPedId() if not ped then return end for i = -1, GetVehicleMaxNumberOfPassengers(vehicle) - 1 do if ped == GetPedInVehicleSeat(vehicle, i) then @@ -38,26 +27,17 @@ function GetVehicleSeat() end end ----Get The Server ID of the player ----@return integer | nil -function GetServerId() - local ped = PlayerId() - if not ped then return end -- Return unarmed hash if no ped - return GetPlayerServerId(ped) -end - --- Get the current weapon of the player --- @return integer | nil function GetWeapon() - local ped = Cache.Get("Ped") + local ped = PlayerPedId() if not ped then return end -- Return unarmed hash if no ped return GetSelectedPedWeapon(ped) end -Cache.Create("Ped", GetPed, 1000) -- Check ped every second (adjust as needed) +Cache.Create("Ped", PlayerPedId, 1000) -- Check ped every second (adjust as needed) Cache.Create("Vehicle", GetVehicle, 500) -- Check vehicle every 500ms Cache.Create("Seat", GetVehicleSeat, 500) -- Check if in vehicle every 500ms Cache.Create("Weapon", GetWeapon , 250) -- Check weapon every 250ms -Cache.Create("ServerId", GetServerId, 1000) -- Check server ID every second return Cache diff --git a/lib/utility/client/utility.lua b/lib/utility/client/utility.lua index 8379c8f..050a058 100644 --- a/lib/utility/client/utility.lua +++ b/lib/utility/client/utility.lua @@ -3,6 +3,7 @@ local blipIDs = {} local spawnedPeds = {} Locales = Locales or Require('modules/locales/shared.lua') +Point = Point or Require('lib/points/client/pointsv2.lua') ---Get the hash of a model (string or number) ---@param model string|number @@ -410,8 +411,8 @@ function Utility.GetClosestVehicle(coords, distanceScope, includePlayerVeh) end -- Deprecated point functions (no changes) -function Utility.RegisterPoint(pointID, pointCoords, pointDistance, _onEnter, _onExit, _nearby) - return Point.Register(pointID, pointCoords, pointDistance, nil, _onEnter, _onExit, _nearby) +function Utility.RegisterPoint(pointID, pointCoords, pointDistance, _onEnter, _onExit) + return Point.Register(pointID, pointCoords, pointDistance, nil, _onEnter, _onExit) end function Utility.GetPointById(pointID) From fd3f62f288353b0504a7d89ec335ac6ddc3f64b0 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 19 Aug 2025 04:22:52 -0400 Subject: [PATCH 52/54] playermetadata patch for qbx --- modules/framework/qbx_core/client.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/framework/qbx_core/client.lua b/modules/framework/qbx_core/client.lua index af928e0..88cac76 100644 --- a/modules/framework/qbx_core/client.lua +++ b/modules/framework/qbx_core/client.lua @@ -56,8 +56,7 @@ end ---@param metadata table | string ---@return table | string | number | boolean Framework.GetPlayerMetaData = function(metadata) - local playerData = Framework.GetPlayerData() - return playerData.metadata[metadata] + return Framework.GetPlayerData().metadata[metadata] end ---This will send a notification to the player. From 28b616f72d88477844e5dfff161f1d7832ac6bea Mon Sep 17 00:00:00 2001 From: pScripts <47689001+PiotreeQ@users.noreply.github.com> Date: Tue, 19 Aug 2025 11:08:43 +0200 Subject: [PATCH 53/54] Update server.lua --- modules/dispatch/piotreq_gpt/server/server.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/dispatch/piotreq_gpt/server/server.lua b/modules/dispatch/piotreq_gpt/server/server.lua index a960eb0..3c8f4ad 100644 --- a/modules/dispatch/piotreq_gpt/server/server.lua +++ b/modules/dispatch/piotreq_gpt/server/server.lua @@ -7,11 +7,11 @@ Dispatch.SendAlert = function(src, alertData) exports['piotreq_gpt']:SendAlert(src, { title = alertData.message or "No message provided", code = alertData.code or '10-80', - icon = alertData.icon or 'fas fa-question', + icon = alertData.icon or 'fa-solid fa-question', info = { - {icon = alertData.icon or 'fas fa-question', data = alertData.message or "No additional info", isStreet = false}, + {icon = 'fa-solid fa-road', isStreet = true}, + {icon = alertData.icon or 'fa-solid fa-question', data = alertData.message or "No additional info"}, }, - --jobs = alertData.jobs or "police", blip = { -- optional scale = alertData.blipData and alertData.blipData.scale or 1.0, sprite = alertData.blipData and alertData.blipData.sprite or 161, @@ -24,7 +24,7 @@ Dispatch.SendAlert = function(src, alertData) name = alertData.message or "Dispatch Alert" }, type = 'normal', -- default normal - canAnswer = true, -- default false + canAnswer = false, -- default false maxOfficers = 6, -- default 4 time = 10,-- 10 minutes, default 5 notifyTime = 8000, -- 8 seconds, default 7 @@ -36,4 +36,4 @@ RegisterNetEvent('community_bridge:Server:piotreq_gpt', function(data) Dispatch.SendAlert(src, data) end) -return Dispatch \ No newline at end of file +return Dispatch From ec8067828f0f22f45890d795176d6f2e8c7974e2 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Tue, 19 Aug 2025 06:30:52 -0400 Subject: [PATCH 54/54] prep for version bump --- fxmanifest.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 806abc0..8fa380e 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.11.1' +version '0.11.2' shared_scripts { '@ox_lib/init.lua',