Selecting Two Winners

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

xSc0ut

New Member
Dec 20, 2018
9
0
0
25
Category:

Suggested name: winners

What I want:
I need a skript where it'll loop all players in a certain world, add them to a list, select two people out of that list, but also not selecting the first person twice. and have them teleport somewhere (which ill add myself later)

Ideas for commands: none

Ideas for permissions: none

When I'd like it by: A reasonable time
 
code_language.skript:
command blabla:
    trigger:
        set {_list:*} to all players 
        set {_p1} to a random element out of {_list:*}
        remomve {_p1} from {_list:*}
        set {_p2} to a random element out of {_list:*}
        remove {_p2} from {_list:*}
        teleport {_p1} to {_loc1}
        teleport {_p2} to {_loc2}
 
code_language.skript:
command blabla:
    trigger:
        set {_list:*} to all players
        set {_p1} to a random element out of {_list:*}
        remomve {_p1} from {_list:*}
        set {_p2} to a random element out of {_list:*}
        remove {_p2} from {_list:*}
        teleport {_p1} to {_loc1}
        teleport {_p2} to {_loc2}
i need this in a loop
 
Well- There is no code. That's why it's not working- hah.
Hastebin was down lol, it's there now
https://hastebin.com/onaqahison.cpp

here's the code, for some reason its not selecting two people and also its not sending the message to everyone in the loop, if you could look at it and fix it please?
Why do you want it in a loop? Also, tell what you want the code to do, because I see no reason why you would want a countdown per player for a sumo event. I tried to make it at least work a bit, but I have no clue what you're trying to do:
Code:
every 1 second in world "Duel":
    loop all players:
        if {event::active::sumo1v1.%loop-player%} is true:
            if {event::started.%loop-player%} is true:
                if {event::select.%loop-player%} is true:
                    add loop-player to {_l::*}
                else:
                    add loop-player to {_l2::*}
    add {_l::*} to {sumo::select::list::*}
    set {sumo::select::list::*} to shuffled {sumo::select::list::*}
    broadcast "%{sumo::select::list::*}%"
    
    set {sumo::select1} to a random element out of {sumo::select::list::*}
    
    remove {sumo::select1} from {sumo::select::list::*}
    
    set {sumo::select2} to a random element out of {sumo::select::list::*}
    
    remove {sumo::select2} from {sumo::select::list::*}
    
    send "&eStarting sumo match:&3 %{sumo::select1}%&e vs&3 %{sumo::select2}%" to {_l::*}
    
    teleport {sumo::select1} to {SumoPos1}
    teleport {sumo::select2} to {SumoPos2}
    
    loop {_l::*}:
        set {event::sumo::wait.%loop-value%} to true
        set {event::select.%loop-value%} to false
        set {event::sumo::countdown.%loop-value%} to 5
    
    # L2:
    loop {_l2::*}
        if {event::sumo::wait.%loop-value%} is true:
            if {event::sumo::countdown.%loop-value%} = 0:
                set {event::sumo::fighting.%loop-value%} to true
            else:
                send "&eThe match starts in&3 %{event::sumo::countdown.%loop-value%}%&e seconds..." to loop-players
                    
                remove 1 from {event::sumo::countdown.%loop-value%}
        else:
            if {event::sumo::fighting.%loop-value%} is true:
                delete {sumo::select1}
                delete {sumo::select2}
                delete {sumo::select::list::*}
                stop