Open ArturMichalak opened 1 month ago
After some time there is synchronization, but not immediately.
After some time there is synchronization, but not immediately.
So it works as expected, great.
10 burgers without affecting hunger level is expected?
10 burgers without affecting hunger level is expected?
Hunger level ~= metadata
but are related Setting metadata solves the problem.
--- sets player hunger level in statebag
--- @param source number
--- @param amount number
local function setHunger(source, amount)
amount = lib.math.clamp(amount, 0, 100)
Player(source).state.hunger = amount
--- hotfix
local player = exports.qbx_core:GetPlayer(source)
if not player then return end
player.Functions.SetMetaData('hunger', amount)
--- hotfix
end
Summary
Metadata desynchronization problem still occurs, i think. Enforcing sychronization helps.
Reproduction
Set hunger level to 10
Buy 2 burgers in a shop
Eat bought food
No hunger bar update after eating second burger
Set hunger level to 10
Spawn 3 twerks candies
/additem 1 twerks_candy 3
Eat food
Food level in admin menu does not update
Expected behavior
Update metadata on changes
Actual behavior
as in reproduction
Additional context
I made a hotfix in smallresources that partially fixes this, but the fix needs to be done qbx_core.
https://github.com/Qbox-project/qbx_smallresources/pull/99/files
Current Version
v1.12.0
Custom Resources
unreleased version of qbx_vehiclekeys