Player counter?

Posted by BubbleDerp
Is there a built-in function that can get the number of players on the server or game? If not how could I go about doing this?

Replies (2)

Last message on 18 Nov 2018

Size43 (Administrator) on 18 Nov 2018, 15:12:04
As Jenraux noted, your best bet is to sum up all players in all sessions. That will only give you the number of players for a specific version of your game, but there is no alternative that will return the total count.

If you're only using one session you can also get away with using gms_other_count() + 1.
Jenraux on 10 Nov 2018, 15:57:12
You can fetch back the number of players in the current session using gms_session_player_count
https://gamemakerserver.com/en/docs/script/gms_session_player_count/
I guess for an actual player count, you could increment the number by 1 whenever someone logs in, and decrease by 1 whenever someone logs out.