mirror of
https://github.com/jimathy/jim-consumables.git
synced 2026-08-16 22:16:02 +01:00
Stop double calculation of hunger and thirst
Missed this, it's doing the player stats + new stats and then in jim_bridge doing this again and doubling it all up
This commit is contained in:
@@ -294,31 +294,17 @@ RegisterNetEvent(getScript()..':Consume', function(itemName)
|
|||||||
|
|
||||||
if not cancelled then
|
if not cancelled then
|
||||||
hideText()
|
hideText()
|
||||||
local needTypes = { }
|
local needTypes = { }
|
||||||
|
|
||||||
if needStats then
|
if needStats then
|
||||||
|
|
||||||
--jsonPrint(needStats)
|
--jsonPrint(needStats)
|
||||||
if needStats.hunger > 0 then
|
if needStats.hunger > 0 then
|
||||||
if Core and Core.Functions then
|
needTypes.hunger = needTypes.hunger > 100 and 100 or needTypes.hunger
|
||||||
needTypes.hunger = (Core.Functions.GetPlayerData().metadata["hunger"] or 0) + needStats.hunger
|
|
||||||
needTypes.hunger = needTypes.hunger > 100 and 100 or needTypes.hunger
|
|
||||||
|
|
||||||
elseif ESX and ESX.GetPlayerData then
|
|
||||||
needTypes.hunger = (needStats.hunger / 100) * 1000000
|
|
||||||
needTypes.hunger = needTypes.hunger > 1000000 and 1000000 or needTypes.hunger
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if needStats.thirst > 0 then
|
if needStats.thirst > 0 then
|
||||||
if Core and Core.Functions then
|
needTypes.thirst = needTypes.thirst > 100 and 100 or needTypes.thirst
|
||||||
needTypes.thirst = (Core.Functions.GetPlayerData().metadata["thirst"] or 0) + needStats.thirst
|
|
||||||
needTypes.thirst = needTypes.thirst > 100 and 100 or needTypes.thirst
|
|
||||||
|
|
||||||
elseif ESX and ESX.GetPlayerData then
|
|
||||||
needTypes.thirst = (needStats.thirst / 100) * 1000000
|
|
||||||
needTypes.thirst = needTypes.thirst > 1000000 and 1000000 or needTypes.thirst
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
TriggerServerEvent(getScript()..":server:finishConsume", needTypes)
|
TriggerServerEvent(getScript()..":server:finishConsume", needTypes)
|
||||||
|
|||||||
Reference in New Issue
Block a user