# F8 AS2 Electroserver 3 in a buckle

**URL:** <https://forum.kirupa.com/t/f8-as2-electroserver-3-in-a-buckle/318959>\
**Category:** programming\
**Created:** [February 4, 2011, 12:09pm UTC](https://forum.kirupa.com/t/f8-as2-electroserver-3-in-a-buckle/318959 "2011-02-04T12:09:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![capdetrons](https://avatars.discourse-cdn.com/v4/letter/c/df705f/32.png) [@capdetrons](https://forum.kirupa.com/u/capdetrons)\
**Post date:** [February 4, 2011, 12:09pm UTC](https://forum.kirupa.com/t/f8-as2-electroserver-3-in-a-buckle/318959/1 "2011-02-04T12:09:09Z")

</div>

Good day!  
I am trying to get this game from the Electroserver 3 examples to work.

I know this is old stuff, but it’s for the sake of learning. From the old forums in electroserver I remember a post where Jobe, the creator of this game mentioned that the client was no table to sort the userlist so I have tried to build a plugin to create and populate it in a sorted manner.

When I receive this userlist in the clients, it builds a sorted playerList but I can’t understand why the userList won’t be seen inside the showUsers() function in the game frame when it exists in the timeline:

// Gets the userList  
//trace("UserList "+userList);

function showUsers(userList, type, name) {  
if (type == “userleft” && name == opponent) {  
game\_clip.opponent\_left();  
}

// if I try to get the userList here, nothing shows:  
// trace("UserList "+userList);  
spectatorList = new Array();  
//Max players allowed in this game  
maxPlayers = es.getRoom().Description.attributes.numPlayers;  
allowSpectators = es.getRoom().Description.attributes.allowSpectators;  
//myNum = es.getUser().AssignedNumber.value;  
var highestNum:Number = 0;  
for (var i = 0; i\<userList.length; ++i) {  
var user:Object = userList\*;  
var num:Number = i;  
user.AssignedNumber.value = num;  
if (num\>=0 && num != undefined && num != null && num\<maxPlayers) {  
//Add them to the player list  
if (num\>highestNum) {  
highestNum = num;  
}  
user.gamePlayer = true;  
playerList.push(user);  
trace(playerList\*.Name.value);  
} else {  
//Add them to the spectator list  
user.gamePlayer = false;  
spectatorList.push(user);  
}  
}

//Populate the on-screen list boxes  
showBothListBoxes();  
if (playerList.length == maxPlayers && num == 0) {  
//If everyone is here and you are player 0 (i.e., the game master), then tell everyone to start the process  
sendStartMove(playerList[1].Name.value);  
} else if (playerList.length == maxPlayers && num == 1) {  
trace("Jugador 0 = "+playerList[0].Name.value);  
trace("Jugador 1 = "+playerList[1].Name.value);  
sendStartMove();  
} else if (playerList.length == maxPlayers) {  
spectatorStart();  
}  
if (!es.getUser().gamePlayer && es.getUser().AssignedNumber.value\>=maxPlayers) {  
//This happens when you click to join as a player but someone else just barely beats you to it to fill out he game  
//This user should be informed and given the option to watch or leave  
if (!allowSpectators) {  
//They don’t allow spectators. You tried to join as a player but the game was full  
goBack();  
}  
}  
if (es.getRoom().Description.attributes.playersArrived != highestNum+1 && num == 0) {  
//+1 because the numbering starts from 0  
changeDetail(highestNum+1);  
}  
game\_clip.setGamePlayerList(playerList);  
game\_clip.setSpectatorList(spectatorList);  
}
