Qbox-project / qbx_core

http://qbox-project.github.io
Other
45 stars 109 forks source link

fix(server/player): status desync #459

Closed Demigod916 closed 2 months ago

Demigod916 commented 2 months ago

Description

This fixes an issue where the statebag statuses were clamped to 0-100 while the meta statuses wcould go over 100. causing them to become desynced. this would cause huds that use metadata values to say that players had more hunger/thirst than they really had and they would start dying for no apparent reason. it will now clamp both to 100.

repro here in issue #457

Checklist

Manason commented 2 months ago

Which is correct? Are these values supposed to be clamped to 100?

Demigod916 commented 2 months ago

Which is correct? Are these values supposed to be clamped to 100?

no clue, but it doesnt really make sense for hunger and thirst to be infinite? maybe a config for max cap defaulted to 100 is good

Demigod916 commented 2 months ago

Which is correct? Are these values supposed to be clamped to 100?

https://github.com/qbcore-framework/qb-core/blob/5c60c94197d0a31be30ca7f2f06c4a894699f2bd/server/player.lua#L294

looks like clamped to 100 is the intended behavior in qb-core