mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-12 11:00:25 +01:00
Fix hudbars bug value > max
This commit is contained in:
parent
a0f2f09e90
commit
22efd5dfb7
@ -180,14 +180,6 @@ function hb.change_hudbar(player, identifier, new_value, new_max_value)
|
|||||||
local hudtable = hb.get_hudtable(identifier)
|
local hudtable = hb.get_hudtable(identifier)
|
||||||
local value_changed, max_changed = false, false
|
local value_changed, max_changed = false, false
|
||||||
|
|
||||||
if new_value ~= nil and hudtable.hudstate[name] then
|
|
||||||
if new_value ~= hudtable.hudstate[name].value then
|
|
||||||
hudtable.hudstate[name].value = new_value
|
|
||||||
value_changed = true
|
|
||||||
end
|
|
||||||
elseif hudtable.hudstate[name] then
|
|
||||||
new_value = hudtable.hudstate[name].value
|
|
||||||
end
|
|
||||||
if new_max_value ~= nil then
|
if new_max_value ~= nil then
|
||||||
if new_max_value ~= hudtable.hudstate[name].max then
|
if new_max_value ~= hudtable.hudstate[name].max then
|
||||||
hudtable.hudstate[name].max = new_max_value
|
hudtable.hudstate[name].max = new_max_value
|
||||||
@ -197,6 +189,18 @@ function hb.change_hudbar(player, identifier, new_value, new_max_value)
|
|||||||
new_max_value = (hudtable.hudstate[name] or {max = 0}).max
|
new_max_value = (hudtable.hudstate[name] or {max = 0}).max
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if new_value ~= nil and hudtable.hudstate[name] then
|
||||||
|
if new_value ~= hudtable.hudstate[name].value then
|
||||||
|
if new_value > new_max_value then
|
||||||
|
new_value = new_max_value
|
||||||
|
end
|
||||||
|
hudtable.hudstate[name].value = new_value
|
||||||
|
value_changed = true
|
||||||
|
end
|
||||||
|
elseif hudtable.hudstate[name] then
|
||||||
|
new_value = hudtable.hudstate[name].value
|
||||||
|
end
|
||||||
|
|
||||||
local main_error_text =
|
local main_error_text =
|
||||||
"[hudbars] Bad call to hb.change_hudbar, identifier: “"..tostring(identifier).."”, player name: “"..name.."”. "
|
"[hudbars] Bad call to hb.change_hudbar, identifier: “"..tostring(identifier).."”, player name: “"..name.."”. "
|
||||||
if new_max_value < new_value then
|
if new_max_value < new_value then
|
||||||
|
Loading…
Reference in New Issue
Block a user