I need help with my mini game!

  • 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.
What I am trying to do tho is every play has there own kits. I know it sounds strange but it is needed for my minigame. I have not tried but I can prob find out how to put this into a gui like my code had.
 
What I am trying to do tho is every play has there own kits. I know it sounds strange but it is needed for my minigame. I have not tried but I can prob find out how to put this into a gui like my code had.

If you can't find it out or just need more help , just ask it here.
 
I know how to make it so every player has there own kits but I don't want to mess up your code. Right now if you saw I need to set it up with a gui with a new item every time you make a kit. So say I make a kit named test then when I open the gui there is a item which I don't care what it is but it would be called test like the kit and give you the kit. I am trying to do that know but I can't figure it out. Please help me.
 
code_language.skript:
command /kit [<text>] [<number>]:
    trigger:
        if arg-1 is "create":
            if arg-2 is set:
                loop all items in player's inventory:
                    add loop-item to {sf::kit-%arg-2%::%player%::*}
                    message "Created."
        if arg-1 is "delete":
            if arg-2 is set:
                clear {sf::kit-%arg-2%::%player%::*}
                message "Deleted."
        if arg-1 is "use":
            if arg-2 is set:
                loop {sf::kit-%arg-2%::%player%::*}:
                    add loop-value to the player's inventory
                    message "Loaded."
                    
on rightclick holding nether star:
    if {sf.join::%player%} is true:
        open chest with 3 rows named "&4Kits" to player
        wait 1 tick
        if {sf::kit-1::%player%::*} is set:
            format slot 0 of player with Dirt named "Kit 1" to close then run [make player execute command "/kit use 1"]
        if {sf::kit-2::%player%::*} is set:
            format slot 1 of player with Dirt named "Kit 2" to close then run [make player execute command "/kit use 2"]
        if {sf::kit-3::%player%::*} is set:
            format slot 2 of player with Dirt named "Kit 3" to close then run [make player execute command "/kit use 3"]
 
Thank you so much I think this is every thing I need for the mini game! If I ever need more help I will say it on this thread but for now I think I am good. Thanks again.
[doublepost=1491680186,1491679016][/doublepost]The code works mostly the only problem I am having is when I reload skript the kits get removed. Please help.
 
The entire code of my minigame or just of the kits because here is the kits code if you wan't the entire thing I can give it to you. I changed the command to /sfkit instead of kit because it would overlap essentials but doing /sfkit dose not do anything.
code_language.skript:
command /sfkit [<text>] [<number>]:

    trigger:   
    
        if arg-1 is "create":       
        
            if arg-2 is set:           
            
                message "{@logo}&bKit %arg 2% Created!"   
                
                loop all items in player's inventory:       
                
                    add loop-item to {sf::kit-%arg-2%::%player%::*}
                    
                    
        if arg-1 is "delete":
        
            if arg-2 is set:   
            
                message "{@logo}&bKit %arg 2% Deleted!"
                
                clear {sf::kit-%arg-2%::%player%::*}
                
        if arg-1 is "use":
        
            if arg-2 is set:
            
                if {sf.join::%player%} is true:
                
                    message "{@logo}&bKit %arg 2% Loaded!"
                    
                    clear the player's inventory
                    
                    give player nether star named "&4Kits"
                    
                    loop {sf::kit-%arg-2%::%player%::*}:
                    
                        add loop-value to the player's inventory
                  
on rightclick holding nether star:

    if {sf.join::%player%} is true:   
    
        open chest with 1 rows named "&4Kits" to player   
        
        wait 1 tick   
        
        if {sf::kit-1::%player%::*} is set:
        
            format slot 0 of player with iron ingot named "&8Iron" to close then run [make player execute command "/sfkit use 1"]
            
        if {sf::kit-2::%player%::*} is set:
        
            format slot 1 of player with gold ingot named "&eGold" to close then run [make player execute command "/sfkit use 2"]
            
        if {sf::kit-3::%player%::*} is set:
        
            format slot 2 of player with diamond named "&bDiamond" to close then run [make player execute command "/sfkit use 3"]
[doublepost=1491684494,1491681471][/doublepost]I also just realized that your reloading the map code dose not work?
[doublepost=1491744619][/doublepost]I am sorry the reloading the map code dose work just when I tested it I forgot to put it in a part of the script that need to activate it.
[doublepost=1491750135][/doublepost]Wait I was right the reloading code dose not work. I need help with this I think the game will be awesome and I have worked very hard on it it is over 400 lines of code I just want it to work so if you help me it would be awesome. It's not like my server will get very big popular {I HOPE IT DOSE} but if you help I will give you developer rank on my server.
 
Hey,
I just checked your code and after a little fix here is it.
Could it be that you forget to set the {sf.join::%player%} variable?
Mapreset should work now fine for you.YoshYz forget a double dot.

code_language.skript:
command /sfkit [<text=helpmenu>] [<number>]:
    trigger: 
        if arg 1 is "helpmenu":
            message "{@logo} &6SfKit"
            message "&7/sfkit create <KitName> -> Create a kit."
            message "&7/sfkit delete <KitName> -> Delete a kit."
            message "&7/sfkit use <KitName> -> Load a kit."
        if arg 1 is "create":           
            if arg 2 is set:                 
                message "{@logo}&bKit %arg 2% Created!"               
                loop all items in player's inventory:             
                    add loop-item to {sf::kit-%arg-2%::%player%::*}
        if arg 1 is "delete":
            if arg 2 is set: 
                message "{@logo}&bKit %arg 2% Deleted!"
                clear {sf::kit-%arg-2%::%player%::*}
        if arg 1 is "use":
            if arg 2 is set:
                if {sf.join::%player%} is true:
                    message "{@logo}&bKit %arg 2% Loaded!"
                    clear the player's inventory
                    give player nether star named "&4Kits"
                    loop {sf::kit-%arg-2%::%player%::*}:
                        add loop-value to the player's inventory
                
on rightclick holding nether star:
    if {sf.join::%player%} is true: 
        open chest with 1 rows named "&4Kits" to player       
        wait 1 tick 
        if {sf::kit-1::%player%::*} is set:   
            format slot 0 of player with iron ingot named "&8Iron" to close then run [make player execute command "/sfkit use 1"]         
        if {sf::kit-2::%player%::*} is set:
            format slot 1 of player with gold ingot named "&eGold" to close then run [make player execute command "/sfkit use 2"]
        if {sf::kit-3::%player%::*} is set:
            format slot 2 of player with diamond named "&bDiamond" to close then run [make player execute command "/sfkit use 3"]

on break:
    add type of event-block to {minigame.arenaname.breakblocks::*}
    add location of event-block to {minigame.arenaname.breaklocations::*}
    
command /mapreset:
    trigger:
        loop {minigame.arenaname.breakblocks::*}:
            loop {minigame.arenaname.breaklocations::*}:
                set {_loc} to loop-value-2
                set block at {_loc} to {minigame.arenaname.breakblocks::%loop-index-2%}
 
Thank you it works! Is there a way to remove placed blocks? The only problem so far is the kits still don't work. When I click one of them in the GUI then when I join the game which I might have to give you the entire code which I will but if I join the game it's there then when I leave it's not? Thanks again. If you are going to change the code please keep the random tap opens it's how I organize it.
code_language.skript:
options:
    logo: &8[&9Sky&3Fight&8]

#--------------------------------------#

variables:
    
    {sf.game} = false
    {sf.world} = false
    {sf.players} = 0
    {sf.pb} = false
    {sf.delay} = false
    {sf.join::%player%} = false
    {sf.enter} = false
    {sf.amount} = true
    {sf.pvp} = false
    
#-----------------------------------LEAVE-COMMAND#

command /leave:
    trigger:
    
        if {sf.join::%player%} is true:
            
            if {sf.game} is true:
                clear {sf::*}'s inventory
                teleport {sf::*} to {sf.hub}
                set {sf.game} to false
                set {sf.world} to false
                set {sf.players} to 0
                set {sf.pb} to false
                set {sf.delay} to false
                set {sf.join::%player%} to false
                message "{@logo}&4You left the game!"
                delete {sf::*}
                
                set {_count} to 0
                loop 41 times:
                    set slot {_count} of player to {inv.%player%::%{_count}%}
                    add 1 to {_count}
            
            if {sf.game} is false:
            
                set {sf.game} to false
                set {sf.world} to false
                set {sf.players} to 0
                set {sf.pb} to false
                set {sf.delay} to false
                set {sf.join::%player%} to false
                message "{@logo}&4You left the game!"
                clear the player's inventory
                teleport the player to {sf.hub}
                delete {sf::*}
                
                set {_count} to 0
                loop 41 times:
                    set slot {_count} of player to {inv.%player%::%{_count}%}
                    add 1 to {_count}
            
        else:   
            
            message "{@logo}&4You are not in a game!"
    
#----------------------------MAIN-COMMAND#
    
command /sf <text> <text> <text>:
    usage: &9/&3sf "&2join&9" "&bmap&9" "&amode&9"
    trigger:   
    
#------------------------------ADMIN-COMMAND#   
    
        if arg 1 is "admin":
        
            player has permission "sf.admin":
            
                if arg 2 is "sethub":
                
                    set {sf.hub} to location of player
                    message "{@logo}&bYou set the hub!"
                
                if arg 2 is "setspawn1":
                
                    set {sf.spawn1.%arg 3%} to location of player
                    message "{@logo}&bYou set spawn1 for %arg 3%!"
            
                if arg 2 is "setspawn2":
                
                    set {sf.spawn2.%arg 3%} to location of player
                    message "{@logo}&bYou set spawn2 for %arg 3%!"
                
                if arg 2 is "setspawn3":
                
                    set {sf.spawn3.%arg 3%} to location of player
                    message "{@logo}&bYou set spawn3 for %arg 3%!"
            
                if arg 2 is "setspawn4":
                
                    set {sf.spawn4.%arg 3%} to location of player
                    message "{@logo}&bYou set spawn4 for %arg 3%!"   
            
                if arg 2 is "remake":
                    
                    loop {sf.%world%.breakblocks::*}:
                        loop {sf.%world%.breaklocations::*}:
                            set {_loc} to loop-value-2
                            set block at {_loc} to {sf.%world%.breakblocks::%loop-index-2%}
                
            else:
                message "&4You are not a admin!"
            
#---------------------------------------------NORMAL-COMMAND#

        if arg 1 is "join":
        
            if arg 2 is "simple":
                
                if {sf.join::%player%} is true:
                    
                    message "&4You are already in a game!"
                    
                if {sf.game} is true:
                    
                    message "&4That game has already started!"
                    
                if {sf.delay} is true:
                    
                    message "&4That game needs to cool down!"
                    
                if {sf.world} is true:
                
                    message "&4That game needs to restart!"
                
                if {sf.join::%player%} is false:
                
                    if {sf.game} is false:
                    
                        if {sf.delay} is false:
                        
                            if {sf.world} is false:
            
                                if {sf.players} is 0:
                                
                                    teleport the player to {sf.spawn1.%arg 2%}
                                    
                                if {sf.players} is 1:
                                
                                    teleport the player to {sf.spawn2.%arg 2%}
                                    
                                if {sf.players} is 2:
                                    
                                    teleport the player to {sf.spawn3.%arg 2%}
                                    set {sf.amount} to false
                                    
                                if {sf.players} is 3:
                                    
                                    teleport the player to {sf.spawn4.%arg 2%}
                                    
                                execute console command "/day day simple"
                                
                                set {_count} to 0
                                loop 41 times:
                                    set {inv.%player%::%{_count}%} to slot {_count} of player
                                    add 1 to {_count}
                                    
                                clear the player's inventory
                                add player to {sf::*}
                                add 1 to {sf.players}
                                send "{@logo}&b%player% Joined the game!" to {sf::*}
                                execute console command "gamemode s %player%"
                                give player nether star named "&bKits"
                                set {sf.join::%player%} to true
                                set {sf.pb} to false
    
#----------------------------------------------------------------GAME-START#
    
                if {sf.players} is 2:
                    
                    wait 10 ticks
                    
                    if {sf.amount} is true:
                    
                        set {sf.game} to true
                        set {sf.pvp} to false
                        
                        send "{@logo}&bThe game is starting in 20 seconds!" to {sf::*}
                        
                        wait 10 seconds
                        send "{@logo}&b10 seconds till the game starts" to {sf::*}
                        
                        wait 5 seconds
                        send "{@logo}&b5!" to {sf::*}
                        
                        wait 1 second
                        send "{@logo}&b4!" to {sf::*}
                        
                        wait 1 second
                        send "{@logo}&b3!" to {sf::*}
                        
                        wait 1 second
                        send "{@logo}&b2!" to {sf::*}
                        
                        wait 1 second
                        send "{@logo}&b1!" to {sf::*}
                        
                        wait 1 second
                        send "{@logo}&bGO!" to {sf::*}
                        
                        set {sf.pb} to true
                        
                        remove 1 nether star from the inventory of {sf::*}
                        
                        send "{@logo}&bIn 5 minutes you will be allowed to fight!" to {sf::*}
                        
                        wait 3 minutes
                        send "{@logo}&bIn 2 minutes you will be allowed to fight!" to {sf::*}
                        
                        wait 2 minutes
                        send "{@logo}&bTHE PVP GODS ARE TAKING A NAP! THERE ARE NO RULES!" to {sf::*}   
                        set {sf.pvp} to true

#------------------------------------------------------KITS#

command /sfkit [<text=helpmenu>] [<number>]:

    trigger:
    
        if arg 1 is "helpmenu":
        
            message "{@logo} &6SfKit"
            message "&7/sfkit create <KitName> -> Create a kit."
            message "&7/sfkit delete <KitName> -> Delete a kit."
            message "&7/sfkit use <KitName> -> Load a kit."
            
        if arg 1 is "create":         
        
            if arg 2 is set:   
            
                wait 2 ticks
                message "{@logo}&bKit %arg 2% Created!" 
                
                loop all items in player's inventory:     
                
                    add loop-item to {sf::kit-%arg-2%::%player%::*}
                    
        if arg 1 is "delete":
        
            if arg 2 is set:
            
                message "{@logo}&bKit %arg 2% Deleted!"
                clear {sf::kit-%arg-2%::%player%::*}
                
        if arg 1 is "use":
        
            if arg 2 is set:
            
                if {sf.join::%player%} is true:
                
                    message "{@logo}&bKit %arg 2% Loaded!"
                    clear the player's inventory
                    give player nether star named "&4Kits"
                    
                    loop {sf::kit-%arg-2%::%player%::*}:
                    
                        add loop-value to the player's inventory
    
on rightclick holding nether star:

    if {sf.join::%player%} is true:
    
        open chest with 1 rows named "&4Kits" to player   
        
        wait 1 tick
        
        if {sf::kit-1::%player%::*} is set: 
        
            format slot 0 of player with iron ingot named "&8Iron" to close then run [make player execute command "/sfkit use 1"]
            
        if {sf::kit-2::%player%::*} is set:
        
            format slot 1 of player with gold ingot named "&eGold" to close then run [make player execute command "/sfkit use 2"]
            
        if {sf::kit-3::%player%::*} is set:
        
            format slot 2 of player with diamond named "&bDiamond" to close then run [make player execute command "/sfkit use 3"]
    
#-----------------------------------------------------------------KIT-OPTIONS#
            
command /sfkitdelete:

    trigger:

        wait 2 ticks
    
        if {sf.join::%player%} is false:   
        
            open chest with 1 rows named "&4Delete Kits" to player   
            
            wait 1 tick   
            
            if {sf::kit-1::%player%::*} is set:
            
                format slot 0 of player with iron ingot named "&8Delete Kit Iron" to close then run [make player execute command "/sfkit delete 1"]
                
            if {sf::kit-2::%player%::*} is set:
            
                format slot 1 of player with gold ingot named "&eDelete Kit Gold" to close then run [make player execute command "/sfkit delete 2"]
                
            if {sf::kit-3::%player%::*} is set:
            
                format slot 2 of player with diamond named "&bDelete Kit Diamond" to close then run [make player execute command "/sfkit delete 3"]

            format slot 8 of player with nether star named "&9Create" to close then run [make player execute command "/sfkitcreate"]

command /sfkitcreate:

    trigger:
        
        wait 2 ticks
        
        if {sf.join::%player%} is false:
        
            open chest with 1 rows named "&9Create Kits" to player
        
            wait 1 tick
        
            if {sf::kit-1::%player%::*} is not set:
        
                format slot 0 of player with iron ingot named "&8Create Kit Iron" to close then run [make player execute command "/sfkit create 1"]
                
            if {sf::kit-2::%player%::*} is not set:
        
                format slot 1 of player with gold ingot named "&eCreate Kit Gold" to close then run [make player execute command "/sfkit create 2"]
    
            if {sf::kit-3::%player%::*} is not set:
        
                format slot 2 of player with diamond named "&bCreate Kit Diamond" to close then run [make player execute command "/sfkit create 3"]
    
            format slot 8 of player with barrier named "&4Delete" to close then run [make player execute command "/sfkitdelete"]
    
on rightclick holding arrow:
    
    make player execute command "/sfkitcreate"
    
#--------------------------------------------------------------------GAME-END#
                    
on death of player:

    if {sf.join::%player%} is true:
    
        remove 1 from {sf.players}
        
        if {sf.players} is 1:
            
            teleport {sf::*} to {sf.hub}
            send "{@logo}&4%player% Has died!" to {sf::*}
            send "{@logo}&aThe other player wins!" to {sf::*}
            set {sf.join::*} to false
            set {sf.game} to false
            set {sf.players} to 0
            delete {sf::*}
            clear inventory of {sf::*}   
            execute console command "/heal WimpyLlama"

            set {_count} to 0
            loop 41 times:
                set slot {_count} of player to {inv.%player%::%{_count}%}
                add 1 to {_count}       
                    
#-------------------------------------------------------------------------#
    
on quit:

    if {sf.join::%player%} is true:
    
        remove 1 from {sf.players}
        
        if {sf.players} is 1:
            
            teleport {sf::*} to {sf.hub}
            send "{@logo}&4%player% Has died!" to {sf::*}
            send "{@logo}&aThe other player wins!" to {sf::*}
            set {sf.join::*} to false
            set {sf.game} to false
            set {sf.players} to 0
            delete {sf::*}
            clear inventory of {sf::*}   
            execute console command "/heal WimpyLlama"

            set {_count} to 0
            loop 41 times:
                set slot {_count} of player to {inv.%player%::%{_count}%}
                add 1 to {_count}       
    
on place:

    if {sf.join::%player%} is true:
    
        if {sf.pb} is false:
        
            cancel event

on break:

    if {sf.join::%player%} is true:
    
        if {sf.pb} is false:
        
            cancel event

on damage:
    
    if attacker is {sf::*}:
    
        if {sf.pvp} is false:
        
            cancel event
            message "&4You can't do that right now!"

on first join:
    
    give player 1 arrow named "&9Create&8/&4Delete &bKits"
    
on break:
    add type of event-block to {minigame.arenaname.breakblocks::*}
    add location of event-block to {minigame.arenaname.breaklocations::*}
  
command /mapreset:
    trigger:
        loop {minigame.arenaname.breakblocks::*}:
            loop {minigame.arenaname.breaklocations::*}:
                set {_loc} to loop-value-2
                set block at {_loc} to {minigame.arenaname.breakblocks::%loop-index-2%}
 
That's for the placed blocks
code_language.skript:
on place:
    add type of event-block to {minigame.arenaname.placeblocks::*}
    add location of event-block to {minigame.arenaname.placelocations::*}
    
loop {minigame.arenaname.placeblocks::*}:
    loop {minigame.arenaname.placelocations::*}:
        set {_loc} to loop-value-2
        set block at {_loc} to air
 
I used this code for placed blocks and if I plant something during the game when I go back into it what I planted dupes like 100000 times and goes crazy and lags. Please help.
 
My entire script is just not working. It's hard to explain without playing in the server it self so if you want to help just say so and I will give the ip for you to help. Here is my script.
code_language.skript:
options:
    logo: &8[&9Sky&3Fight&8]

#--------------------------------------#

variables:
    
    {sf.game} = false
    {sf.world} = false
    {sf.players} = 0
    {sf.pb} = false
    {sf.delay} = false
    {sf.join::%player%} = false
    {sf.enter} = false
    {sf.amount} = true
    {sf.pvp} = false
    
#-----------------------------------LEAVE-COMMAND#

command /leave:
    trigger:
    
        if {sf.join::%player%} is true:
            
            if {sf.game} is true:
                clear {sf::*}'s inventory
                teleport {sf::*} to {sf.hub}
                set {sf.game} to false
                set {sf.world} to false
                set {sf.players} to 0
                set {sf.pb} to false
                set {sf.delay} to false
                set {sf.join::%player%} to false
                message "{@logo}&4You left the game!"
                delete {sf::*}
                execute console command "/mapreset"
                delete {minigame.arenaname.breakblocks::*}
                delete {minigame.arenaname.breaklocations::*}
                delete {minigame.arenaname.placeblocks::*}
                delete {minigame.arenaname.placelocations::*}
                
                set {_count} to 0
                loop 41 times:
                    set slot {_count} of player to {inv.%player%::%{_count}%}
                    add 1 to {_count}
            
            if {sf.game} is false:
            
                set {sf.game} to false
                set {sf.world} to false
                set {sf.players} to 0
                set {sf.pb} to false
                set {sf.delay} to false
                set {sf.join::*} to false
                message "{@logo}&4You left the game!"
                clear the player's inventory
                teleport the player to {sf.hub}
                delete {sf::*}
                execute console command "/mapreset"
                delete {minigame.arenaname.breakblocks::*}
                delete {minigame.arenaname.breaklocations::*}
                delete {minigame.arenaname.placeblocks::*}
                delete {minigame.arenaname.placelocations::*}
                
                set {_count} to 0
                loop 41 times:
                    set slot {_count} of player to {inv.%player%::%{_count}%}
                    add 1 to {_count}
            
        else:   
            
            message "{@logo}&4You are not in a game!"
    
#----------------------------MAIN-COMMAND#
    
command /sf <text> <text> <text>:
    usage: &9/&3sf "&2join&9" "&bmap&9" "&amode&9"
    trigger:   
    
#------------------------------ADMIN-COMMAND#   
    
        if arg 1 is "admin":
        
            player has permission "sf.admin":
            
                if arg 2 is "sethub":
                
                    set {sf.hub} to location of player
                    message "{@logo}&bYou set the hub!"
                
                if arg 2 is "setspawn1":
                
                    set {sf.spawn1.%arg 3%} to location of player
                    message "{@logo}&bYou set spawn1 for %arg 3%!"
            
                if arg 2 is "setspawn2":
                
                    set {sf.spawn2.%arg 3%} to location of player
                    message "{@logo}&bYou set spawn2 for %arg 3%!"   
            
                if arg 2 is "remake":
                    
                    loop {sf.%world%.breakblocks::*}:
                        loop {sf.%world%.breaklocations::*}:
                            set {_loc} to loop-value-2
                            set block at {_loc} to {sf.%world%.breakblocks::%loop-index-2%}
                
            else:
                message "&4You are not a admin!"
            
#---------------------------------------------NORMAL-COMMAND#

        if arg 1 is "join":
        
            if arg 2 is "simple":
                
                if {sf.join::%player%} is true:
                    
                    message "&4You are already in a game!"
                    
                if {sf.game} is true:
                    
                    message "&4That game has already started!"
                    
                if {sf.delay} is true:
                    
                    message "&4That game needs to cool down!"
                    
                if {sf.world} is true:
                
                    message "&4That game needs to restart!"
                
                if {sf.join::%player%} is false:
                
                    if {sf.game} is false:
                    
                        if {sf.delay} is false:
                        
                            if {sf.world} is false:
            
                                if {sf.players} is 0:
                                
                                    teleport the player to {sf.spawn1.%arg 2%}
                                    
                                if {sf.players} is 1:
                                
                                    teleport the player to {sf.spawn2.%arg 2%}
                                    
                                execute console command "/day day simple"
                                
                                set {_count} to 0
                                loop 41 times:
                                    set {inv.%player%::%{_count}%} to slot {_count} of player
                                    add 1 to {_count}
                                    
                                clear the player's inventory
                                add player to {sf::*}
                                add 1 to {sf.players}
                                send "{@logo}&b%player% Joined the game!" to {sf::*}
                                execute console command "gamemode s %player%"
                                give player nether star named "&bKits"
                                set {sf.join::%player%} to true
                                set {sf.pb} to false
    
#----------------------------------------------------------------GAME-START#
    
                if {sf.players} is 2:
                    
                    wait 10 ticks
                    
                    set {sf.game} to true
                    set {sf.pvp} to false
                        
                    send "{@logo}&bThe game is starting in 20 seconds!" to {sf::*}
                        
                    wait 10 seconds
                    send "{@logo}&b10 seconds till the game starts" to {sf::*}
                        
                    wait 5 seconds
                    send "{@logo}&b5!" to {sf::*}
                        
                    wait 1 second
                    send "{@logo}&b4!" to {sf::*}
                        
                    wait 1 second
                    send "{@logo}&b3!" to {sf::*}
                        
                    wait 1 second
                    send "{@logo}&b2!" to {sf::*}
                        
                    wait 1 second
                    send "{@logo}&b1!" to {sf::*}
                        
                    wait 1 second
                    send "{@logo}&bGO!" to {sf::*}
                    
                    set {sf.pb} to true
                    
                    remove 1 nether star from the inventory of {sf::*}
                        
                    send "{@logo}&bIn 5 minutes you will be allowed to fight!" to {sf::*}
                    
                    wait 3 minutes
                    send "{@logo}&bIn 2 minutes you will be allowed to fight!" to {sf::*}
                        
                    wait 2 minutes
                    send "{@logo}&bTHE PVP GODS ARE TAKING A NAP! THERE ARE NO RULES!" to {sf::*}   
                    set {sf.pvp} to true

#------------------------------------------------------KITS#

command /sfkit [<text>] [<number>]:

    trigger:
            
        if arg 1 is "create":         
        
            if arg 2 is set:   
            
                wait 2 ticks
                message "{@logo}&bKit %arg 2% Created!" 
                
                loop all items in player's inventory:     
                
                    add loop-item to {sf::kit-%arg-2%::%player%::*}
                    
        if arg 1 is "delete":
        
            if arg 2 is set:
            
                message "{@logo}&bKit %arg 2% Deleted!"
                clear {sf::kit-%arg-2%::%player%::*}
                
        if arg 1 is "use":
        
            if arg 2 is set:
            
                if {sf.join::%player%} is true:
                
                    message "{@logo}&bKit %arg 2% Loaded!"
                    clear the player's inventory
                    give player nether star named "&4Kits"
                    
                    loop {sf::kit-%arg-2%::%player%::*}:
                    
                        add loop-value to the player's inventory
    
on rightclick holding nether star:

    if {sf.join::%player%} is true:
    
        open chest with 1 rows named "&4Kits" to player   
        
        wait 1 tick
        
        if {sf::kit-1::%player%::*} is set: 
        
            format slot 0 of player with iron ingot named "&8Iron" to close then run [make player execute command "/sfkit use 1"]
            
        if {sf::kit-2::%player%::*} is set:
        
            format slot 1 of player with gold ingot named "&eGold" to close then run [make player execute command "/sfkit use 2"]
            
        if {sf::kit-3::%player%::*} is set:
        
            format slot 2 of player with diamond named "&bDiamond" to close then run [make player execute command "/sfkit use 3"]
    
#-----------------------------------------------------------------KIT-OPTIONS#
            
command /sfkitdelete:

    trigger:

        wait 2 ticks
    
        if {sf.join::%player%} is false:   
        
            open chest with 1 rows named "&4Delete Kits" to player   
            
            wait 1 tick   
            
            if {sf::kit-1::%player%::*} is set:
            
                format slot 0 of player with iron ingot named "&8Delete Kit Iron" to close then run [make player execute command "/sfkit delete 1"]
                
            if {sf::kit-2::%player%::*} is set:
            
                format slot 1 of player with gold ingot named "&eDelete Kit Gold" to close then run [make player execute command "/sfkit delete 2"]
                
            if {sf::kit-3::%player%::*} is set:
            
                format slot 2 of player with diamond named "&bDelete Kit Diamond" to close then run [make player execute command "/sfkit delete 3"]

            format slot 8 of player with nether star named "&9Create" to close then run [make player execute command "/sfkitcreate"]

command /sfkitcreate:

    trigger:
        
        wait 2 ticks
        
        if {sf.join::%player%} is false:
        
            open chest with 1 rows named "&9Create Kits" to player
        
            wait 1 tick
        
            if {sf::kit-1::%player%::*} is not set:
        
                format slot 0 of player with iron ingot named "&8Create Kit Iron" to close then run [make player execute command "/sfkit create 1"]
                
            if {sf::kit-2::%player%::*} is not set:
        
                format slot 1 of player with gold ingot named "&eCreate Kit Gold" to close then run [make player execute command "/sfkit create 2"]
    
            if {sf::kit-3::%player%::*} is not set:
        
                format slot 2 of player with diamond named "&bCreate Kit Diamond" to close then run [make player execute command "/sfkit create 3"]
    
            format slot 8 of player with barrier named "&4Delete" to close then run [make player execute command "/sfkitdelete"]
    
on rightclick holding arrow:
    
    make player execute command "/sfkitcreate"
    
#--------------------------------------------------------------------GAME-END#
                    
on death of player:

    if {sf.join::%player%} is true:
    
        remove 1 from {sf.players}
        
        if {sf.players} is 1:
            
            teleport {sf::*} to {sf.hub}
            send "{@logo}&4%player% Has died!" to {sf::*}
            send "{@logo}&aThe other player wins!" to {sf::*}
            set {sf.join::*} to false
            set {sf.game} to false
            set {sf.players} to 0
            delete {sf::*}
            clear inventory of {sf::*}   
            execute console command "/heal WimpyLlama"
            execute console command "/mapreset"
            delete {minigame.arenaname.breakblocks::*}
            delete {minigame.arenaname.breaklocations::*}
            delete {minigame.arenaname.placeblocks::*}
            delete {minigame.arenaname.placelocations::*}

            set {_count} to 0
            loop 41 times:
                set slot {_count} of player to {inv.%player%::%{_count}%}
                add 1 to {_count}       
                    
#-------------------------------------------------------------------------#
    
on quit:

    if {sf.join::%player%} is true:
    
        remove 1 from {sf.players}
        
        if {sf.players} is 1:
            
            teleport {sf::*} to {sf.hub}
            send "{@logo}&4%player% Has died!" to {sf::*}
            send "{@logo}&aThe other player wins!" to {sf::*}
            set {sf.join::*} to false
            set {sf.game} to false
            set {sf.players} to 0
            delete {sf::*}
            clear inventory of {sf::*}   
            execute console command "/heal WimpyLlama"
            execute console command "/mapreset"
            delete {minigame.arenaname.breakblocks::*}
            delete {minigame.arenaname.breaklocations::*}
            delete {minigame.arenaname.placeblocks::*}
            delete {minigame.arenaname.placelocations::*}

            set {_count} to 0
            loop 41 times:
                set slot {_count} of player to {inv.%player%::%{_count}%}
                add 1 to {_count}       
    
on place:

    if {sf.join::%player%} is true:
    
        if {sf.pb} is false:
        
            cancel event

on break:

    if {sf.join::%player%} is true:
    
        if {sf.pb} is false:
        
            cancel event

on damage:
    
    if attacker is {sf::*}:
    
        if {sf.pvp} is false:
        
            cancel event
            message "&4You can't do that right now!"

on first join:
    
    give player 1 arrow named "&9Create&8/&4Delete &bKits"
    
on break:

    if {sf.join::%player%} is true:
        add type of event-block to {minigame.arenaname.breakblocks::*}
        add location of event-block to {minigame.arenaname.breaklocations::*}
 
on place:

    if {sf.join::%player%} is true:
        add type of event-block to {minigame.arenaname.placeblocks::*}
        add location of event-block to {minigame.arenaname.placelocations::*}
 
command /mapreset:

    trigger:
    
        loop {minigame.arenaname.breakblocks::*}:
            wait 3 ticks
            loop {minigame.arenaname.breaklocations::*}:
                wait 3 ticks
                set {_loc} to loop-value-2
                set block at {_loc} to {minigame.arenaname.breakblocks::%loop-index-2%}
        
        loop {minigame.arenaname.placeblocks::*}:
            wait 3 ticks
            loop {minigame.arenaname.placelocations::*}:
                wait 3 ticks
                set {_loc} to loop-value-2
                set block at {_loc} to air   
                
        message "{@logo}&bYou reset the map!"
 
My entire script is just not working. It's hard to explain without playing in the server it self so if you want to help just say so and I will give the ip for you to help. Here is my script.
code_language.skript:
options:
    logo: &8[&9Sky&3Fight&8]

#--------------------------------------#

variables:
   
    {sf.game} = false
    {sf.world} = false
    {sf.players} = 0
    {sf.pb} = false
    {sf.delay} = false
    {sf.join::%player%} = false
    {sf.enter} = false
    {sf.amount} = true
    {sf.pvp} = false
   
#-----------------------------------LEAVE-COMMAND#

command /leave:
    trigger:
   
        if {sf.join::%player%} is true:
           
            if {sf.game} is true:
                clear {sf::*}'s inventory
                teleport {sf::*} to {sf.hub}
                set {sf.game} to false
                set {sf.world} to false
                set {sf.players} to 0
                set {sf.pb} to false
                set {sf.delay} to false
                set {sf.join::%player%} to false
                message "{@logo}&4You left the game!"
                delete {sf::*}
                execute console command "/mapreset"
                delete {minigame.arenaname.breakblocks::*}
                delete {minigame.arenaname.breaklocations::*}
                delete {minigame.arenaname.placeblocks::*}
                delete {minigame.arenaname.placelocations::*}
               
                set {_count} to 0
                loop 41 times:
                    set slot {_count} of player to {inv.%player%::%{_count}%}
                    add 1 to {_count}
           
            if {sf.game} is false:
           
                set {sf.game} to false
                set {sf.world} to false
                set {sf.players} to 0
                set {sf.pb} to false
                set {sf.delay} to false
                set {sf.join::*} to false
                message "{@logo}&4You left the game!"
                clear the player's inventory
                teleport the player to {sf.hub}
                delete {sf::*}
                execute console command "/mapreset"
                delete {minigame.arenaname.breakblocks::*}
                delete {minigame.arenaname.breaklocations::*}
                delete {minigame.arenaname.placeblocks::*}
                delete {minigame.arenaname.placelocations::*}
               
                set {_count} to 0
                loop 41 times:
                    set slot {_count} of player to {inv.%player%::%{_count}%}
                    add 1 to {_count}
           
        else:  
           
            message "{@logo}&4You are not in a game!"
   
#----------------------------MAIN-COMMAND#
   
command /sf <text> <text> <text>:
    usage: &9/&3sf "&2join&9" "&bmap&9" "&amode&9"
    trigger:  
   
#------------------------------ADMIN-COMMAND#  
   
        if arg 1 is "admin":
       
            player has permission "sf.admin":
           
                if arg 2 is "sethub":
               
                    set {sf.hub} to location of player
                    message "{@logo}&bYou set the hub!"
               
                if arg 2 is "setspawn1":
               
                    set {sf.spawn1.%arg 3%} to location of player
                    message "{@logo}&bYou set spawn1 for %arg 3%!"
           
                if arg 2 is "setspawn2":
               
                    set {sf.spawn2.%arg 3%} to location of player
                    message "{@logo}&bYou set spawn2 for %arg 3%!"  
           
                if arg 2 is "remake":
                   
                    loop {sf.%world%.breakblocks::*}:
                        loop {sf.%world%.breaklocations::*}:
                            set {_loc} to loop-value-2
                            set block at {_loc} to {sf.%world%.breakblocks::%loop-index-2%}
               
            else:
                message "&4You are not a admin!"
           
#---------------------------------------------NORMAL-COMMAND#

        if arg 1 is "join":
       
            if arg 2 is "simple":
               
                if {sf.join::%player%} is true:
                   
                    message "&4You are already in a game!"
                   
                if {sf.game} is true:
                   
                    message "&4That game has already started!"
                   
                if {sf.delay} is true:
                   
                    message "&4That game needs to cool down!"
                   
                if {sf.world} is true:
               
                    message "&4That game needs to restart!"
               
                if {sf.join::%player%} is false:
               
                    if {sf.game} is false:
                   
                        if {sf.delay} is false:
                       
                            if {sf.world} is false:
           
                                if {sf.players} is 0:
                               
                                    teleport the player to {sf.spawn1.%arg 2%}
                                   
                                if {sf.players} is 1:
                               
                                    teleport the player to {sf.spawn2.%arg 2%}
                                   
                                execute console command "/day day simple"
                               
                                set {_count} to 0
                                loop 41 times:
                                    set {inv.%player%::%{_count}%} to slot {_count} of player
                                    add 1 to {_count}
                                   
                                clear the player's inventory
                                add player to {sf::*}
                                add 1 to {sf.players}
                                send "{@logo}&b%player% Joined the game!" to {sf::*}
                                execute console command "gamemode s %player%"
                                give player nether star named "&bKits"
                                set {sf.join::%player%} to true
                                set {sf.pb} to false
   
#----------------------------------------------------------------GAME-START#
   
                if {sf.players} is 2:
                   
                    wait 10 ticks
                   
                    set {sf.game} to true
                    set {sf.pvp} to false
                       
                    send "{@logo}&bThe game is starting in 20 seconds!" to {sf::*}
                       
                    wait 10 seconds
                    send "{@logo}&b10 seconds till the game starts" to {sf::*}
                       
                    wait 5 seconds
                    send "{@logo}&b5!" to {sf::*}
                       
                    wait 1 second
                    send "{@logo}&b4!" to {sf::*}
                       
                    wait 1 second
                    send "{@logo}&b3!" to {sf::*}
                       
                    wait 1 second
                    send "{@logo}&b2!" to {sf::*}
                       
                    wait 1 second
                    send "{@logo}&b1!" to {sf::*}
                       
                    wait 1 second
                    send "{@logo}&bGO!" to {sf::*}
                   
                    set {sf.pb} to true
                   
                    remove 1 nether star from the inventory of {sf::*}
                       
                    send "{@logo}&bIn 5 minutes you will be allowed to fight!" to {sf::*}
                   
                    wait 3 minutes
                    send "{@logo}&bIn 2 minutes you will be allowed to fight!" to {sf::*}
                       
                    wait 2 minutes
                    send "{@logo}&bTHE PVP GODS ARE TAKING A NAP! THERE ARE NO RULES!" to {sf::*}  
                    set {sf.pvp} to true

#------------------------------------------------------KITS#

command /sfkit [<text>] [<number>]:

    trigger:
           
        if arg 1 is "create":        
       
            if arg 2 is set:  
           
                wait 2 ticks
                message "{@logo}&bKit %arg 2% Created!"
               
                loop all items in player's inventory:    
               
                    add loop-item to {sf::kit-%arg-2%::%player%::*}
                   
        if arg 1 is "delete":
       
            if arg 2 is set:
           
                message "{@logo}&bKit %arg 2% Deleted!"
                clear {sf::kit-%arg-2%::%player%::*}
               
        if arg 1 is "use":
       
            if arg 2 is set:
           
                if {sf.join::%player%} is true:
               
                    message "{@logo}&bKit %arg 2% Loaded!"
                    clear the player's inventory
                    give player nether star named "&4Kits"
                   
                    loop {sf::kit-%arg-2%::%player%::*}:
                   
                        add loop-value to the player's inventory
   
on rightclick holding nether star:

    if {sf.join::%player%} is true:
   
        open chest with 1 rows named "&4Kits" to player  
       
        wait 1 tick
       
        if {sf::kit-1::%player%::*} is set:
       
            format slot 0 of player with iron ingot named "&8Iron" to close then run [make player execute command "/sfkit use 1"]
           
        if {sf::kit-2::%player%::*} is set:
       
            format slot 1 of player with gold ingot named "&eGold" to close then run [make player execute command "/sfkit use 2"]
           
        if {sf::kit-3::%player%::*} is set:
       
            format slot 2 of player with diamond named "&bDiamond" to close then run [make player execute command "/sfkit use 3"]
   
#-----------------------------------------------------------------KIT-OPTIONS#
           
command /sfkitdelete:

    trigger:

        wait 2 ticks
   
        if {sf.join::%player%} is false:  
       
            open chest with 1 rows named "&4Delete Kits" to player  
           
            wait 1 tick  
           
            if {sf::kit-1::%player%::*} is set:
           
                format slot 0 of player with iron ingot named "&8Delete Kit Iron" to close then run [make player execute command "/sfkit delete 1"]
               
            if {sf::kit-2::%player%::*} is set:
           
                format slot 1 of player with gold ingot named "&eDelete Kit Gold" to close then run [make player execute command "/sfkit delete 2"]
               
            if {sf::kit-3::%player%::*} is set:
           
                format slot 2 of player with diamond named "&bDelete Kit Diamond" to close then run [make player execute command "/sfkit delete 3"]

            format slot 8 of player with nether star named "&9Create" to close then run [make player execute command "/sfkitcreate"]

command /sfkitcreate:

    trigger:
       
        wait 2 ticks
       
        if {sf.join::%player%} is false:
       
            open chest with 1 rows named "&9Create Kits" to player
       
            wait 1 tick
       
            if {sf::kit-1::%player%::*} is not set:
       
                format slot 0 of player with iron ingot named "&8Create Kit Iron" to close then run [make player execute command "/sfkit create 1"]
               
            if {sf::kit-2::%player%::*} is not set:
       
                format slot 1 of player with gold ingot named "&eCreate Kit Gold" to close then run [make player execute command "/sfkit create 2"]
   
            if {sf::kit-3::%player%::*} is not set:
       
                format slot 2 of player with diamond named "&bCreate Kit Diamond" to close then run [make player execute command "/sfkit create 3"]
   
            format slot 8 of player with barrier named "&4Delete" to close then run [make player execute command "/sfkitdelete"]
   
on rightclick holding arrow:
   
    make player execute command "/sfkitcreate"
   
#--------------------------------------------------------------------GAME-END#
                   
on death of player:

    if {sf.join::%player%} is true:
   
        remove 1 from {sf.players}
       
        if {sf.players} is 1:
           
            teleport {sf::*} to {sf.hub}
            send "{@logo}&4%player% Has died!" to {sf::*}
            send "{@logo}&aThe other player wins!" to {sf::*}
            set {sf.join::*} to false
            set {sf.game} to false
            set {sf.players} to 0
            delete {sf::*}
            clear inventory of {sf::*}  
            execute console command "/heal WimpyLlama"
            execute console command "/mapreset"
            delete {minigame.arenaname.breakblocks::*}
            delete {minigame.arenaname.breaklocations::*}
            delete {minigame.arenaname.placeblocks::*}
            delete {minigame.arenaname.placelocations::*}

            set {_count} to 0
            loop 41 times:
                set slot {_count} of player to {inv.%player%::%{_count}%}
                add 1 to {_count}      
                   
#-------------------------------------------------------------------------#
   
on quit:

    if {sf.join::%player%} is true:
   
        remove 1 from {sf.players}
       
        if {sf.players} is 1:
           
            teleport {sf::*} to {sf.hub}
            send "{@logo}&4%player% Has died!" to {sf::*}
            send "{@logo}&aThe other player wins!" to {sf::*}
            set {sf.join::*} to false
            set {sf.game} to false
            set {sf.players} to 0
            delete {sf::*}
            clear inventory of {sf::*}  
            execute console command "/heal WimpyLlama"
            execute console command "/mapreset"
            delete {minigame.arenaname.breakblocks::*}
            delete {minigame.arenaname.breaklocations::*}
            delete {minigame.arenaname.placeblocks::*}
            delete {minigame.arenaname.placelocations::*}

            set {_count} to 0
            loop 41 times:
                set slot {_count} of player to {inv.%player%::%{_count}%}
                add 1 to {_count}      
   
on place:

    if {sf.join::%player%} is true:
   
        if {sf.pb} is false:
       
            cancel event

on break:

    if {sf.join::%player%} is true:
   
        if {sf.pb} is false:
       
            cancel event

on damage:
   
    if attacker is {sf::*}:
   
        if {sf.pvp} is false:
       
            cancel event
            message "&4You can't do that right now!"

on first join:
   
    give player 1 arrow named "&9Create&8/&4Delete &bKits"
   
on break:

    if {sf.join::%player%} is true:
        add type of event-block to {minigame.arenaname.breakblocks::*}
        add location of event-block to {minigame.arenaname.breaklocations::*}
 
on place:

    if {sf.join::%player%} is true:
        add type of event-block to {minigame.arenaname.placeblocks::*}
        add location of event-block to {minigame.arenaname.placelocations::*}
 
command /mapreset:

    trigger:
   
        loop {minigame.arenaname.breakblocks::*}:
            wait 3 ticks
            loop {minigame.arenaname.breaklocations::*}:
                wait 3 ticks
                set {_loc} to loop-value-2
                set block at {_loc} to {minigame.arenaname.breakblocks::%loop-index-2%}
       
        loop {minigame.arenaname.placeblocks::*}:
            wait 3 ticks
            loop {minigame.arenaname.placelocations::*}:
                wait 3 ticks
                set {_loc} to loop-value-2
                set block at {_loc} to air  
               
        message "{@logo}&bYou reset the map!"
You said you were advanced at coding yet you can't debug a really simple script. We are here to help, but there is a limit to how much we'll do before it becomes too much. We are not going to go through something as big as that with not even a hint as to where the problem occurs. Saying 'i can't show you without it being in game' really doesn't help at all. If you're an advanced skript user as you say you are, try using process of elimination to find at least the section of the bug.
 
First thing early in this entire thread I sad I am more middle class on the script scale. And second my problem is that the game just won't work. It worked until I added in the reloading code. So when I do the command to join the game which the main command is /sf <text> <text> <text> I type in join at the start then the map which in the name of the map is simple then the last one I need for the admin commands so for now when you join a game you have to just type something random there but later I think I will make it for modes like op normal and basic. When you do the command it teleport's you a glass box on top of a island like skywars. I can't figure out how to get it to break the glass under all players when the game starts but that is not needed right now. So if someone dose the command and there is 2 players in the game which is the maximum partly because it gets glitches if I do more than 2 players but when someone dies or leaves the server or dose /leave it ends the game and that's where it goes all wrong the map almost never resets and the {sf.join::%player%} variable which says if the player has joined get messed up and I never know if it is true or false. I don't want to remove anything I have gotten from you guys because I need them to work or the game won't work. And I just realized after typing all of this that the game I am trying to make is basically skywars but every player can make there own kits. Please help me with this I really am happy that people want to help a random kid that has so many questions. Thanks again.
 
So I looked up your code and here is a working fix
code_language.skript:
options:
    logo: &8[&9Sky&3Fight&8]
 
#--------------------------------------#
 
variables:
  
    {sf.game} = false
    {sf.world} = false
    {sf.players} = 0
    {sf.pb} = false
    {sfjoin.%player%} = false
    {sf.delay} = false
    {sf.enter} = false
    {sf.amount} = true
    {sf.pvp} = false
  
#-----------------------------------LEAVE-COMMAND#
 
command /leave:
    trigger:
        send "%{sf.game}%"
        if {sfjoin.%player%} is true:
          
            if {sf.game} is true:
                clear {sf::*}'s inventory
                teleport {sf::*} to {sf.hub}
                set {sf.game} to false
                set {sf.world} to false
                set {sf.players} to 0
                set {sf.pb} to false
                set {sf.delay} to false
                set {sfjoin.%player%} to false
                message "{@logo}&4You left the game!"
                delete {sf::*}
                execute console command "/mapreset"
                delete {minigame.arenaname.breakblocks::*}
                delete {minigame.arenaname.breaklocations::*}
                delete {minigame.arenaname.placeblocks::*}
                delete {minigame.arenaname.placelocations::*}
              
                set {_count} to 0
                loop 41 times:
                    set slot {_count} of player to {inv.%player%::%{_count}%}
                    add 1 to {_count}
          
            else:
          
                set {sf.game} to false
                set {sf.world} to false
                set {sf.players} to 0
                set {sf.pb} to false
                set {sfjoin.%player%} to false
                message "{@logo}&4You left the game!"
                clear the player's inventory
                teleport the player to {sf.hub}
                delete {sf::*}
                execute console command "/mapresetx"
                delete {minigame.arenaname.breakblocks::*}
                delete {minigame.arenaname.breaklocations::*}
                delete {minigame.arenaname.placeblocks::*}
                delete {minigame.arenaname.placelocations::*}
              
                set {_count} to 0
                loop 41 times:
                    set slot {_count} of player to {inv.%player%::%{_count}%}
                    add 1 to {_count}
          
        else: 
          
            message "{@logo}&4You are not in a game!"
  
#----------------------------MAIN-COMMAND#
  
command /sf <text> <text> [<text>] [<text>]:
    usage: &9/&3sf "&2join&9" "&bmap&9" "&amode&9"
    trigger: 
#------------------------------ADMIN-COMMAND# 
        if arg 1 is "admin":
      
            if player has permission "sf.admin":
          
                if arg 2 is "sethub":
              
                    set {sf.hub} to location of player
                    message "{@logo}&bYou set the hub!"
              
                if arg 2 is "setspawn1":
              
                    set {sf.spawn1.%arg 3%} to location of player
                    message "{@logo}&bYou set spawn1 for %arg 3%!"
          
                if arg 2 is "setspawn2":
              
                    set {sf.spawn2.%arg 3%} to location of player
                    message "{@logo}&bYou set spawn2 for %arg 3%!" 
          
                if arg 2 is "remake":
                  
                    loop {sf.%world%.breakblocks::*}:
                        loop {sf.%world%.breaklocations::*}:
                            set {_loc} to loop-value-2
                            set block at {_loc} to {sf.%world%.breakblocks::%loop-index-2%}
                if arg 2 is "setcages":
                    
                    if arg 3 is set:
                    
                        set {sf.cagespawn%arg-4%.%arg-3%} to location of player
                        message "{@logo}&bYou set cage spawn %arg-4% for %arg 3%!"
            else:
                message "&4You are not a admin!"
          
#---------------------------------------------NORMAL-COMMAND#
 
        if arg 1 is "join":
              
            if arg 2 is "simple":

                if {sfjoin.%player%} is true:
                                  
                    message "&4You are already in a game!"
                else:   
                    if {sf.game} is true:
                                          
                        message "&4That game has already started!"
                    else:   
                        if {sf.delay} is true:
                                                  
                            message "&4That game needs to cool down!"
                        else:                           
                            if {sf.world} is true:
                                                
                                message "&4That game needs to restart!"
                            else:                   
                                if {sfjoin.%player%} is false:
        
                                    if {sf.players} is 0:

                                        teleport the player to {sf.spawn1.%arg 2%}
                                                                                          
                                    if {sf.players} is 1:
                                                                                      
                                        teleport the player to {sf.spawn2.%arg 2%}
                                                                                          
                                    execute console command "/day day simple"
                                                                                          
                                    set {_count} to 0
                                    loop 41 times:
                                        set {inv.%player%::%{_count}%} to slot {_count} of player
                                        add 1 to {_count}
                                                                                              
                                    clear the player's inventory
                                    add player to {sf::*}
                                    add 1 to {sf.players}
                                    send "{@logo}&b%player% Joined the game!" to {sf::*}
                                    set player's gamemode to survival
                                    give player nether star named "&bKits"
                                    set {sfjoin.%player%} to true
                                    set {sf.pb} to false
          
    #----------------------------------------------------------------GAME-START#
                      
                                    if {sf.players} is 2:
                                      
                                        wait 10 ticks
                                      
                                        set {sf.game} to true
                                        set {sf.pvp} to false
                                                              
                                        loop {sf::*}:
                                            teleport loop-value to {sf.cagespawn%loop-index%.map}
                                        send "{@logo}&bThe game is starting in 20 seconds!" to {sf::*}
                                                              
                                        wait 10 seconds
                                        send "{@logo}&b10 seconds till the game starts" to {sf::*}
                                                              
                                        wait 5 seconds
                                        send "{@logo}&b5!" to {sf::*}
                                                              
                                        wait 1 second
                                        send "{@logo}&b4!" to {sf::*}
                                                              
                                        wait 1 second
                                        send "{@logo}&b3!" to {sf::*}
                                                              
                                        wait 1 second
                                        send "{@logo}&b2!" to {sf::*}
                                                              
                                        wait 1 second
                                        send "{@logo}&b1!" to {sf::*}
                                                    
                                        loop {sf::*}:
                                            set block under loop-value to air
                                        set {nodmg.%player%} to true
                                        wait 3 seconds
                                        delete {nodmg.%player%}
                                        wait 1 second
                                        send "{@logo}&bGO!" to {sf::*}
                                                          
                                        set {sf.pb} to true
                                                          
                                        remove 1 nether star from the inventory of {sf::*}
                                                              
                                        send "{@logo}&bIn 5 minutes you will be allowed to fight!" to {sf::*}
                                                          
                                        wait 3 minutes
                                        send "{@logo}&bIn 2 minutes you will be allowed to fight!" to {sf::*}
                                                              
                                        wait 2 minutes
                                        send "{@logo}&bTHE PVP GODS ARE TAKING A NAP! THERE ARE NO RULES!" to {sf::*} 
                                        set {sf.pvp} to true
 
#------------------------------------------------------KITS#
 
 
 
command /sfkit [<text>] [<number>]:
 
    trigger:
          
        if arg 1 is "create":       
      
            if arg 2 is set: 
          
                wait 2 ticks
                message "{@logo}&bKit %arg 2% Created!"
              
                loop all items in player's inventory:   
              
                    add loop-item to {sf::kit-%arg-2%::%player%::*}
                  
        if arg 1 is "delete":
      
            if arg 2 is set:
          
                message "{@logo}&bKit %arg 2% Deleted!"
                clear {sf::kit-%arg-2%::%player%::*}
              
        if arg 1 is "use":
      
            if arg 2 is set:
          
                if {sfjoin.%player%} is true:
              
                    message "{@logo}&bKit %arg 2% Loaded!"
                    clear the player's inventory
                    give player nether star named "&4Kits"
                  
                    loop {sf::kit-%arg-2%::%player%::*}:
                  
                        add loop-value to the player's inventory
  
on rightclick holding nether star:
 
    if {sfjoin.%player%} is true:
  
        open chest with 1 rows named "&4Kits" to player 
      
        wait 1 tick
      
        if {sf::kit-1::%player%::*} is set:
      
            format slot 0 of player with iron ingot named "&8Iron" to close then run [make player execute command "/sfkit use 1"]
          
        if {sf::kit-2::%player%::*} is set:
      
            format slot 1 of player with gold ingot named "&eGold" to close then run [make player execute command "/sfkit use 2"]
          
        if {sf::kit-3::%player%::*} is set:
      
            format slot 2 of player with diamond named "&bDiamond" to close then run [make player execute command "/sfkit use 3"]
  
#-----------------------------------------------------------------KIT-OPTIONS#
          
