Auto startup always starting himself and repeating it

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

MeHow

Active Member
Feb 6, 2017
140
13
18
23
Lithuania
Hello guys i am creating skywars Auto startup system and then it's starts it's always repeating itself
Code:
code_language.skript:
every 2 seconds:
    loop all players:
        if {sw.arena.%{arena.%loop-player%}%.online} is true:
            if {sw.arena.%{arena.%loop-player%}%.list} > 1:
                set {sw.arena.%{arena.%loop-player%}%.starting.countdown} to true
                
            else if {sw.arena.%{arena.%loop-player%}%.list} < 1:
                set {sw.arena.%{arena.%loop-player%}%.starting.countdown} to false
        else:
            stop
            
every 17 seconds:
    loop all players:
        if {sw.arena.%{arena.%loop-player%}%.starting.countdown} is true:
            if {sw.arena.%{arena.%loop-player%}%.online} is true:
                set {sw.arena.%{arena.%loop-player%}%.starting} to true
                clear {chestitems::*}
                if {sw.arena.%{arena.%loop-player%}%.starting.countdown} is true:
                    send "{@prefix} %{arena.%loop-player%}% will start in 15 seconds" to {sw.arena.%{arena.%loop-player%}%.players::*}
                    set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 15
                    wait a second
                    set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 14
                    wait a second
                    set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 13
                    wait a second   
                    set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 12
                    wait a second   
                    set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 11
                    wait a second   
                    if {sw.arena.%{arena.%loop-player%}%.starting.countdown} is true:
                        set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 10
                        play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to {sw.arena.%{arena.%loop-player%}%.players::*} with volume 1 and pitch 2                       
                        wait a second   
                        set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 9
                        wait a second   
                        set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 8
                        wait a second   
                        set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 7
                        wait a second   
                        set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 6
                        wait a second   
                        if {sw.arena.%{arena.%loop-player%}%.starting.countdown} is true:
                            set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 5
                            play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to {sw.arena.%{arena.%loop-player%}%.players::*} with volume 1 and pitch 2                           
                            wait a second   
                            set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 4
                            play sound "UI_BUTTON_CLICK" to {sw.arena.%{arena.%loop-player%}%.players::*} with volume 1 and pitch 2                           
                            wait a second   
                            set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 3
                            play sound "UI_BUTTON_CLICK" to {sw.arena.%{arena.%loop-player%}%.players::*} with volume 1 and pitch 2                           
                            wait a second   
                            set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 2
                            play sound "UI_BUTTON_CLICK" to {sw.arena.%{arena.%loop-player%}%.players::*} with volume 1 and pitch 2                           
                            wait a second   
                            set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 1
                            play sound "UI_BUTTON_CLICK" to {sw.arena.%{arena.%loop-player%}%.players::*} with volume 1 and pitch 2   
                            wait 3 ticks
                            if {sw.arena.%{arena.%loop-player%}%.starting.countdown} is true:
                                if {sw.hardmode.%{arena.%loop-player%}%} is true:
                                    loop all blocks in radius 50 of {sw.arena.%{arena.%loop-player%}%.center}:
                                        set {_chestpatern.mid} to a random integer between 1 and 4
                                        if {_chestpatern.mid} is 1:           
                                            if loop-block is a chest:   
                                                clear loop-block's inventory                   
                                                clear {list.p1::*}
                                                loop {chestitems.p1.::*}:
                                                    add loop-value-3 to {list.p1::*}
                                                wait 5 ticks
                                                loop {list.p1::*}:
                                                    set {_slot} to a random number between 1 and 27
                                                    set slot {_slot} of loop-block to loop-value-3       
                                                    remove loop-value-3 from {list.p1::*}       
                                                        
                                        if {_chestpatern.mid} is 2:       
                                            if loop-block is a chest:   
                                                clear loop-block's inventory
                                                clear {list.p2::*}
                                                loop {chestitems.p2.::*}:
                                                    add loop-value-3 to {list.p2::*}
                                                wait 5 ticks
                                                loop {list.p2::*}:
                                                    set {_slot} to a random number between 1 and 27
                                                    set slot {_slot} of loop-block to loop-value-3   
                                                    remove loop-value-3 from {list.p2::*}   
                                                            
                                        if {_chestpatern.mid} is 3:           
                                            if loop-block is a chest:   
                                                clear loop-block's inventory                   
                                                clear {list.p3::*}
                                                loop {chestitems.p3.::*}:
                                                    add loop-value-3 to {list.p3::*}
                                                wait 5 ticks
                                                loop {list.p3::*}:
                                                    set {_slot} to a random number between 1 and 27
                                                    set slot {_slot} of loop-block to loop-value-3       
                                                    remove loop-value-3 from {list.p3::*}       
                                                        
                                        if {_chestpatern.mid} is 4:       
                                            if loop-block is a chest:   
                                                clear loop-block's inventory
                                                clear {list.p4::*}
                                                loop {chestitems.p4.::*}:
                                                    add loop-value-3 to {list.p4::*}
                                                wait 5 ticks
                                                loop {list.p4::*}:
                                                    set {_slot} to a random number between 1 and 27
                                                    set slot {_slot} of loop-block to loop-value-3       
                                                    remove loop-value-3 from {list.p4::*}                                       
                                
                                    loop all blocks in radius 25 of {sw.arena.%{arena.%loop-player%}%.center}:
                                        set {_chestpatern.mid} to a random integer between 1 and 2
                                        if {_chestpatern.mid} is 1:           
                                            if loop-block is a chest:   
                                                clear loop-block's inventory                   
                                                clear {list.p5::*}
                                                loop {chestitems.p5.::*}:
                                                    add loop-value-3 to {list.p5::*}
                                                wait 5 ticks
                                                loop {list.p5::*}:
                                                    set {_slot} to a random number between 1 and 27
                                                    set slot {_slot} of loop-block to loop-value-3       
                                                    remove loop-value-3 from {list.p5::*}       
                                                        
                                        if {_chestpatern.mid} is 2:       
                                            if loop-block is a chest:   
                                                clear loop-block's inventory
                                                clear {list.p6::*}
                                                loop {chestitems.p6.::*}:
                                                    add loop-value-3 to {list.p6::*}
                                                wait 5 ticks
                                                loop {list.p6::*}:
                                                    set {_slot} to a random number between 1 and 27
                                                    set slot {_slot} of loop-block to loop-value-3       
                                                    remove loop-value-3 from {list.p6::*}   
                                else:
                                    
                                    
                                set {sw.cantleave.%loop-player%} to true
                                set {sw.arena.%{arena.%loop-player%}%.players::*}'s level to 0
                                set blocks below {sw.arena.%{arena.%loop-player%}%.players::*} to air                   
                                clear {sw.arena.%{arena.%loop-player%}%.players::*}'s inventory
                                set {sw.arena.%{arena.%loop-player%}%.players::*}'s gamemode to survival           
                                set {sw.arena.%{arena.%loop-player%}%.online} to false               
                                loop {sw.arena.%{arena.%loop-player%}%.players::*}:
                                    delete {damager.%loop-value-1%}                       
                                broadcast "{@prefix} Arena %{arena.%loop-player%}% has been started!"
                                delete {sw.arena.%{arena.%loop-player%}%.starting}
                                loop {sw.arena.%{arena.%loop-player%}%.players::*}:
                                    if {sw.kit.Viking.%loop-value-1%} is true:
                                        equip loop-value-1 with iron chestplate named "&eViking Chestplate"
                                        set slot 1 of loop-value-1 to mushroom stew named "&cRegeneration soup"
                                        set slot 0 of loop-value-1 to iron sword named "&eViking Sword"
                                        set slot 2 of loop-value-1 to 10 of quartz block:0 named "&fIron Block"
                                    if {sw.kit.Archer.%loop-value-1%} is true:
                                        equip loop-value-1 with leather chestplate named "&eArcher Chestplate"
                                        set slot 1 of loop-value-1 to mushroom stew named "&cRegeneration soup"
                                        set slot 0 of loop-value-1 to bow named "&eArcher Bow"
                                        set slot 2 of loop-value-1 to 20 of dirt       
                                        set slot 8 of loop-value-1 to 10 of arrow           
                                    if {sw.kit.Slime.%loop-value-1%} is true:
                                        set {_slime} to "MHF_Slime" parsed as offline player   
                                        set {_slime} to "protection 1" parsed as enchantment
                                        equip loop-value-1 with {_slime} named "&fSlime"
                                        set {_slimeball} to slimeball
                                        enchant {_slimeball} with knockback 2
                                        set slot 0 of loop-value-1 to {_slimeball} named "&eSlime Hand"
                                        set slot 1 of loop-value-1 to 10 of slime_block                           
                                    if {sw.kit.RegSoup.%loop-value-1%} is true:
                                        set slot 0 of loop-value-1 to mushroom stew named "&cRegeneration soup"

Server: 1.8
Skript: 2.2
 
Bruh. i don't read the whole code, but what is the problem?

btw. maybe next time use this way:?

code_language.skript:
command /sw join:
    trigger:
        if {SK::%player%} is set:
            send "Already ingame"
        else:
            if size of {SK::*} is 4: #If 4 player's in lobby
                set {_CountDown} to 60 #countdown start in 60 seconds
            add player to {SK::*}
            while size of {SK::*} is 4:
                if {_CountDown} is not more than or equal to 1:
                    stop loop
                else:
                    subtract 1 from {_CountDown}
 
  • Like
Reactions: MeHow
Status
Not open for further replies.