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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

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

Solved Help with the list variable (Urgent)

Discussion in 'Skript' started by GamingHard, Oct 26, 2019.

  1. GamingHard

    GamingHard Member

    Joined:
    Oct 5, 2019
    Messages:
    17
    Likes Received:
    0
    Code (Text):
    1. on join:
    2.     add player to {players::*}
    3.  
    4. on disconnect:
    5.     remove player from {players::*}
    6.  
    7. command /list:
    8.     trigger:
    9.         message "%{players::*}%"
    Now what it normally messages you is: player1, player2, player3, player4 and player5

    I want it like this:
    -player1
    -player2
    -player3
    -player4
    -player5

    Is there any possible way for me to do this ?

     
  2. Best Answer:
    Post #4 by novastosha, Oct 26, 2019
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    yeah, loop the list and send the value from the list.
    that list is redundant though, you can just loop all online players, ex:
    Code (Skript):
    1. command /list:
    2.     trigger:
    3.         loop all players:
    4.             send "-%loop-value%"
     
  4. GamingHard

    GamingHard Member

    Joined:
    Oct 5, 2019
    Messages:
    17
    Likes Received:
    0
    Thanks, but is there any possible way to do it with elements in a variable ?
     
  5. novastosha

    novastosha Well-Known Member

    Joined:
    Jan 11, 2019
    Messages:
    187
    Likes Received:
    9
    Code (Skript):
    1. command players:
    2.     trigger:
    3.         loop {players::*}:
    4.             send "%loop-value%"
     
  6. GamingHard

    GamingHard Member

    Joined:
    Oct 5, 2019
    Messages:
    17
    Likes Received:
    0
    Thank you it works perfectly!
     
  7. novastosha

    novastosha Well-Known Member

    Joined:
    Jan 11, 2019
    Messages:
    187
    Likes Received:
    9
    Mark me as best answer please
     
  8. GamingHard

    GamingHard Member

    Joined:
    Oct 5, 2019
    Messages:
    17
    Likes Received:
    0
    Done!
     
Loading...