refactor(client/main): Use pairs loop

This commit is contained in:
Linden
2021-06-13 09:04:56 +10:00
committed by GitHub
parent 5aa50f5ac7
commit 0087ace534
+3 -3
View File
@@ -58,14 +58,14 @@ AddEventHandler('esx_status:onTick', function(data)
local prevHealth = GetEntityHealth(playerPed)
local health = prevHealth
for i=1, #data do
if data[i].name == 'hunger' and data[i].percent == 0 then
for k, v in pairs(data) do
if v.name == 'hunger' and v.percent == 0 then
if prevHealth <= 150 then
health = health - 5
else
health = health - 1
end
elseif data[i].name == 'thirst' and data[i].percent == 0 then
elseif v.name == 'thirst' and v.percent == 0 then
if prevHealth <= 150 then
health = health - 5
else