A right click item loop event help

  • 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!

  • 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.

drillzy

Member
Aug 6, 2017
22
0
0
20
Hello guys, i need some help with my script that i am developing and what i am trying to do is, i want to right click the emeralds then once i do it loops the player 2304 times (player inventory) and i want it to remove all the emeralds and add all those emeralds converted into the /gems balance or my variable {gems.balance.%player%}
CODE:

Code:
on right click with Emerald:
    loop 2304 times:
        if lore of player's held item contains "gems":
            remove 1 emerald from player
            add 1 to {gems.balance.%player%}
            add 1 to {gems.counter.%player%}
    loop 1 times:
        if lore of player's held item contains "gems":
            send "&2&lGEMS &8&l> &7You redeemed &2%{gems.counter.%player%}% &lGem(s)&7!"
            set {gems.counter.%player%} to 0
 
You need to make sure to stop the loop after you are done with the line, "stop loop"
no you dont, it stops by itself

Hello guys, i need some help with my script that i am developing and what i am trying to do is, i want to right click the emeralds then once i do it loops the player 2304 times (player inventory) and i want it to remove all the emeralds and add all those emeralds converted into the /gems balance or my variable {gems.balance.%player%}
CODE:

Code:
on right click with Emerald:
    loop 2304 times:
        if lore of player's held item contains "gems":
            remove 1 emerald from player
            add 1 to {gems.balance.%player%}
            add 1 to {gems.counter.%player%}
    loop 1 times:
        if lore of player's held item contains "gems":
            send "&2&lGEMS &8&l> &7You redeemed &2%{gems.counter.%player%}% &lGem(s)&7!"
            set {gems.counter.%player%} to 0
what are you trying to do exactly? are you just trying to loop the players inventory? If you are you can use loop player's inventory.
 
code_language.skript:
on right click with Emerald:
    loop all items of player's inventory:
        if lore of loop-item contains "gems":
            remove loop-item from player
            add 1 to {_gems.counter.%player%}
    add {_gems.counter.%player%} to {gems.balance.%player%}
    lore of player's held item contains "gems":
        send "GEMS > You redeemed %{_gems.counter.%player%}% Gem(s)!"
i isn't test this script.

p.s. don't worry)
 
Status
Not open for further replies.