Merge pull request #76 from The-Order-Of-The-Sacred-Framework/dev

0.6.1
This commit is contained in:
MrNewb authored and GitHub committed 2025-05-02 12:02:32 -04:00
commit a3a06d4ae9
7 files changed
+35 -19

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ lua54 'yes'
use_experimental_fxv2_oal 'yes' use_experimental_fxv2_oal 'yes'
author 'The Order of the Sacred Framework' 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.' 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 { shared_scripts {
'@ox_lib/init.lua', '@ox_lib/init.lua',
+5 -9
View File
@@ -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 -- Comparison functions for client-side state
local function GetPed() local function GetPed()
return PlayerPedId() return PlayerPedId()
@@ -29,12 +28,9 @@ local function GetWeapon()
return GetSelectedPedWeapon(ped) return GetSelectedPedWeapon(ped)
end end
AddEventHandler('onResourceStart', function(resource) Cache.Create("Ped", GetPed, 1000) -- Check ped every second (adjust as needed)
if resource ~= GetCurrentResourceName() then return end Cache.Create("Vehicle", GetVehicle, 500) -- Check vehicle every 500ms
Cache.Create("Ped", GetPed, 1000) -- Check ped every second (adjust as needed) Cache.Create("Seat", GetVehicleSeat, 500) -- Check if in vehicle every 500ms
Cache.Create("Vehicle", GetVehicle, 500) -- Check vehicle every 500ms Cache.Create("Weapon", GetWeapon, 250) -- Check weapon every 250ms
Cache.Create("Seat", GetVehicleSeat, 500) -- Check if in vehicle every 500ms
Cache.Create("Weapon", GetWeapon, 250) -- Check weapon every 250ms
end)
return Cache return Cache
+4 -4
View File
@@ -1,7 +1,6 @@
Cache = {} local Cache = {}
Cache.Caches = {} Cache.Caches = Cache.Caches or {}
Cache.LoopRunning = Cache.LoopRunning or false
Cache.LoopRunning = false
local max = 5000 local max = 5000
local function StartLoop() local function StartLoop()
@@ -54,6 +53,7 @@ function Cache.Create(name, compare, waitTime)
for _, onChange in pairs(Cache.Caches[name].OnChange) do for _, onChange in pairs(Cache.Caches[name].OnChange) do
onChange(Cache.Caches[name].Value, nil) onChange(Cache.Caches[name].Value, nil)
end end
print("Cache created: " .. name .. " with initial value: " .. tostring(Cache.Caches[name].Value))
return StartLoop() return StartLoop()
end end
+5 -5
View File
@@ -57,18 +57,18 @@ function Scaleform.Run(scaleform, onUpdate)
if runningScaleform then return end if runningScaleform then return end
runningScaleform = scaleform runningScaleform = scaleform
CreateThread(function() CreateThread(function()
while runningScaleform do while runningScaleform do
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255, 0) DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255, 0)
if onUpdate then if onUpdate then
shouldQuit = onUpdate() shouldQuit = onUpdate()
if shouldQuit then if shouldQuit then
Scaleform.Stop() Scaleform.Stop()
break break
end end
end end
Wait(2) Wait(2)
end end
end) end)
end end
function Scaleform.Stop() function Scaleform.Stop()
+6
View File
@@ -134,6 +134,12 @@ Framework.GetStatus = function(src, column)
return xPlayer.get(column) or nil return xPlayer.get(column) or nil
end 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) -- Framework.AddThirst(src, value)
-- Adds the specified value from the player's thirst level. -- Adds the specified value from the player's thirst level.
Framework.AddThirst = function(src, value) Framework.AddThirst = function(src, value)
+7
View File
@@ -253,6 +253,13 @@ Framework.GetHunger = function(src)
return newHunger return newHunger
end 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 ---This will get the thirst of a player
---@param src any ---@param src any
+7
View File
@@ -218,6 +218,13 @@ Framework.GetHunger = function(src)
return newHunger return newHunger
end 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. ---This will return the players thirst level.
---@param src number ---@param src number
---@return number ---@return number