forked from Simnation/Main
ed
e
This commit is contained in:
parent
ef4fd3eece
commit
3c6281a3d5
2 changed files with 24 additions and 11 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue