Get User Count in Every Zone

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
Sigtran
Posts: 56
Joined: 10 Mar 2011, 15:54
Location: Ireland

Get User Count in Every Zone

Post by Sigtran »

Hi, I would like to limit the number of users in a zone to say 250 users (to not crowd the screens). I would like to create a "Zone" choice menu for users, which will have just a simple zone list (e.g. all zones are copies of the first zone and they all are using the same extensions). For this I need to know exactly how many users are currently logged in to each of the zones (so I can provide different config file to the user, depending on the choice). According to the API I can only get the

Code: Select all

getUserCount()
          Get the current amount of Users connected to the Zone
Which is the current Zone's user count (also for this a user will need to be logged in).

So to sum up, I would need:
- user count in every zone running on the server, - Array/Object/XML style (ZoneName,int), So I can parse it and create a menu (similar to what admin tool is using).

OR
should I just save the current user count from time to time to the DB & then just read it from it using PHP/Java ?

Any other suggestions to get the desired effect are also welcome
Thank you.
mka
Posts: 15
Joined: 31 Jan 2011, 02:43

Post by mka »

Not sure, if it is a lot of help to you. But what we do to solve this problem is to have each zone report to a webservice on ServerReady event and periodically after that as well (via a scheduled task). On each ping back to the webservice we also send the number of users currently logged in on each zone.

If you don't want to do the webservice, you could instead write to the database and keep a list of online zones with their online user count there.
Sigtran
Posts: 56
Joined: 10 Mar 2011, 15:54
Location: Ireland

Post by Sigtran »

thanks mka, yeah, i guess ill do the scheduling task for the DB (its easier for me to use).
If there any other ways, please post them up. thank you.

EDIT: done the scheduled task & it works just perfect
Post Reply