This commit is contained in:
2026-02-15 18:47:56 +01:00
commit 596d70e72f
19 changed files with 1099 additions and 0 deletions

60
client/frameworks.lua Normal file
View File

@@ -0,0 +1,60 @@
if GetResourceState('ox_core'):find('start') then
local file = ('imports/%s.lua'):format(IsDuplicityVersion() and 'server' or 'client')
local import = LoadResourceFile('ox_core', file)
local chunk = assert(load(import, ('@@ox_core/%s'):format(file)))
chunk()
if player then
PlayerLoaded = true
end
RegisterNetEvent('ox:playerLoaded', function()
PlayerLoaded = true
InitializeHUD()
end)
RegisterNetEvent('ox:playerLogout', function()
PlayerLoaded = false
HUD = false
SendMessage('toggleHud', HUD)
end)
AddEventHandler('ox:statusTick', function(values)
SendMessage('status', values)
end)
end
if GetResourceState('es_extended'):find('start') then
local ESX = exports['es_extended']:getSharedObject()
if ESX.PlayerLoaded then
PlayerLoaded = true
end
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function()
PlayerLoaded = true
InitializeHUD()
end)
RegisterNetEvent('esx:onPlayerLogout')
AddEventHandler('esx:onPlayerLogout', function()
PlayerLoaded = false
HUD = false
SendMessage('toggleHud', HUD)
end)
AddEventHandler('esx_status:onTick', function(data)
local hunger, thirst, stress
for i = 1, #data do
if data[i].name == 'thirst' then thirst = math.floor(data[i].percent) end
if data[i].name == 'hunger' then hunger = math.floor(data[i].percent) end
if data[i].name == 'stress' then stress = math.floor(data[i].percent) end
end
SendMessage('status', {
hunger = hunger,
thirst = thirst,
stress = GetConvar('hud:stress', 'false') and stress,
})
end)
end