Re:Forcing Clients into Rooms - 2008/06/02 07:23I'm about to wrap up for the day, wondering if anyone can help with how to get number of clients in a room python side?
Re:Forcing Clients into Rooms - 2008/06/03 23:49Hi Sean,
Thanks for getting back to me.
The idea is to setup an overflow method for room connections. ie: When the room reaches a connection limit, create a new room.
My limit for example is 10. When the room has 10 clients, we spawn a new room and fill that until 10, then repeat.
My code so far:
Code:
# count existing rooms
roomID = 0
for p in self.server.allRooms.values():
roomID = roomID+1
# if a room exists
if roomID > 0:
# count clients
for p in self.server.allRooms.values():
if len(p.allNickNames) < MaxPerRoom:
# force client to join room
client.clientSendMessage('<join room="'+p.name+'" />')
else:
# no rooms are created, make the first room
client.clientSendMessage('<join room="r'+str(roomID)+'" />')
I'm relatively new to Python so please excuse my code structure. It will be refined as I learn.
Re:Forcing Clients into Rooms - 2008/06/05 00:43Hi!
I get a syntax error if I attempt +=, must be using an older version of python.
Code:
Python 2.3.5 (#1, Dec 7 2006, 14:50:51)
[GCC 4.0.1 (Apple Computer, Inc. build 5363) (+4864187)] on darwin
Type "help", "copyright", "credits" or "license" for more information.