diff --git a/resources/[inventory]/nordi_petbowl/config.lua b/resources/[inventory]/nordi_petbowl/config.lua index b537abc4c..8b7669a22 100644 --- a/resources/[inventory]/nordi_petbowl/config.lua +++ b/resources/[inventory]/nordi_petbowl/config.lua @@ -50,11 +50,11 @@ Config.FillItems = { -- Consumption Effects Config.Effects = { food = { - hunger = 10, + hunger = 20, -- Increased from 10 to be more noticeable stress = -5 }, water = { - thirst = 10, + thirst = 20, -- Increased from 10 to be more noticeable stress = -2 } } diff --git a/resources/[inventory]/nordi_petbowl/server.lua b/resources/[inventory]/nordi_petbowl/server.lua index c8ec8fa7d..335715353 100644 --- a/resources/[inventory]/nordi_petbowl/server.lua +++ b/resources/[inventory]/nordi_petbowl/server.lua @@ -143,23 +143,36 @@ RegisterNetEvent('pet-bowls:server:consumeBowl', function(bowlId) {newLevel, bowlId} ) - -- Apply effects to player + -- Apply effects to player - FIXED VERSION local effects = Config.Effects[bowl.type] if effects then - if effects.hunger then - -- Apply hunger effect - TriggerClientEvent('hud:client:UpdateHunger', src, effects.hunger, true) + -- Get player metadata + local metadata = Player.PlayerData.metadata + + -- Apply hunger effect + if effects.hunger and bowl.type == 'food' then + metadata.hunger = math.min(100, metadata.hunger + effects.hunger) + Player.Functions.SetMetadata('hunger', metadata.hunger) + print('^2[Pet-Bowls]^7 Updated player hunger to ' .. metadata.hunger) end - if effects.thirst then - -- Apply thirst effect - TriggerClientEvent('hud:client:UpdateThirst', src, effects.thirst, true) + -- Apply thirst effect + if effects.thirst and bowl.type == 'water' then + metadata.thirst = math.min(100, metadata.thirst + effects.thirst) + Player.Functions.SetMetadata('thirst', metadata.thirst) + print('^2[Pet-Bowls]^7 Updated player thirst to ' .. metadata.thirst) end + -- Apply stress effect (if your server uses this) if effects.stress then - -- Apply stress effect - TriggerClientEvent('hud:client:UpdateStress', src, effects.stress) + if metadata.stress then + metadata.stress = math.max(0, metadata.stress + effects.stress) -- Stress is negative in config + Player.Functions.SetMetadata('stress', metadata.stress) + end end + + -- Sync the updated status to the client + TriggerClientEvent('hud:client:UpdateNeeds', src, metadata.hunger, metadata.thirst) end -- Update all clients