options: cena: 0 function giveArmor(p: player, i: item): if balance of {_p} > ("{@cena}" parsed as number): remove ("{@cena}" parsed as number) from balance of {_p} give {_i} to {_p} else: send "Nie posiadasz wystarczajacej kwoty aby zakupic ta zbroje." to {_p} function getDec(p: player) :: text: set {_color} to convert rgb {pyraArmor::%{_p}%::r}, {pyraArmor::%{_p}%::g}, {pyraArmor::%{_p}%::b} to hex set {_color} to convert hexa {_color} to bin set {_color} to convert bin {_color} to decimal return {_color} function updateArmor(p: player): add 7, 16, 25 and 34 to {_slots::*} add leather helmet, leather chestplate, leather leggings and leather boots to {_items::*} loop {_items::*}: set {_item} to {_items::%loop-index%} with custom nbt tag "{display:{color:%getDec({_p})%}}" format gui slot {_slots::%loop-index%} of {_p} with {_item} with lore "&cCena: &4&l{@cena}" to run function giveArmor({_p}, ({_item})) format gui slot 3 of {_p} with red glass named "&c&l%{pyraArmor::%{_p}%::r}%" format gui slot 12 of {_p} with light green glass named "&a&l%{pyraArmor::%{_p}%::g}%" format gui slot 21 of {_p} with cyan glass named "&3&l%{pyraArmor::%{_p}%::b}%" function addColor(p: player, r: integer, g: integer, b: integer, type: text): add "r", "g" and "b" to {_rgb::*} loop {_rgb::*}: add {pyraArmor::%{_p}%::%loop-value%} to {undoPyraArmor::%{_p}%::%loop-value%::*} if {_type} is "add": loop {_rgb::*}: add {_%loop-value%} to {pyraArmor::%{_p}%::%loop-value%} if {pyraArmor::%{_p}%::%loop-value%} > 255: remove 255 from {pyraArmor::%{_p}%::%loop-value%} else if {pyraArmor::%{_p}%::%loop-value%} < 0: add 255 to {pyraArmor::%{_p}%::%loop-value%} if {_type} is "set": loop {_rgb::*}: set {pyraArmor::%{_p}%::%loop-value%} to {_%loop-value%} updateArmor({_p}) function undoColor(p: player): add "r", "g" and "b" to {_rgb::*} loop {_rgb::*}: set {_size} to size of {undoPyraArmor::%{_p}%::%loop-value%::*} set {pyraArmor::%{_p}%::%loop-value%} to {undoPyraArmor::%{_p}%::%loop-value%::%{_size}%} delete {undoPyraArmor::%{_p}%::%loop-value%::%{_size}%} updateArmor({_p}) on inventory close: delete {pyraArmor::%player%::*} and {undoPyraArmor::%player%::*} command /armor: permission: pyraArmor.usage aliases: pyraarmor trigger: set {pyraArmor::%player%::r}, {pyraArmor::%player%::g} and {pyraArmor::%player%::b} to 0 open virtual chest inventory with 5 rows named "" to player loop 45 times: format gui slot ((loop-value)-1) of player with gray glass named "&fpyraArmor" add "35:14", "35:4", "35:5", "35:3", "35:1", "35:10", "35:0", "35:7" and "35:15" to {_colors::*} add "255 0 0", "255 220 0", "100 255 0", "90 200 230", "255 140 0", "173 76 255", "255 255 255", "100 100 100" and "0 0 0" to {_rgb::*} add "r", "g" and "b" to {_list::*} loop 9 times: set {_type::*} to {_rgb::%loop-number%} split at " " format gui slot (35+(loop-number)) of player with ("%{_colors::%loop-number%}%" parsed as item) to run function addColor(player, ({_type::1} parsed as integer), ({_type::2} parsed as integer), ({_type::3} parsed as integer), ("set")) format gui slot 30 of player with 1 of barrier named "&fUndo" to run function undoColor(player) set {_} to "4 &c+1 1 0 0|13 &a+1 0 1 0|22 &3+1 0 0 1|2 &c-1 -1 0 0|11 &a-1 0 -1 0|20 &3-1 0 0 -1|5 &c+10 10 0 0|14 &a+10 0 10 0|23 &3+10 0 0 10|1 &c-10 -10 0 0|10 &a-10 0 -10 0|19 &3-10 0 0 -10" set {_balls::*} to {_} split at "|" loop {_balls::*}: set {_split::*} to loop-value split at " " loop {_split::*}: format gui slot ({_split::1} parsed as integer) of player with snowball named "%{_split::2}%" to run function addColor(player, ({_split::3} parsed as integer), ({_split::4} parsed as integer), ({_split::5} parsed as integer), "add") updateArmor(player) #Created by LuckyPotato v1.1 (11.04.2019 23:15)