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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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

Limit the uses of an item (Sellwand)

Discussion in 'Skript' started by NotNinjaTalon, Mar 25, 2020.

Thread Status:
Not open for further replies.
  1. NotNinjaTalon

    NotNinjaTalon Member

    Joined:
    Mar 2, 2020
    Messages:
    12
    Likes Received:
    1
    Hello, I'm currently making a skyblock server, anyways I've been trying to skript sellwands. I'm wanting various ones limited to a certain amount of uses, at the moment I've only got an infinite one. How could I make this limited to around 100 uses etc. Hope one of you guys can help me out!

    Heres my current code:

    Code (Text):
    1. options:
    2.     tag: &d&lSELLWAND &8»&7
    3.  
    4. command /sellwand:
    5.     trigger:
    6.         if player's inventory contains name tag named "&8» &d&lSELLWAND" with lore "&7  &oRight-Click &7on a chest.":
    7.             send "{@tag} You already have a &dsell wand&7."
    8.             stop
    9.         else:
    10.             give 1 name tag named "&8» &d&lSELLWAND" with lore "&7  &oRight-Click &7on a chest." to player
    11.             send "{@tag} You got a &dsell wand&7."
    12.             stop
    13.  
    14. on right-click:
    15.     if event-block is chest or trapped chest:
    16.         if player's tool is name tag named "&8» &d&lSELLWAND" with lore "&7  &oRight-Click &7on a chest.":
    17.             cancel event
    18.             loop all items in inventory of clicked block:
    19.                 if loop-item is cactus:
    20.  
    21.                     set {_items} to number of cactus in inventory of event-block
    22.  
    23.                     set {_money} to unformat("%{balance::%player%}%")
    24.                     set {_result} to ({_items} * 10)
    25.                     add {_result} to {_money}
    26.                     set {_resultFormat} to format({_result})
    27.                     set {balance::%player%} to format({_money})
    28.  
    29.                     send "{@tag} You sold &d%{_items}% &7of &dcactus &7and you got &d$%{_resultFormat}%&7." to player
    30.  
    31.                     remove all cactus from inventory of event-block
    32.  
    33.                 if loop-item is sugar cane:
    34.  
    35.                     set {_items} to number of sugar cane in inventory of event-block
    36.  
    37.                     set {_money} to unformat("%{balance::%player%}%")
    38.                     set {_result} to ({_items} * 5)
    39.                     add {_result} to {_money}
    40.                     set {_resultFormat} to format({_result})
    41.                     set {balance::%player%} to format({_money})
    42.  
    43.                     send "{@tag} You sold &d%{_items}% &7of &dsugar cane &7and you got &d$%{_resultFormat}%&7." to player
    44.  
    45.                     remove all sugar cane from inventory of event-block
    46.  
    47.                 if loop-item is pumpkin:
    48.  
    49.                     set {_items} to number of sugar cane in inventory of event-block
    50.  
    51.                     set {_money} to unformat("%{balance::%player%}%")
    52.                     set {_result} to ({_items} * 6.25)
    53.                     add {_result} to {_money}
    54.                     set {_resultFormat} to format({_result})
    55.                     set {balance::%player%} to format({_money})
    56.  
    57.                     send "{@tag} You sold &d%{_items}% &7of &dpumpkin &7and you got &d$%{_resultFormat}%&7." to player
    58.  
    59.                     remove all pumpkin from inventory of event-block
    60.  
    61.                 if loop-item is melon slice:
    62.  
    63.                     set {_items} to number of melon slice in inventory of event-block
    64.  
    65.                     set {_money} to unformat("%{balance::%player%}%")
    66.                     set {_result} to ({_items} * 2.5)
    67.                     add {_result} to {_money}
    68.                     set {_resultFormat} to format({_result})
    69.                     set {balance::%player%} to format({_money})
    70.  
    71.                     send "{@tag} You sold &d%{_items}% &7of &dmelon slice &7and you got &d$%{_resultFormat}%&7." to player
    72.  
    73.                     remove all melon slice from inventory of event-block
    74.  
    75.                 if loop-item is poppy:
    76.  
    77.                     set {_items} to number of poppy in inventory of event-block
    78.  
    79.                     set {_money} to unformat("%{balance::%player%}%")
    80.                     set {_result} to ({_items} * 1)
    81.                     add {_result} to {_money}
    82.                     set {_resultFormat} to format({_result})
    83.                     set {balance::%player%} to format({_money})
    84.  
    85.                     send "{@tag} You sold &d%{_items}% &7of &dpoppy &7and you got &d$%{_resultFormat}%&7." to player
    86.  
    87.                     remove all poppy from inventory of event-block
    88.  
    89.                 if loop-item is iron ingot:
    90.  
    91.                     set {_items} to number of iron ingot in inventory of event-block
    92.  
    93.                     set {_money} to unformat("%{balance::%player%}%")
    94.                     set {_result} to ({_items} * 37.5)
    95.                     add {_result} to {_money}
    96.                     set {_resultFormat} to format({_result})
    97.                     set {balance::%player%} to format({_money})
    98.  
    99.                     send "{@tag} You sold &d%{_items}% &7of &diron ingot &7and you got &d$%{_resultFormat}%&7." to player
    100.  
    101.                     remove all iron ingot from inventory of event-block
    102.  
    103.  
    104. on right-click:
    105.     if event-block is chest or trapped chest:
    106.         if player's tool is name tag named "&8» &d&lSELLWAND" with lore "&7  &oRight-Click &7on a chest.":
    107.             cancel event
    108.             loop all items in inventory of clicked block:
    109.                 if loop-item is iron ore:
    110.  
    111.                     set {_items} to number of iron ore in inventory of event-block
    112.  
    113.                     set {_money} to unformat("%{balance::%player%}%")
    114.                     set {_result} to ({_items} * 18.75)
    115.                     add {_result} to {_money}
    116.                     set {_resultFormat} to format({_result})
    117.                     set {balance::%player%} to format({_money})
    118.  
    119.                     send "{@tag} You sold &d%{_items}% &7of &diron ore &7and you got &d$%{_resultFormat}%&7." to player
    120.  
    121.                     remove all iron ore from inventory of event-block
    122.  
     
    #1 NotNinjaTalon, Apr 18, 2020
    Last edited: Apr 18, 2020
  2. Potato

    Potato Active Member

    Joined:
    Feb 24, 2020
    Messages:
    57
    Likes Received:
    0
    Please put that into a code so i can read it much easier..
    --- Double Post Merged, Apr 18, 2020, Original Post Date: Apr 18, 2020 ---
    And you can do like every time they sell it removes like 100 dur from it, and when that reaches 0 or less, it removes the sellwand.
    --- Double Post Merged, Apr 18, 2020 ---
    After the code when it's confirmed it selled, you can do "Take 100 from {Dur::%player's held item%}" i think
    --- Double Post Merged, Apr 18, 2020 ---
    But you have to set the variable to something though, so before the player gets the item in their inventory, it sets the variable to like 1k
     
  3. NotNinjaTalon

    NotNinjaTalon Member

    Joined:
    Mar 2, 2020
    Messages:
    12
    Likes Received:
    1
    My bad, the code is now formatted, if possible could you try to add the durability aspect to it. An example of like 10 uses or something like that'd would be great. Thanks in advanced.
     
  4. Potato

    Potato Active Member

    Joined:
    Feb 24, 2020
    Messages:
    57
    Likes Received:
    0
    Of course, do you got discord? I can hit you up there! (Mine is Potato#2997)
     
  5. NotNinjaTalon

    NotNinjaTalon Member

    Joined:
    Mar 2, 2020
    Messages:
    12
    Likes Received:
    1
    Sent a request.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...