Hello everyone,
I'm trying to do a durability repair system with anvil but the thing is variables Dosen't save as integer is there any way to solve it?
I'm trying to do a durability repair system with anvil but the thing is variables Dosen't save as integer is there any way to solve it?
Code:
on right click on anvil:
if player's world is "RedStonePvP":
cancel event
set {_durability} to durability of player's tool parsed as integer
if {_durability} is max durability of player's tool:
send " {@prefix} &cYou already have full durability!"
stop
if player's tool is diamond sword:
else if {_durability} is between 781 and 1560:
if player has 16 redstone:
repair tool of player
play sound "ANVIL_USE" to player with volume 100 and pitch 5
send " {@prefix} &cYour item has been repaired!"
remove 16 redstone from player's inventory
else:
send " {@prefix} &cYou don't have enought redstone!"
else if {_durability} is between 391 and 780:
if player has 32 redstone:
repair tool of player
play sound "ANVIL_USE" to player with volume 100 and pitch 5
send " {@prefix} &cYour item has been repaired!"
remove 32 redstone from player's inventory
else:
send " {@prefix} &cYou don't have enought redstone!"
else if {_durability} is between 1 and 390:
if player has 64 redstone:
repair tool of player
play sound "ANVIL_USE" to player with volume 100 and pitch 5
send " {@prefix} &cYour item has been repaired!"
remove 64 redstone from player's inventory
else:
send " {@prefix} &cYou don't have enought redstone!"
else if player's tool is bow:
else if {_durability} is between 193 and 383:
if player has 16 redstone:
repair tool of player
play sound "ANVIL_USE" to player with volume 100 and pitch 5
send " {@prefix} &cYour item has been repaired!"
remove 16 redstone from player's inventory
else:
send " {@prefix} &cYou don't have enought redstone!"
else if {_durability} is between 97 and 192:
if player has 32 redstone:
repair tool of player
play sound "ANVIL_USE" to player with volume 100 and pitch 5
send " {@prefix} &cYour item has been repaired!"
remove 32 redstone from player's inventory
else:
send " {@prefix} &cYou don't have enought redstone!"
else if {_durability} is between 1 and 96:
if player has 64 redstone:
repair tool of player
play sound "ANVIL_USE" to player with volume 100 and pitch 5
send " {@prefix} &cYour item has been repaired!"
remove 64 redstone from player's inventory
else:
send " {@prefix} &cYou don't have enought redstone!"
else if player's tool is rod:
else if {_durability} is between 33 and 63:
if player has 16 redstone:
repair tool of player
play sound "ANVIL_USE" to player with volume 100 and pitch 5
send " {@prefix} &cYour item has been repaired!"
remove 16 redstone from player's inventory
else:
send " {@prefix} &cYou don't have enought redstone!"
else if {_durability} is between 17 and 32:
if player has 32 redstone:
repair tool of player
play sound "ANVIL_USE" to player with volume 100 and pitch 5
send " {@prefix} &cYour item has been repaired!"
remove 32 redstone from player's inventory
else:
send " {@prefix} &cYou don't have enought redstone!"
else if {_durability} is between 1 and 16:
if player has 64 redstone:
repair tool of player
play sound "ANVIL_USE" to player with volume 100 and pitch 5
send " {@prefix} &cYour item has been repaired!"
remove 64 redstone from player's inventory
else:
send " {@prefix} &cYou don't have enought redstone!"
else if player's tool is air:
send " {@prefix} &cHold something to repair!"
else:
send " {@prefix} &cThis item can't be repaired!"