Solved Checking if any players are online

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

KarimAKL

Active Member
Apr 20, 2018
50
2
0
29
I want to broadcast a message every 5(might change it to higher but that doesn't really matter now) minutes but i don't wanna spam the console if no one is even online, so how would i check if any players are online?
I tried this:
code_language.skript:
Every 5 minutes:
    loop all players:
        add loop-player to {is::online}
    if size of {is::online} is not 0:
        broadcast "Message i want to broadcast every 5 minutes if at least 1 player is online."
But that doesn't work. :7 (Error is something like this: "'::emoji_astonished:nline}' is not a item data" or something along the lines)

Skript version: 2.2-dev25
Minecraft version: 1.8.8
Addons: SkQuery(3.21.4) skript-mirror(0.12.1)
 
I want to broadcast a message every 5(might change it to higher but that doesn't really matter now) minutes but i don't wanna spam the console if no one is even online, so how would i check if any players are online?
I tried this:
code_language.skript:
Every 5 minutes:
    loop all players:
        add loop-player to {is::online}
    if size of {is::online} is not 0:
        broadcast "Message i want to broadcast every 5 minutes if at least 1 player is online."
But that doesn't work. :7 (Error is something like this: "'::emoji_astonished:nline}' is not a item data" or something along the lines)

Skript version: 2.2-dev25
Minecraft version: 1.8.8
Addons: SkQuery(3.21.4) skript-mirror(0.12.1)
or just do:
code_language.skript:
loop all players:
    add 1 to {_count}
if {_count} is greater than or equal to 1:
 
or just do:
code_language.skript:
loop all players:
    add 1 to {_count}
if {_count} is greater than or equal to 1:
Wouldn't that add 1 to count even if no one is online? Also, would it add 1 for every looped player? (If it does add one for every looped player then this should work because if no one is online it'll add 1 to count 0 times, right?)
 
Wouldn't that add 1 to count even if no one is online? Also, would it add 1 for every looped player? (If it does add one for every looped player then this should work because if no one is online it'll add 1 to count 0 times, right?)
loop all players only loops online players so if there's 0 players the "loop all players" thing won't add anything to {_count}
And yes, add 1 for every player (sorry for my bad English, so tired rn)
 
u dont need to loop
code_language.skript:
if size of all players is greater than 0:
 
loop all players only loops online players so if there's 0 players the "loop all players" thing won't add anything to {_count}
And yes, add 1 for every player (sorry for my bad English, so tired rn)
Okay, thanks for the information. :emoji_slight_smile:
u dont need to loop
code_language.skript:
if size of all players is greater than 0:
Oh, okay. :emoji_stuck_out_tongue:
lol i forgot that way xD
Lol. :emoji_stuck_out_tongue:
Tested, works and solved. :emoji_slight_smile:
 
Last edited:
Status
Not open for further replies.