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 uses of item (sellwand)

Discussion in 'Skript' started by NotNinjaTalon, Mar 25, 2020 at 10:01 PM.

  1. NotNinjaTalon

    NotNinjaTalon Member

    Joined:
    Mar 2, 2020
    Messages:
    4
    Likes Received:
    0
    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:

    options:
    tag: &d&lSELLWAND &8»&7

    command /sellwand:
    trigger:
    if player's inventory contains name tag named "&8» &d&lSELLWAND" with lore "&7 &oRight-Click &7on a chest.":
    send "{@tag} You already have a &dsell wand&7."
    stop
    else:
    give 1 name tag named "&8» &d&lSELLWAND" with lore "&7 &oRight-Click &7on a chest." to player
    send "{@tag} You got a &dsell wand&7."
    stop

    on right-click:
    if event-block is chest or trapped chest:
    if player's tool is name tag named "&8» &d&lSELLWAND" with lore "&7 &oRight-Click &7on a chest.":
    cancel event
    loop all items in inventory of clicked block:
    if loop-item is cactus:

    set {_items} to number of cactus in inventory of event-block

    set {_money} to unformat("%{balance::%player%}%")
    set {_result} to ({_items} * 10)
    add {_result} to {_money}
    set {_resultFormat} to format({_result})
    set {balance::%player%} to format({_money})

    send "{@tag} You sold &d%{_items}% &7of &dcactus &7and you got &d$%{_resultFormat}%&7." to player

    remove all cactus from inventory of event-block

    if loop-item is sugar cane:

    set {_items} to number of sugar cane in inventory of event-block

    set {_money} to unformat("%{balance::%player%}%")
    set {_result} to ({_items} * 5)
    add {_result} to {_money}
    set {_resultFormat} to format({_result})
    set {balance::%player%} to format({_money})

    send "{@tag} You sold &d%{_items}% &7of &dsugar cane &7and you got &d$%{_resultFormat}%&7." to player

    remove all sugar cane from inventory of event-block

    if loop-item is pumpkin:

    set {_items} to number of sugar cane in inventory of event-block

    set {_money} to unformat("%{balance::%player%}%")
    set {_result} to ({_items} * 6.25)
    add {_result} to {_money}
    set {_resultFormat} to format({_result})
    set {balance::%player%} to format({_money})

    send "{@tag} You sold &d%{_items}% &7of &dpumpkin &7and you got &d$%{_resultFormat}%&7." to player

    remove all pumpkin from inventory of event-block

    if loop-item is melon slice:

    set {_items} to number of melon slice in inventory of event-block

    set {_money} to unformat("%{balance::%player%}%")
    set {_result} to ({_items} * 2.5)
    add {_result} to {_money}
    set {_resultFormat} to format({_result})
    set {balance::%player%} to format({_money})

    send "{@tag} You sold &d%{_items}% &7of &dmelon slice &7and you got &d$%{_resultFormat}%&7." to player

    remove all melon slice from inventory of event-block

    if loop-item is poppy:

    set {_items} to number of poppy in inventory of event-block

    set {_money} to unformat("%{balance::%player%}%")
    set {_result} to ({_items} * 1)
    add {_result} to {_money}
    set {_resultFormat} to format({_result})
    set {balance::%player%} to format({_money})

    send "{@tag} You sold &d%{_items}% &7of &dpoppy &7and you got &d$%{_resultFormat}%&7." to player

    remove all poppy from inventory of event-block

    if loop-item is iron ingot:

    set {_items} to number of iron ingot in inventory of event-block

    set {_money} to unformat("%{balance::%player%}%")
    set {_result} to ({_items} * 37.5)
    add {_result} to {_money}
    set {_resultFormat} to format({_result})
    set {balance::%player%} to format({_money})

    send "{@tag} You sold &d%{_items}% &7of &diron ingot &7and you got &d$%{_resultFormat}%&7." to player

    remove all iron ingot from inventory of event-block
     
Loading...