I've tried using this as a progress bar which i made, which works like 10% of the time, but it wont work for certain numbers:
Is there anything that can fix it?
code_language.skript:
function progressBar(p: player, var: object, amount: integer, type: text) :: string:
set {_percent} to {_var} / {_amount} * 100.0
if {_percent} >= 100:
set {_percent} to 100
set {_progress} to {_percent} * 0.01 * 50
loop {_progress} times:
set {_rest} to 50 - {_progress}
set {_bar} to (join {_bar} and "&e&l|")
loop {_rest} times:
set {_bar} to (join {_bar} and "&8&l|")
if {_var} < 1:
if {_type} is "percent":
set {_fullbar} to "&8&l|||||||||||||||||||||||||||||||||||||||||||||||||| &f%{_percent}%%%"
else if {_type} is "nopercent":
set {_fullbar} to "&8&l||||||||||||||||||||||||||||||||||||||||||||||||||"
send action bar {_fullbar} to {_P}
return {_fullbar}
Is there anything that can fix it?