Page 1 of 1

Cycling through zones

Posted: 22 Sep 2010, 09:02
by MaartenWSG
Hi there,

I'm working on a project which uses Smartfox Server and I was wondering if it's possible to cycle through the zones, so people can see how many users are on each zone and how full it is.

In the docs I've found the way to connect to Smartfox by XMLSocket in order to get the usercount for each zone, but I was wondering if there is another way to get more zone info (like zone names, capacity, usercount etc) beforehand so users can choose which zone to log onto.

Thanks in advance,

Maarten

Posted: 24 Sep 2010, 13:42
by Lapo
You can obtain a list of Zones from server side in your extension, and then send the relevant data to clients. However you will first need to create a common Zone where all players are initially logged in before being able to access any other Zone.

What language do you use on the server side? Java?
If so you can use:

Code: Select all

SmartFoxServer.getInstance().getAllZones()

Posted: 31 Oct 2011, 19:14
by danieltjewett
Is there an equivalent in ActionScript? I tried getAllZones and get a runtime error of "cannot find function." We're using SmartFoxServer v 1.6.6

Posted: 01 Nov 2011, 01:44
by BigFIsh
Have you tried _server.instance.getAllZones(); ?

Posted: 01 Nov 2011, 12:05
by danieltjewett
I just tried and it works. It returns a java ArrayList (or something similar) of Zones instead of an Array like I thought. Thanks for your help!