1. 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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Selecting Two Winners

Discussion in 'Requests' started by xSc0ut, Feb 13, 2019.

  1. xSc0ut

    xSc0ut Member

    Joined:
    Dec 20, 2018
    Messages:
    9
    Likes Received:
    0
    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
     
  2. Runakai1

    Runakai1 Well-Known Member

    Joined:
    Apr 27, 2018
    Messages:
    377
    Likes Received:
    20
    Code (Skript):
    1.  
    2. command blabla:
    3.     trigger:
    4.         set {_list:*} to all players
    5.         set {_p1} to a random element out of {_list:*}
    6.         remomve {_p1} from {_list:*}
    7.         set {_p2} to a random element out of {_list:*}
    8.         remove {_p2} from {_list:*}
    9.         teleport {_p1} to {_loc1}
    10.         teleport {_p2} to {_loc2}
     
  3. xSc0ut

    xSc0ut Member

    Joined:
    Dec 20, 2018
    Messages:
    9
    Likes Received:
    0
    i need this in a loop
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,877
    Likes Received:
    126
    Why would you need to loop them and add them to a list, if you can just add all player's to a list?
     
  5. xSc0ut

    xSc0ut Member

    Joined:
    Dec 20, 2018
    Messages:
    9
    Likes Received:
    0
    well if you look on discord shane you'll see, ive posted the whole code on there
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,877
    Likes Received:
    126
    well if you realize xScOut I have no idea where on discord you have posted it.
    If you are asking a question here , you should post your code here as well.
     
  7. xSc0ut

    xSc0ut Member

    Joined:
    Dec 20, 2018
    Messages:
    9
    Likes Received:
    0
    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?
     
  8. Runakai1

    Runakai1 Well-Known Member

    Joined:
    Apr 27, 2018
    Messages:
    377
    Likes Received:
    20
    Well- There is no code. That's why it's not working- hah.
     
    • Agree Agree x 1
  9. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,200
    Likes Received:
    69
    Medals:
    Hastebin was down lol, it's there now
    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 (Text):
    1. every 1 second in world "Duel":
    2.     loop all players:
    3.         if {event::active::sumo1v1.%loop-player%} is true:
    4.             if {event::started.%loop-player%} is true:
    5.                 if {event::select.%loop-player%} is true:
    6.                     add loop-player to {_l::*}
    7.                 else:
    8.                     add loop-player to {_l2::*}
    9.     add {_l::*} to {sumo::select::list::*}
    10.     set {sumo::select::list::*} to shuffled {sumo::select::list::*}
    11.     broadcast "%{sumo::select::list::*}%"
    12.    
    13.     set {sumo::select1} to a random element out of {sumo::select::list::*}
    14.    
    15.     remove {sumo::select1} from {sumo::select::list::*}
    16.    
    17.     set {sumo::select2} to a random element out of {sumo::select::list::*}
    18.    
    19.     remove {sumo::select2} from {sumo::select::list::*}
    20.    
    21.     send "&eStarting sumo match:&3 %{sumo::select1}%&e vs&3 %{sumo::select2}%" to {_l::*}
    22.    
    23.     teleport {sumo::select1} to {SumoPos1}
    24.     teleport {sumo::select2} to {SumoPos2}
    25.    
    26.     loop {_l::*}:
    27.         set {event::sumo::wait.%loop-value%} to true
    28.         set {event::select.%loop-value%} to false
    29.         set {event::sumo::countdown.%loop-value%} to 5
    30.    
    31.     # L2:
    32.     loop {_l2::*}
    33.         if {event::sumo::wait.%loop-value%} is true:
    34.             if {event::sumo::countdown.%loop-value%} = 0:
    35.                 set {event::sumo::fighting.%loop-value%} to true
    36.             else:
    37.                 send "&eThe match starts in&3 %{event::sumo::countdown.%loop-value%}%&e seconds..." to loop-players
    38.                    
    39.                 remove 1 from {event::sumo::countdown.%loop-value%}
    40.         else:
    41.             if {event::sumo::fighting.%loop-value%} is true:
    42.                 delete {sumo::select1}
    43.                 delete {sumo::select2}
    44.                 delete {sumo::select::list::*}
    45.                 stop
     
Loading...