-
-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refacttor(bridge/ox): update ox_core version dependency
- Loading branch information
Showing
2 changed files
with
36 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
CreateThread(function() lib.load('@ox_core.imports.client') end) | ||
if not lib.checkDependency('ox_core', '0.21.3', true) then return end | ||
|
||
local Ox = require '@ox_core.lib.init' --[[@as OxClient]] | ||
local player = Ox.GetPlayer() | ||
|
||
RegisterNetEvent('ox:playerLogout', client.onLogout) | ||
|
||
RegisterNetEvent('ox:setGroup', function(name, grade) | ||
PlayerData.groups[name] = grade | ||
OnPlayerData('groups') | ||
PlayerData.groups[name] = grade | ||
OnPlayerData('groups') | ||
end) | ||
|
||
---@diagnostic disable-next-line: duplicate-set-field | ||
function client.setPlayerStatus(values) | ||
for name, value in pairs(values) do | ||
-- Thanks to having status values setup out of 1000000 (matching esx_status's standard) | ||
-- we need to awkwardly change the value | ||
if value > 100 or value < -100 then | ||
-- Hunger and thirst start at 0 and go up to 100 as you get hungry/thirsty (inverse of ESX) | ||
if (name == 'hunger' or name == 'thirst') then | ||
value = -value | ||
end | ||
for name, value in pairs(values) do | ||
-- Thanks to having status values setup out of 1000000 (matching esx_status's standard) | ||
-- we need to awkwardly change the value | ||
if value > 100 or value < -100 then | ||
-- Hunger and thirst start at 0 and go up to 100 as you get hungry/thirsty (inverse of ESX) | ||
if (name == 'hunger' or name == 'thirst') then | ||
value = -value | ||
end | ||
|
||
value = value * 0.0001 | ||
end | ||
value = value * 0.0001 | ||
end | ||
|
||
---@diagnostic disable-next-line: undefined-global | ||
player.addStatus(name, value) | ||
end | ||
---@diagnostic disable-next-line: undefined-global | ||
player.addStatus(name, value) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters