Solved Cage teleportation

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

iHackz

Member
Feb 4, 2017
4
0
0
23
Suggested name:
CageTP
What I want:
I need a skript that will teleport all players on a server to cages. All the players need their own cage which is 12 players at max. Just like Hypixels skywars the players are in the waiting room and are randomly teleported to different cages. If you want to go a extra mile it would be awesome if you could do a teams version which teleports 2 players to a cage (24 players max).

Ideas for commands:
/cagetp
Ideas for permissions:
cage.tp
When I'd like it by: A month or so
 
Unlimited cage.

code_language.skript:
command /cagetp [<text>]:
    permission: *
    trigger:
        if arg-1 is not set:
            loop {queue::*}:
                if size of {queue::%loop-index%::*} is not 0:
                    add loop-index to {_Aviable::*}
            if {_Aviable::*} is not set:
                send "There is no one in queue"
            else:
                loop {_Aviable::*}:
                    send "Arena: %loop-value% (%size of {queue::%loop-value%::*}%/%size of {Arena.L::%loop-value%::*}%)"
        else:
            if {Arena.State::%arg-1%} is false:
                set {_s} to "%arg-1%"
                send "Arena Name: %{_s}%"
                loop {queue::%{_s}%::*}:
                    add loop-value to {_List::*}
                send "queue Players: %{_List::*}% (%size of {_List::*}%/%size of {Arena.L::%{_s}%::*}%)"
                loop {_List::*}:
                    set {_p} to random element out of {_List::*}
                    remove {_p} from {_List::*}
                    remove {_p} from {queue::%arg-1%::*}
                    loop {Arena.L::%{_s}%::*}:
                        if loop-value-2 is false:
                            set {_i} to loop-index-2
                            replace every "world:" with "" in {_i}
                            set {_l::*} to {_i} split at ","
                            teleport {_p} to location({_L::1}, {_l::2}, {_l::3})
                            set {Arena.L::%{_s}%::%loop-index-2%} to true
                            stop loop
                set {Arena.State::%{_s}%} to true
                send "Finished!, Enjoy it"
            else:
                send "The game is already starting. do ""/end %arg-1%"" to reset"

command /addcage [<text>]:
    permission: *
    trigger:
        if arg-1 is set:
            if {Arena.State::%arg-1%} is not set:
                set {Arena.State::%arg-1%} to true
                send "If you finish with adding cage, do pls ""/end %arg-1%"" to open the arena"
            set {Arena.L::%arg-1%::%location of player%} to false
            send "Added a Cage for Arena: %arg-1% (%size of {Arena.L::%arg-1%::*}%)"
            
        
command /end [<text>]:
    permission: *
    trigger:
        if arg-1 is not set:
            loop {Arena.State::*}:
                if loop-value is true:
                    add loop-index to {_running::*}
            if {_running::*} is not set:
                send "No arena Running."
            else:
                loop {_running::*}:
                    send "Arena: %loop-value%"
        else:
            if {Arena.State::%arg-1%} is true:
                loop {Arena.L::%arg-1%::*}:
                    set {Arena.L::%arg-1%::%loop-index%} to false
                set {Arena.State::%arg-1%} to false
                delete {queue::%arg-1%::*}
                send "Arena %arg-1% its open."
        
command /join [<text>]:
    trigger:
        if arg-1 is not set:
            loop {Arena.state::*}:
                if loop-value is false:
                    add loop-index to {_Join::*}
            if {_Join::*} is not set:
                send "No arena avaiable."
            else:
                send "Joinable Arena: %{_Join::*}%"
        else:
            if {Arena.State::%arg-1%} is not true:
                if {Arena.State::%arg-1%} is false:
                    set {queue::%arg-1%} to "%arg-1%"
                    add player to {queue::%arg-1%::*}
                    broadcast "%player% joined in a arena: %arg-1%"
                else:
                    send "This arena is not exits."
            else:
                send "This arena is already started."
 
Unlimited cage.

code_language.skript:
command /cagetp [<text>]:
    permission: *
    trigger:
        if arg-1 is not set:
            loop {queue::*}:
                if size of {queue::%loop-index%::*} is not 0:
                    add loop-index to {_Aviable::*}
            if {_Aviable::*} is not set:
                send "There is no one in queue"
            else:
                loop {_Aviable::*}:
                    send "Arena: %loop-value% (%size of {queue::%loop-value%::*}%/%size of {Arena.L::%loop-value%::*}%)"
        else:
            if {Arena.State::%arg-1%} is false:
                set {_s} to "%arg-1%"
                send "Arena Name: %{_s}%"
                loop {queue::%{_s}%::*}:
                    add loop-value to {_List::*}
                send "queue Players: %{_List::*}% (%size of {_List::*}%/%size of {Arena.L::%{_s}%::*}%)"
                loop {_List::*}:
                    set {_p} to random element out of {_List::*}
                    remove {_p} from {_List::*}
                    remove {_p} from {queue::%arg-1%::*}
                    loop {Arena.L::%{_s}%::*}:
                        if loop-value-2 is false:
                            set {_i} to loop-index-2
                            replace every "world:" with "" in {_i}
                            set {_l::*} to {_i} split at ","
                            teleport {_p} to location({_L::1}, {_l::2}, {_l::3})
                            set {Arena.L::%{_s}%::%loop-index-2%} to true
                            stop loop
                set {Arena.State::%{_s}%} to true
                send "Finished!, Enjoy it"
            else:
                send "The game is already starting. do ""/end %arg-1%"" to reset"

command /addcage [<text>]:
    permission: *
    trigger:
        if arg-1 is set:
            if {Arena.State::%arg-1%} is not set:
                set {Arena.State::%arg-1%} to true
                send "If you finish with adding cage, do pls ""/end %arg-1%"" to open the arena"
            set {Arena.L::%arg-1%::%location of player%} to false
            send "Added a Cage for Arena: %arg-1% (%size of {Arena.L::%arg-1%::*}%)"
           
       
command /end [<text>]:
    permission: *
    trigger:
        if arg-1 is not set:
            loop {Arena.State::*}:
                if loop-value is true:
                    add loop-index to {_running::*}
            if {_running::*} is not set:
                send "No arena Running."
            else:
                loop {_running::*}:
                    send "Arena: %loop-value%"
        else:
            if {Arena.State::%arg-1%} is true:
                loop {Arena.L::%arg-1%::*}:
                    set {Arena.L::%arg-1%::%loop-index%} to false
                set {Arena.State::%arg-1%} to false
                delete {queue::%arg-1%::*}
                send "Arena %arg-1% its open."
       
command /join [<text>]:
    trigger:
        if arg-1 is not set:
            loop {Arena.state::*}:
                if loop-value is false:
                    add loop-index to {_Join::*}
            if {_Join::*} is not set:
                send "No arena avaiable."
            else:
                send "Joinable Arena: %{_Join::*}%"
        else:
            if {Arena.State::%arg-1%} is not true:
                if {Arena.State::%arg-1%} is false:
                    set {queue::%arg-1%} to "%arg-1%"
                    add player to {queue::%arg-1%::*}
                    broadcast "%player% joined in a arena: %arg-1%"
                else:
                    send "This arena is not exits."
            else:
                send "This arena is already started."
Sorry for the late response, thank you so much! :emoji_grinning: