Discuss Scratch

coooolboy55
Scratcher
100+ posts

how do you make a players online counter?

IMAhomosapien wrote:

when green flag clicked
change(☁ players)by (1)

[/quote]

if we press the green flag more than one time it will glitch

also if you press the stop sign it wont remove anything
coooolboy55
Scratcher
100+ posts

how do you make a players online counter?

IMAhomosapien wrote:

when green flag clicked
change(☁ players)by (1)


if we press the green flag more than one time it will glitch

also if you press the stop sign it wont remove anything
TeamNITE_gaming
Scratcher
30 posts

how do you make a players online counter?

could you use the scratch blocks to re do that cde plz. I need code 2!
homewins
Scratcher
47 posts

how do you make a players online counter?

The basic concept is set the PLAYERS variable to 0 and go through a loop, checking if each player is active. If so, you can change PLAYERS by 1.

There is probably a variable called “active” or something like that in each player clone that tells you if that player is active. If this is the case, just have a different sprite set PLAYERS to 0 and then add an
if <[active] > [0]> then //assumes "active" variable is greater than 0 when the player is active
change [PLAYERS v] by (1)
end

//in a different sprite that runs its code before the "Cloud players" sprite:
set [PLAYERS v] to [0]
TeamNITE_gaming
Scratcher
30 posts

how do you make a players online counter?

thx!
tigeralaunch
Scratcher
3 posts

how do you make a players online counter?

maybe we can use the “current second” operator and always refresh the player count every second?
Calvin9901
Scratcher
1 post

how do you make a players online counter?

when I start as a clone
delete this clone
delete this clone
ducky_boy010
Scratcher
1 post

how do you make a players online counter?

make (bacon)

Last edited by ducky_boy010 (May 14, 2024 05:45:11)

Blazing_Codes
Scratcher
37 posts

how do you make a players online counter?

when green flag clicked
change [player active v] by (1)
forever
set [.timer v] to (timer)
end

when [timer v] > ((.timer v) + (0.01))
change [player active v] by (-1)
I hope this might help!

Last edited by Blazing_Codes (May 18, 2024 15:32:16)

leviawesomecoder
Scratcher
6 posts

how do you make a players online counter?

I noticed.
shba8
Scratcher
0 posts

how do you make a players online counter?

I think I figured it out: https://scratch.mit.edu/projects/1039648344/ check out the code in this, the thing is if you make a detector for the stop button the people playing do not always press the stop button so I made a list saying the people online, then I made it so if you are on the list twice like when you click the flag 2 times it will detect it, delete one of the 2 usernames that are yours, and that goes to the variable Players Online, now if you join twice it only counts it as once and it is the same if you join 3 times or 4 and so on

Last edited by shba8 (June 20, 2024 17:17:53)

SnickersTheTurtle
Scratcher
3 posts

how do you make a players online counter?

ok i have no idea still even for years but i have something
TeamNITE_gaming
Scratcher
30 posts

how do you make a players online counter?

Thx!
JamesTheScratcherBoy
Scratcher
57 posts

how do you make a players online counter?

when green flag clicked
help me
Dragonmyflesh
Scratcher
500+ posts

how do you make a players online counter?

IMAhomosapien wrote:

when green flag clicked
change(☁ players)by (1)




That wouldn't work.

Last edited by Dragonmyflesh (July 13, 2024 18:23:08)

Calvin9901
Scratcher
1 post

how do you make a players online counter?

I still don't know
unceasingfoot37
Scratcher
4 posts

how do you make a players online counter?

the fact that nothing here is as helpful as i tought it would be is kind of insane
forever

say [the fact that nothing here is as helpful as i tought it would be is kind of insane]end
Koamodo975
Scratcher
1000+ posts

how do you make a players online counter?

my god yall stop necroposting

Powered by DjangoBB