smooshie

Shows which users joined plug first

Jul 16th, 2012
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var userlist = API.getUsers();
  2. var peopleinroom = userlist.length;
  3. var userIDs = new Array();
  4. var sortedUsers = new Array();
  5.  
  6. for(var i=0; i<peopleinroom;i++) {
  7.  
  8. userIDs.push(parseInt(userlist[i].id));
  9. userIDs.sort();
  10.  
  11. }
  12.  
  13. for (var i=0; i<peopleinroom; i++) {
  14.  
  15. sortedUsers.push(Models.room.getUserByID(userIDs[i]).username);
  16.  
  17. }
  18.  
  19. console.log("The users in this room, sorted by join date, are: " + sortedUsers);
Advertisement
Add Comment
Please, Sign In to add comment