Get userCount from room

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Get userCount from room

Postby rjgtav » 07 Apr 2010, 10:26

Hi guys. In my game it creates game rooms with uCount set to true but i can't get the number of users online in that room with:

Code: Select all

userCount = room.getUserCount();


it gives me "undefined". Please help me.
smoochict
Posts: 53
Joined: 18 Mar 2010, 06:21

Postby smoochict » 07 Apr 2010, 10:36

Hello,

Are you using:

int usersonline = roomobj.getUserCount();
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 07 Apr 2010, 11:00

i think that's what i'm using.

Code: Select all

smartfox.onJoinRoom = function(room:Object) {
   
   var roomId:Number = room.getId();
   var userList:Object = room.getUserList();
   resetRoomSelected(roomId);
   userCount = room.getUserCount();

(...)
}
smoochict
Posts: 53
Joined: 18 Mar 2010, 06:21

Postby smoochict » 07 Apr 2010, 11:01

Hello,

Is this using the client api? or in an extension.

I don't think you can get the user count via the client api
smoochict
Posts: 53
Joined: 18 Mar 2010, 06:21

Postby smoochict » 07 Apr 2010, 11:04

Sorry. please ignore the above post:

Try:

var usersNum:Number = room.getUserCount()
trace("There are " + usersNum + " users in the room")
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Postby rjgtav » 07 Apr 2010, 12:50

thanks now it's working

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 79 guests