execute if score @s loader.boxcount matches ..0 on target run function ws:work/misc/loader/nobox
scoreboard players add @s[scores={loader.boxcd=..179}] loader.boxcd 1
execute as @s[scores={loader.boxcd=59}] run function ws:work/misc/loader/editbox {id:3,size:1.0,sound:'block.vault.reject_rewarded_player',setscore:60}
execute as @s[scores={loader.boxcd=119}] run function ws:work/misc/loader/editbox {id:2,size:1.0,sound:'block.vault.reject_rewarded_player',setscore:120}
execute as @s[scores={loader.boxcd=179}] run function ws:work/misc/loader/editbox {id:1,size:1.0,sound:'block.vault.reject_rewarded_player',setscore:180}
scoreboard players operation @s loader.boxcount = @s loader.boxcd
scoreboard players operation @s loader.boxcount /= .load loader.boxcount
execute on target unless entity @s[team=gruzchik] run return 0
execute on target if items entity @s container.* minecraft:barrel[minecraft:custom_data~{box:1}] run return 0 
execute on target if items entity @s weapon.offhand minecraft:barrel[minecraft:custom_data~{box:1}] run return 0 
execute if data entity @s interaction if score @s loader.boxcount matches 3 run return run function ws:work/misc/loader/editbox {id:1,size:0.0,sound:'block.barrel.close',setscore:120}
execute if data entity @s interaction if score @s loader.boxcount matches 2 run return run function ws:work/misc/loader/editbox {id:2,size:0.0,sound:'block.barrel.close',setscore:60}
execute if data entity @s interaction if score @s loader.boxcount matches 1 run return run function ws:work/misc/loader/editbox {id:3,size:0.0,sound:'block.barrel.close',setscore:0}