command /sfkitdelete:
 
    trigger:
 
        wait 2 ticks
  
        if {sfjoin.%player%} is false: 
      
            open chest with 1 rows named "&4Delete Kits" to player 
          
            wait 1 tick 
          
            if {sf::kit-1::%player%::*} is set:
          
                format slot 0 of player with iron ingot named "&8Delete Kit Iron" to close then run [make player execute command "/sfkit delete 1"]
              
            if {sf::kit-2::%player%::*} is set:
          
                format slot 1 of player with gold ingot named "&eDelete Kit Gold" to close then run [make player execute command "/sfkit delete 2"]
              
            if {sf::kit-3::%player%::*} is set:
          
                format slot 2 of player with diamond named "&bDelete Kit Diamond" to close then run [make player execute command "/sfkit delete 3"]
 
            format slot 8 of player with nether star named "&9Create" to close then run [make player execute command "/sfkitcreate"]
 
command /sfkitcreate:
 
    trigger:
      
        wait 2 ticks
      
        if {sfjoin.%player%} is false:
      
            open chest with 1 rows named "&9Create Kits" to player
      
            wait 1 tick
      
            if {sf::kit-1::%player%::*} is not set:
      
                format slot 0 of player with iron ingot named "&8Create Kit Iron" to close then run [make player execute command "/sfkit create 1"]
              
            if {sf::kit-2::%player%::*} is not set:
      
                format slot 1 of player with gold ingot named "&eCreate Kit Gold" to close then run [make player execute command "/sfkit create 2"]
  
            if {sf::kit-3::%player%::*} is not set:
      
                format slot 2 of player with diamond named "&bCreate Kit Diamond" to close then run [make player execute command "/sfkit create 3"]
  
            format slot 8 of player with barrier named "&4Delete" to close then run [make player execute command "/sfkitdelete"]
  
on rightclick holding arrow:
  
    make player execute command "/sfkitcreate"
  
#--------------------------------------------------------------------GAME-END#
                  
on death of player:
 
    if {sfjoin.%player%} is true:
  
        remove 1 from {sf.players}
      
        if {sf.players} is 1:
          
            teleport {sf::*} to {sf.hub}
            send "{@logo}&4%player% Has died!" to {sf::*}
            send "{@logo}&aThe other player wins!" to {sf::*}
            set {sf.join::*} to false
            set {sf.game} to false
            set {sf.players} to 0
            delete {sf::*}
            clear inventory of {sf::*} 
            heal the player
            execute console command "/mapreset"
            delete {minigame.arenaname.breakblocks::*}
            delete {minigame.arenaname.breaklocations::*}
            delete {minigame.arenaname.placeblocks::*}
            delete {minigame.arenaname.placelocations::*}
 
            set {_count} to 0
            loop 41 times:
                set slot {_count} of player to {inv.%player%::%{_count}%}
                add 1 to {_count}     
                  
#-------------------------------------------------------------------------#
  
on quit:
 
    if {sfjoin.%player%} is true:
  
        remove 1 from {sf.players}
      
        if {sf.players} is 1:
          
            teleport {sf::*} to {sf.hub}
            send "{@logo}&4%player% Has died!" to {sf::*}
            send "{@logo}&aThe other player wins!" to {sf::*}
            set {sf.join::*} to false
            set {sf.game} to false
            set {sf.players} to 0
            delete {sf::*}
            clear inventory of {sf::*} 
            heal the player
            execute console command "/mapresetx"
            delete {minigame.arenaname.breakblocks::*}
            delete {minigame.arenaname.breaklocations::*}
            delete {minigame.arenaname.placeblocks::*}
            delete {minigame.arenaname.placelocations::*}
 
            set {_count} to 0
            loop 41 times:
                set slot {_count} of player to {inv.%player%::%{_count}%}
                add 1 to {_count}     
  
on place:
 
    if {sfjoin.%player%} is true:
  
        if {sf.pb} is false:
      
            cancel event
 
on break:
 
    if {sfjoin.%player%} is true:
  
        if {sf.pb} is false:
      
            cancel event
 
on damage:
  
    if attacker is a player:
  
        if {sf.pvp} is false:
      
            cancel event
            message "&4You can't do that right now!" to attacker

on damage:

    if damage cause is fall:
    
        if {nodmg.%victim%} is set:
        
            cancel event


            
on first join:
  
    give player 1 arrow named "&9Create&8/&4Delete &bKits"
  
on break:
 
    if {sfjoin.%player%} is true:
        add type of event-block to {minigame.arenaname.breakblocks::*}
        add location of event-block to {minigame.arenaname.breaklocations::*}
 
on place:
 
    if {sfjoin.%player%} is true:
        add type of event-block to {minigame.arenaname.placeblocks::*}
        add location of event-block to {minigame.arenaname.placelocations::*}
 
command /mapreset:
 
    trigger:
        loop {minigame.arenaname.breakblocks::*}:
            wait 3 ticks
            loop {minigame.arenaname.breaklocations::*}:
                wait 3 ticks
                set {_loc} to loop-value-2
                set {_block} to "%loop-value-1%" parsed as item
                set block at {_loc} to {_block}
        loop {minigame.arenaname.placeblocks::*}:
            wait 3 ticks
            loop {minigame.arenaname.placelocations::*}:
                wait 3 ticks
                set {_loc} to "%loop-value-2%"
                set block at {_loc} to air 
              
        message "{@logo}&bYou reset the map!"
 
Ok I am going to try this. Thanks for doing all this code. I was looking at the code and wondering what is the difference between the /sf admin setspawn1 and /sf admin setcage map 1 thing? What I set at first was that setspawn was the cage but I don't really care.
 
Oh xD
I noticed that later
You can remove the setspawn part if you like.
And the cage glass breaking is working fine too.

If you need more help simply ask me.
 
Arena restore sistem! its better than schematics without laggy
code_language.skript:
function SaveArea(t: text):
    set {_x} to 0
    loop blocks within {arena.pos1.%{_t}%} to {arena.pos2.%{_t}%}:
        if loop-block is not air:
            add 1 to {_x}
            set {arena::%{_t}%::blocklar::%location of loop-block%} to type of block at loop-block
            if {_x} is 100:
                wait 1 ticks
                set {_x} to 0
               
               
function Restore(t: text):
    set {_x} to 0
    set {_y} to 0
    wait 0.3 seconds
    loop blocks within {arena.pos1.%{_t}%} to {arena.pos2.%{_t}%}:
        if {arena::%{_t}%::blocklar::%location of loop-block%} is set:
            if type of loop-block is not {arena::%{_t}%::blocklar::%location of loop-block%}:
                add 1 to {_x}
                set block at loop-block to {arena::%{_t}%::blocklar::%location of loop-block%}
                if {_x} is 100:
                    wait 7 ticks #THIS IS AN ANTI-LAG SISTEM IF, CHANGE AT YOU RISK
                    set {_x} to 0
        else:
            if loop-block is not air:
                set block at loop-block to air
                if {_y} is 4:
                    wait 10 ticks
                    set {_y} to 0
                   

command /setpos1 [<text>]:
    trigger:
        if arg 1 is set:
            set {arena.pos1.%arg-1%} to location of player
           
command /setpos2 [<text>]:
    trigger:
        if arg 1 is set:
            set {arena.pos1.%arg-1%} to location of player
           
command /save [<text>]:
    trigger:
        SaveArea("%arg-1%")
       
command /restore [<text>]:
    trigger:
        Restore("%arg-1%")
If you are going to create a great minigame I recommend you use WolvSK it offers a great system for minigames
With save and restore player's inventory
THIS IS MY SKYWARS MULTIARENA MADE WITH WOLVSK
 
If I remove the setspawn would it remove the teleportation to the map or would I just have to change the.

if {sf.players} is 0:

teleport the player to {sf.spawn1.%arg 2%}

if {sf.players} is 1:

teleport the player to {sf.spawn2.%arg 2%}

to.

if {sf.players} is 0:

teleport the player to {sf.cagespawn1.%arg-3%}

if {sf.players} is 1:

teleport the player to {sf.cagespawn2.%arg-3%}
 
Status
Not open for further replies.