Room property isPasswordProtected is always false

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

Post Reply
my_marat
Posts: 1
Joined: 14 May 2012, 09:25

Room property isPasswordProtected is always false

Post by my_marat »

Hey. I'm having problems with the password for the room. If I create a room dynamically, then the property isPasswordProtected is always false. Server 2.0.0-RC3. Can somebody help me?

Code: Select all

public function createRoom(name:String, password:String, maxUsers:int, diff:int):void
		{
			var settings	:SFSGameSettings 	= new SFSGameSettings(name),
				roomVarObj1	:ISFSObject			= new SFSObject(),
				roomVarObj2	:ISFSObject			= new SFSObject(),
				slot1		:SFSRoomVariable,
				slot2		:SFSRoomVariable,
				slot3		:SFSRoomVariable,
				slot4		:SFSRoomVariable	= new SFSRoomVariable('4', roomVarObj1),
				events		:RoomEvents			= new RoomEvents();
			
			slot1 = new SFSRoomVariable(PluginConstants.GAME_STARTED_VARIABLE, false);
			slot2 = new SFSRoomVariable(PluginConstants.GAME_DIFFICULT_VARIABLE, diff);
			slot3 = new SFSRoomVariable(PluginConstants.OWNER_ID_VARIABLE, userModel.userInfo.gameId );
			
			events.allowUserVariablesUpdate = true;
			events.allowUserExit = true;
			events.allowUserEnter = true;
			events.allowUserCountChange = true;
			
			settings.maxVariables = 7;
			settings.maxUsers = maxUsers;
			settings.isPublic = true;
			settings.minPlayersToStartGame = 1;
			settings.isGame = true;
			settings.groupId = 'default';
			settings.password = password;
			settings.variables = [ slot1, slot2, slot3, slot4 ];
			settings.extension = new RoomExtension(gameInfo.xtName, gameInfo.xtScript);
			settings.leaveLastJoinedRoom = true;
			settings.events = events;
			
			GameServer.sfs.send(new CreateSFSGameRequest(settings));
		}

Code: Select all

private function onRoomAdded(evt:SFSEvent):void
		{
			var room:Room = evt.params.room;
			if (room.isPasswordProtected )
			{
				roomProvider.addItem( { icon:getRoomIcon(room), label:getRoomLabel(room), data:room } );
			}
			
		}
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Room property isPasswordProtected is always false

Post by Lapo »

RC3 is pretty old you should update to the latest version (2.1.0)
Thanks!
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply