How to loop all raw items

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

DatriX

Member
May 13, 2021
3
0
1
Hi, I need help with looping.. I am making minigame Item Rush

My problem is that I dont know how to reset (or set false) all variables where is %raw name of item% (in my code is {ir.%player%.%raw name of item%} )

Here is my code
Code:
on pick up:
    send "&7Vzal jsi %raw name of item%!"
    if {ir.%player%.%raw name of item%} is true:
        stop
    else:
        set {ir.%player%.%raw name of item%} to true
        play sound "entity.experience_orb.pickup" with volume 0.5 to the player
        add 1 to {ir.%player%}
        send "&2&lMáš %{ir.%player%}% bodů!!"
        stop

command /irend:
    trigger:
        set {_ir} to true
        loop all raw items:
            loop all players:
                set {ir.%loop-player%.%loop-raw-item%} to false
 
Code:
on pick up:
    send "&7Vzal jsi %event-item%!" to player
    if {ir::%player%.%raw name of item%} is true:
        stop
    else:
        set {ir::%player%.%raw name of item%} to true
        play sound "entity.experience_orb.pickup" with volume 0.5 to the player
        add 1 to {ir::%player%}
        send "&2&lMáš %{ir::%player%}% bodů!!" to player
        stop
 
command /irend:
    trigger:
        set {_ir} to true
        clear {ir::*}

If you use lists instead of variables, you can easily clear them :emoji_wink:
 
Status
Not open for further replies.