Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hunger level increments only after first burger #470

Open
ArturMichalak opened this issue May 13, 2024 · 8 comments
Open

Hunger level increments only after first burger #470

ArturMichalak opened this issue May 13, 2024 · 8 comments
Labels
bug Something isn't working need repro This bug report needs confirmation

Comments

@ArturMichalak
Copy link

ArturMichalak commented May 13, 2024

Summary

Metadata desynchronization problem still occurs, i think.
Enforcing sychronization helps.

Reproduction

  1. Set hunger level to 10

  2. Buy 2 burgers in a shop

  3. Eat bought food

  4. No hunger bar update after eating second burger

  5. Set hunger level to 10

  6. Spawn 3 twerks candies /additem 1 twerks_candy 3

  7. Eat food

  8. Food level in admin menu does not update

Expected behavior

Update metadata on changes

Actual behavior

as in reproduction

Additional context

obraz

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

@ArturMichalak ArturMichalak added bug Something isn't working need repro This bug report needs confirmation labels May 13, 2024
@ArturMichalak
Copy link
Author

After some time there is synchronization, but not immediately.

@TonybynMp4
Copy link
Contributor

After some time there is synchronization, but not immediately.

So it works as expected, great.

@ArturMichalak
Copy link
Author

10 burgers without affecting hunger level is expected?

@TonybynMp4
Copy link
Contributor

10 burgers without affecting hunger level is expected?

Hunger level ~= metadata

@ArturMichalak
Copy link
Author

ArturMichalak commented May 14, 2024

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

@ArturMichalak ArturMichalak changed the title Hunger level rises only after first burger Hunger level increments only after first burger May 15, 2024
@TonybynMp4
Copy link
Contributor

Think this can be closed now?

@solareon
Copy link
Member

solareon commented Aug 9, 2024

Think this can be closed now?

Soon ™️

@TonybynMp4
Copy link
Contributor

nvm, thought it wasn't a problem for a long time, forgot qbox still supported qb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need repro This bug report needs confirmation
Projects
Status: Todo
Development

No branches or pull requests

3 participants