variable saved as integer for durability

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Mr_Allawi_

Member
Sep 20, 2021
12
0
1
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?

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!"
 
Status
Not open for further replies.