Fix issue with GetThirst and GetHunger not working in ESX
This commit is contained in:
1 parent
c399fbaca4
commit
71cd1e0676
1 file changed
+16
-6
@@ -248,22 +248,32 @@ Framework.AddHunger = function(src, value)
|
|||||||
return levelForEsx
|
return levelForEsx
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will get the hunger of a player
|
--- @description This will get the hunger of a player (ESX we get the percent of the status)
|
||||||
--- @param src number
|
--- @param src number
|
||||||
--- @return number | nil
|
--- @return number | nil
|
||||||
Framework.GetHunger = function(src)
|
Framework.GetHunger = function(src)
|
||||||
local status = Framework.GetStatus(src, "status")
|
local status = Framework.GetStatus(src, "status")
|
||||||
if not status then return 0 end
|
if not status then return nil end
|
||||||
return status.hunger
|
|
||||||
|
for _, entry in ipairs(status) do
|
||||||
|
if entry.name == "hunger" then
|
||||||
|
return entry.percent
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will get the thirst of a player
|
--- @description This will get the thirst of a player (ESX we get the percent of the status)
|
||||||
--- @param src any
|
--- @param src any
|
||||||
--- @return number | nil
|
--- @return number | nil
|
||||||
Framework.GetThirst = function(src)
|
Framework.GetThirst = function(src)
|
||||||
local status = Framework.GetStatus(src, "status")
|
local status = Framework.GetStatus(src, "status")
|
||||||
if not status then return 0 end
|
if not status then return nil end
|
||||||
return status.thirst
|
|
||||||
|
for _, entry in ipairs(status) do
|
||||||
|
if entry.name == "thirst" then
|
||||||
|
return entry.percent
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @description This will get the phone number of a player
|
--- @description This will get the phone number of a player
|
||||||
|
|||||||
Reference in new issue
Block a user