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 out 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.

Online players in world

Discussion in 'Skript' started by GamerProPlaysYT, Jul 16, 2020.

Thread Status:
Not open for further replies.
  1. GamerProPlaysYT

    Joined:
    Jul 16, 2020
    Messages:
    30
    Likes Received:
    2
  2. Deku

    Deku Member

    Joined:
    Jul 12, 2020
    Messages:
    36
    Likes Received:
    0
    please
    send skript code
     
  3. GamerProPlaysYT

    Joined:
    Jul 16, 2020
    Messages:
    30
    Likes Received:
    2
    Ok here
    --- Double Post Merged, Jul 16, 2020, Original Post Date: Jul 16, 2020 ---
    I sent the file
     

    Attached Files:

  4. Deku

    Deku Member

    Joined:
    Jul 12, 2020
    Messages:
    36
    Likes Received:
    0
    Try with this

    Code (Text):
    1.  # this is one add
    2.         loop all players in world "world1":   # Change every name in the world with the worlds you want
    3.             add loop-player to {_players1::*}
    4.             set {_online1} to size of {_players1::*}
    5.         loop all players in world "world2":   # Change every name in the world with the worlds you want
    6.             add loop-player to {_players2::*}
    7.             set {_online2} to size of {_players2::*}
    8.         loop all players in world "world3":   # Change every name in the world with the worlds you want
    9.             add loop-player to {_players3::*}
    10.             set {_online3} to size of {_players3::*}        
    11.             wait 0.2 ticks
    Code (Text):
    1. command /lobbysel:
    2.     trigger:
    3.         loop all players in world "world1":   #Change every name in the world with the worlds you want
    4.             add loop-player to {_players1::*}
    5.             set {_online1} to size of {_players1::*}
    6.         loop all players in world "world2":
    7.             add loop-player to {_players2::*}
    8.             set {_online2} to size of {_players2::*}
    9.         loop all players in world "world3":
    10.             add loop-player to {_players3::*}
    11.             set {_online3} to size of {_players3::*}      
    12.             wait 0.2 ticks
    13.             open chest with 3 rows named "&a&lLobby Selector" to player
    14.             format slot 0 of player with 160:7 named " " to close
    15.             format slot 1 of player with 160:7 named " " to close
    16.             format slot 2 of player with 160:7 named " " to close
    17.             format slot 3 of player with 160:7 named " " to close
    18.             format slot 4 of player with 160:7 named " " to close
    19.             format slot 5 of player with 160:7 named " " to close
    20.             format slot 6 of player with 160:7 named " " to close
    21.             format slot 7 of player with 160:7 named " " to close
    22.             format slot 8 of player with 160:7 named " " to close
    23.             format slot 9 of player with 160:7 named " " to close
    24.             format slot 10 of player with 399 named "&a&lHub 1" with lore "&3Connect to:||&bHub 1||&b%{_online1}%" to close then run [make player execute command "ehub"]
    25.             format slot 11 of player with 160:7 named " " to close
    26.             format slot 12 of player with 160:7 named " " to close
    27.             format slot 13 of player with 399 named "&a&lHub 2" with lore "&3Connect to:||&bHub 2||&b%{_online2}%" to close then run [make player execute command "warp hub2"]
    28.             format slot 14 of player with 160:7 named " " to close
    29.             format slot 15 of player with 160:7 named " " to close
    30.             format slot 16 of player with 399 named "&a&lHub 3" with lore "&3Connect to:||&bHub 3||&b%{_online3}%" to close then run [make player execute command "warp hub3"]
    31.             format slot 17 of player with 160:7 named " " to close
    32.             format slot 18 of player with 160:7 named " " to close
    33.             format slot 19 of player with 160:7 named " " to close
    34.             format slot 20 of player with 160:7 named " " to close
    35.             format slot 21 of player with 160:7 named " " to close
    36.             format slot 22 of player with 160:7 named " " to close
    37.             format slot 23 of player with 160:7 named " " to close
    38.             format slot 24 of player with 160:7 named " " to close
    39.             format slot 25 of player with 160:7 named " " to close
    40.             format slot 26 of player with 160:7 named " " to close
     
    #4 Deku, Jul 16, 2020
    Last edited: Jul 16, 2020
  5. GamerProPlaysYT

    Joined:
    Jul 16, 2020
    Messages:
    30
    Likes Received:
    2
    ok thank you!
    --- Double Post Merged, Jul 19, 2020, Original Post Date: Jul 17, 2020 ---
    but How do I do so if nobody is in that world that it says 0, it says alwasy <none>
     
  6. Gowixx

    Gowixx Member

    Joined:
    Jul 9, 2020
    Messages:
    28
    Likes Received:
    6
    <none> is what skript prints out when the value is not set.
     
  7. GamerProPlaysYT

    Joined:
    Jul 16, 2020
    Messages:
    30
    Likes Received:
    2
    But how do I fix it?? It is possible, someone has done it before!
     
  8. Joyte

    Joyte New Member

    Joined:
    Jul 7, 2020
    Messages:
    5
    Likes Received:
    1
    Code (Text):
    1.  
    2. if {_online1} is not set:
    3.     set {_online1} to 0
    4. if {_online2} is not set:
    5.     set {_online2} to 0
    6. if {_online3} is not set:
    7.     set {_online3} to 0
    8.  
     
  9. GamerProPlaysYT

    Joined:
    Jul 16, 2020
    Messages:
    30
    Likes Received:
    2
    thank you!
     
  10. Gowixx

    Gowixx Member

    Joined:
    Jul 9, 2020
    Messages:
    28
    Likes Received:
    6
    1. Code (Text):
      1. every 5 seconds:
      2. [/LIST]
      3.  
      4.     if {_online1} is not set:
      5.         set {_online1} to 0
      6.     if {_online2} is not set:
      7.         set {_online2} to 0
      8.     if {_online3} is not set:
      9.         set {_online3} to 0
      This should work with minimal lag.
     
  11. Joyte

    Joyte New Member

    Joined:
    Jul 7, 2020
    Messages:
    5
    Likes Received:
    1
    or he could just add it to the existing code:
    the way you did it, it's extremely unlikely to work properly because with this: set {_online1} to size of {_players1::*}, the variable will be set back to <none>
    Code (Text):
    1.  
    2. command /lobbysel:
    3.     trigger:
    4.         loop all players in world "world1":   #Change every name in the world with the worlds you want
    5.             add loop-player to {_players1::*}
    6.             set {_online1} to size of {_players1::*}
    7.         loop all players in world "world2":
    8.             add loop-player to {_players2::*}
    9.             set {_online2} to size of {_players2::*}
    10.         loop all players in world "world3":
    11.             add loop-player to {_players3::*}
    12.             set {_online3} to size of {_players3::*}
    13.         if {_online1} is not set:
    14.             set {_online1} to 0
    15.         if {_online2} is not set:
    16.             set {_online2} to 0
    17.         if {_online3} is not set:
    18.             set {_online3} to 0
    19.             wait 0.2 ticks
    20.             open chest with 3 rows named "&a&lLobby Selector" to player
    21.             format slot 0 of player with 160:7 named " " to close
    22.             format slot 1 of player with 160:7 named " " to close
    23.             format slot 2 of player with 160:7 named " " to close
    24.             format slot 3 of player with 160:7 named " " to close
    25.             format slot 4 of player with 160:7 named " " to close
    26.             format slot 5 of player with 160:7 named " " to close
    27.             format slot 6 of player with 160:7 named " " to close
    28.             format slot 7 of player with 160:7 named " " to close
    29.             format slot 8 of player with 160:7 named " " to close
    30.             format slot 9 of player with 160:7 named " " to close
    31.             format slot 10 of player with 399 named "&a&lHub 1" with lore "&3Connect to:||&bHub 1||&b%{_online1}%" to close then run [make player execute command "ehub"]
    32.             format slot 11 of player with 160:7 named " " to close
    33.             format slot 12 of player with 160:7 named " " to close
    34.             format slot 13 of player with 399 named "&a&lHub 2" with lore "&3Connect to:||&bHub 2||&b%{_online2}%" to close then run [make player execute command "warp hub2"]
    35.             format slot 14 of player with 160:7 named " " to close
    36.             format slot 15 of player with 160:7 named " " to close
    37.             format slot 16 of player with 399 named "&a&lHub 3" with lore "&3Connect to:||&bHub 3||&b%{_online3}%" to close then run [make player execute command "warp hub3"]
    38.             format slot 17 of player with 160:7 named " " to close
    39.             format slot 18 of player with 160:7 named " " to close
    40.             format slot 19 of player with 160:7 named " " to close
    41.             format slot 20 of player with 160:7 named " " to close
    42.             format slot 21 of player with 160:7 named " " to close
    43.             format slot 22 of player with 160:7 named " " to close
    44.             format slot 23 of player with 160:7 named " " to close
    45.             format slot 24 of player with 160:7 named " " to close
    46.             format slot 25 of player with 160:7 named " " to close
    47.             format slot 26 of player with 160:7 named " " to close
    48.  
     
  12. Gowixx

    Gowixx Member

    Joined:
    Jul 9, 2020
    Messages:
    28
    Likes Received:
    6
    @Joyte your correct. lol Mine would be laggier
     
Thread Status:
Not open for further replies.

Share This Page

Loading...