From df0dedd46c673aaa7b5386347e990e37b2892587 Mon Sep 17 00:00:00 2001 From: gononono64 <96976330+gononono64@users.noreply.github.com> Date: Fri, 2 May 2025 03:11:06 -0500 Subject: [PATCH 1/4] Cache fix on initial load up of server Issue with cache where it didnt load the default cache (ped, vehicle, seat and weapon) on initial loadup of server This is a pretty critical bug and should be tested and pushed asap --- lib/cache/client/cache.lua | 14 +++++--------- lib/cache/shared/cache.lua | 8 ++++---- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/cache/client/cache.lua b/lib/cache/client/cache.lua index add0124..7c6fd1d 100644 --- a/lib/cache/client/cache.lua +++ b/lib/cache/client/cache.lua @@ -1,5 +1,4 @@ -Cache = Cache or Require("lib/cache/shared/cache.lua") - +Cache = Require("lib/cache/shared/cache.lua") -- Comparison functions for client-side state local function GetPed() return PlayerPedId() @@ -29,12 +28,9 @@ local function GetWeapon() return GetSelectedPedWeapon(ped) end -AddEventHandler('onResourceStart', function(resource) - if resource ~= GetCurrentResourceName() then return end - Cache.Create("Ped", GetPed, 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 -end) +Cache.Create("Ped", GetPed, 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 return Cache \ No newline at end of file diff --git a/lib/cache/shared/cache.lua b/lib/cache/shared/cache.lua index df2ee0e..30e568f 100644 --- a/lib/cache/shared/cache.lua +++ b/lib/cache/shared/cache.lua @@ -1,7 +1,6 @@ -Cache = {} -Cache.Caches = {} - -Cache.LoopRunning = false +local Cache = {} +Cache.Caches = Cache.Caches or {} +Cache.LoopRunning = Cache.LoopRunning or false local max = 5000 local function StartLoop() @@ -54,6 +53,7 @@ function Cache.Create(name, compare, waitTime) for _, onChange in pairs(Cache.Caches[name].OnChange) do onChange(Cache.Caches[name].Value, nil) end + print("Cache created: " .. name .. " with initial value: " .. tostring(Cache.Caches[name].Value)) return StartLoop() end From 3c96d6a2bc6be8a78e91348773034fab86514358 Mon Sep 17 00:00:00 2001 From: gononono64 <96976330+gononono64@users.noreply.github.com> Date: Fri, 2 May 2025 03:13:07 -0500 Subject: [PATCH 2/4] GetIsPlayerDead added Added GetIsPlayerDead to framework serverside. Needs testing on esx and qbox --- modules/framework/es_extended/server.lua | 6 ++++++ modules/framework/qb-core/server.lua | 7 +++++++ modules/framework/qbx_core/server.lua | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/modules/framework/es_extended/server.lua b/modules/framework/es_extended/server.lua index fc65ceb..365a3f2 100644 --- a/modules/framework/es_extended/server.lua +++ b/modules/framework/es_extended/server.lua @@ -134,6 +134,12 @@ Framework.GetStatus = function(src, column) return xPlayer.get(column) or nil end +Framework.GetIsPlayerDead = function(src) + local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end + return xPlayer.get("is_dead") or false +end + -- Framework.AddThirst(src, value) -- Adds the specified value from the player's thirst level. Framework.AddThirst = function(src, value) diff --git a/modules/framework/qb-core/server.lua b/modules/framework/qb-core/server.lua index 8df05f2..98a52a8 100644 --- a/modules/framework/qb-core/server.lua +++ b/modules/framework/qb-core/server.lua @@ -253,6 +253,13 @@ Framework.GetHunger = function(src) return newHunger end +Framework.GetIsPlayerDead = function(src) + local player = QBCore.Functions.GetPlayer(src) + if not player then return end + local playerData = player.PlayerData + return playerData.metadata.isdead or false +end + ---This will get the thirst of a player ---@param src any diff --git a/modules/framework/qbx_core/server.lua b/modules/framework/qbx_core/server.lua index 94e30c4..2674f9d 100644 --- a/modules/framework/qbx_core/server.lua +++ b/modules/framework/qbx_core/server.lua @@ -218,6 +218,13 @@ Framework.GetHunger = function(src) return newHunger end +Framework.GetIsPlayerDead = function(src) + local player = QBox:GetPlayer(src) + if not player then return end + local playerData = player.PlayerData + return playerData.metadata.isdead or false +end + ---This will return the players thirst level. ---@param src number ---@return number From d528c1f342f490894cda21af6ca049c7ea96669c Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Fri, 2 May 2025 09:09:15 -0400 Subject: [PATCH 3/4] whitespace --- lib/scaleform/client/scaleform.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/scaleform/client/scaleform.lua b/lib/scaleform/client/scaleform.lua index 1071b25..aeeb2fe 100644 --- a/lib/scaleform/client/scaleform.lua +++ b/lib/scaleform/client/scaleform.lua @@ -57,18 +57,18 @@ function Scaleform.Run(scaleform, onUpdate) if runningScaleform then return end runningScaleform = scaleform CreateThread(function() - while runningScaleform do + while runningScaleform do DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255, 0) - if onUpdate then + if onUpdate then shouldQuit = onUpdate() - if shouldQuit then + if shouldQuit then Scaleform.Stop() break end end Wait(2) - end - end) + end + end) end function Scaleform.Stop() From a0cb0edf78f0b9476bd1d83b49b890ad8dedb34f Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Fri, 2 May 2025 12:01:56 -0400 Subject: [PATCH 4/4] 0.6.1 --- fxmanifest.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index 2d5e89f..f968048 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ lua54 'yes' use_experimental_fxv2_oal 'yes' author 'The Order of the Sacred Framework' description 'A bridge made for the community to use as a base for their own projects. This bridge will allow a single format to work with nearly all commonly used systems while still offering expandability.' -version '0.6.0' +version '0.6.1' shared_scripts { '@ox_lib/init.lua',