1. 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 comminuty!

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

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Repair System

Discussion in 'Requests' started by Cupex, Jun 13, 2022.

  1. Cupex

    Cupex Member

    Joined:
    Feb 16, 2020
    Messages:
    42
    Likes Received:
    1
    Category: Tool Repair

    Suggested name: Repair

    Spigot/Skript Version: PaperMC-1.18.2/the newest

    What I want:
    So that's really easy to explain.
    Use any tool (sword, axe, pickaxe, hoe, shovel, etc) to /repair. Depending on the damage and the type of tool (wood, stone, gold, iron, diamond, netherite), /repair costs more. So if the tool is not damaged too much, it costs less than if the tool is almost broken.

    Thanks in advance ^^


    Ideas for commands: /repair

    Ideas for permissions: system.repair

    When I'd like it by: as soon as someone has time to write this.
     
  2. Best Answer:
    Post #2 by Kapo, Jun 18, 2022
  3. Kapo

    Kapo New Member

    Joined:
    Jun 18, 2022
    Messages:
    9
    Likes Received:
    2
    Code (Text):
    1. command /repair:
    2.     permission: system.repair
    3.     permission message: "&cYou don't have enough permission."
    4.     description: &fRepairs your item for a price
    5.     trigger:
    6.         if player's tool is any pickaxe, axe, shovel, hoe, armor, bow, crossbow, shield, trident, flint and steel, fishing rod, shears or sword:
    7.             if player's tool's durability > 0:
    8.                 set {_d} to durability of player's tool
    9.                 if type of player's tool is diamond tool:
    10.                     set {_pMP} to 0.5*{_d}
    11.                 if type of player's tool is netherite tool:
    12.                     set {_pMP} to 0.8*{_d}
    13.                 if type of player's tool is gold tool:
    14.                     set {_pMP} to 0.3*{_d}
    15.                 if type of player's tool is iron tool:
    16.                     set {_pMP} to 0.25*{_d}
    17.                 if type of player's tool is stone tool:
    18.                     set {_pMP} to 0.10*{_d}
    19.                 if type of player's tool is wooden tool:
    20.                     set {_pMP} to 0.05*{_d}
    21.                 if player's tool is a bow, crossbow, shears, fishing rod, flint and steel, trident or shield:
    22.                     set {_pMP} to 0.13*{_d}
    23.                 if player's balance > {_pMP}:
    24.                     remove {_pMP} from player's balance
    25.                     repair player's tool
    26.                     send "&aYou successfuly repaired your tool and paid %{_pMP}%$ for the repair." to player
    27.                     play sound "block.anvil.use" with volume 2 and pitch 1 to player
    28.                 else:
    29.                     send "&cYou don't have enough money to pay for the repair. (%{_pMP}-player's balance%$ needed)" to player
    30.                     play sound "block.chest.close" with volume 2 and pitch 0 to player
    31.             else:
    32.                 send "&cYour tool is not damaged and can't be repaired." to player
    33.                 play sound "block.chest.close" with volume 2 and pitch 0 to player
    34.         else:
    35.             send "&cYou must be holding a tool to perform this command." to player
    36.             play sound "block.chest.close" with volume 2 and pitch 0 to player
    simple skript, you can change the {_pMP} multipliers to whatever number you'd like to be charged per durability point for each tool type
     
  4. Cupex

    Cupex Member

    Joined:
    Feb 16, 2020
    Messages:
    42
    Likes Received:
    1
    bro, thanks!! You are a legend!
     

Share This Page

Loading...