-
Notifications
You must be signed in to change notification settings - Fork 143
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 and thirst states desynced from metadata #457
Labels
Comments
Demigod916
added
bug
Something isn't working
need repro
This bug report needs confirmation
labels
Apr 23, 2024
fix manason pls |
AddEventHandler('qbx_core:server:onSetMetaData', function(key, _, new, source)
if key == 'hunger' or key == 'thirst' or key == 'stress' then
Player(source).state:set(key, new, true)
end
end) |
nvm looks like the state is being synced in the self.Functions.SetMetaData. but still experiencing the desynced values between metadata and state for status. will work on a repro |
local PlayerState = LocalPlayer.state
CreateThread(function ()
while true do
print("ON LOOP")
lib.print.info("STATE:", "HUNGER:", PlayerState.hunger)
lib.print.info("STATE:", "THIRST:", PlayerState.thirst)
lib.print.info("META:", "HUNGER:", QBX.PlayerData.metadata.hunger)
lib.print.info("META:", "THIRST:", QBX.PlayerData.metadata.thirst)
Wait(500)
print("========================================================")
end
end)
RegisterCommand('addhunger', function ()
TriggerServerEvent('consumables:server:addHunger', QBX.PlayerData.metadata.hunger + 1000) --- this event just sets the hunger using setMetaData function
end)
RegisterCommand('addthirst', function ()
TriggerServerEvent('consumables:server:addThirst', QBX.PlayerData.metadata.thirst + 1000)--- this event just sets the thirst using setMetaData function
end)
RegisterNetEvent('hud:client:UpdateNeeds', function (hunger, thirst)
print("ON UPDATE")
lib.print.info("STATE:", "HUNGER:", PlayerState.hunger)
lib.print.info("STATE:", "THIRST:", PlayerState.thirst)
lib.print.info("META:", "HUNGER:", QBX.PlayerData.metadata.hunger)
lib.print.info("META:", "THIRST:", QBX.PlayerData.metadata.thirst)
print("========================================================")
end) here is a repro and then also i made a pr #459 |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
hunger and thirst states desynced from metadata
Reproduction
Expected behavior
state and metadata synced for backwards compat.
Actual behavior
dies while hunger and thirst are not empty on hud using metadata
Additional context
assume that this can be fixed with a onMetaChange handler in the core
Current Version
v1.11.0
Custom Resources
.
The text was updated successfully, but these errors were encountered: