Page 1 of 1

Determine the number of players on the server

Posted: Fri Apr 05, 2019 10:57 am
by Salaander
Hi,

I hope I create this topic in the right channel, if not move it please.
I created a server yesterday on DigitalOcean and also a small webpage so I would be able to send the server management to my friends I'm playing with.
So far we played from a local server but I want to move it to a 3rd party.

My plan is to have the VM shut down if there is no activity on the server for X minutes and then if somebody tries to connect to the server (over a domain and proxy I manage) I will auto start the server with the DO API. I wanted to ask what do you think would be the best and most supported way to determine the number of players on the server? I see JOINED and LEAVE are logged but I really would like to avoid log parsing. I thought I might be able to solve it with a LUA mod and write the player list to a file every few tick, but I'm not sure how a good idea it is and if this disables the achievements or not.

Would you share your suggestions and ideas with me please? Maybe it is solved already? If you are interested in the result I can share the setup too.

Best,
Salaander

Re: Determine the number of players on the server

Posted: Tue Jul 01, 2025 10:24 pm
by ctalkep_
posting in a 6 year old thread that was first on google
i tried parsing the log and subtracting the [leave]'s from [join]'s but that only works for so long - connecting halfway and then cancelling will only make a [join], adding a phantom player to the counter

think it would need a mod that logs online playercount every so often to do or maybe viewtopic.php?t=81455

Re: Determine the number of players on the server

Posted: Wed Jul 02, 2025 10:21 am
by Bilka
If you have access to the server's stdin, you can use the /players command, so /players online count or /p o c for short.