Checking for number of Players

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

Death

Member
Dec 27, 2023
16
1
3
24
Hey. I'm trying to check for the number of players but if you do set {vasriable} to {variable} + 1 or something like that. IT doesn't work.
I tried so many things, if someone has a fix for this. Please tell me.
on every tick:
loop all players in radius 3 around location -22.5, 111.5, 13.5 world "world":
if block below loop-player is gold block:
send "%loop-value%" to loop-player
 
Hey. I'm trying to check for the number of players but if you do set {vasriable} to {variable} + 1 or something like that. IT doesn't work.
I tried so many things, if someone has a fix for this. Please tell me.
on every tick:
loop all players in radius 3 around location -22.5, 111.5, 13.5 world "world":
if block below loop-player is gold block:
send "%loop-value%" to loop-player
You can accomplish this with ease using a list variable. I wrote a simple few lines of code below to show how it's done.
Code:
command onlineplayers:
   trigger:
      loop all players:
         add loop-player to {_online::*} # Add each player to this list! Player1 will be define as {_online::1}, which will be useful later on!
      set {_n} to size of {_online::*} # Sets this to the size (Or how many players were added) of the online list variable!
      send "&aThere are currently &d%{_n}% &aplayers online!" to player
 
code_language.skript:
# [the] [((real|default)|(fake|shown|displayed))] [online] player (count|amount|number)
# [the] [((real|default)|(fake|shown|displayed))] (count|amount|number|size) of online players
# vanilla skript

command /onlineplayers:
    trigger:
        send "&aThere are &c%online player count%&a players online!"

Untested but should work :emoji_slight_smile:
 
  • Like
Reactions: Luke_Sky_Walker