View Single Post
  #2  
Old 08-26-2008, 05:19 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Could always do something like this:
PHP Code:
function sortPlayers()
{
  
temp.totalCount = 0;
  
  for ( 
temp.pl : players )
  {
    if ( 
pl.guild == "Events Team" )
    {
      continue;
    }
    
    
totalCount ++;
  }
  
  
temp.needed = { getPercentOf( totalCount, .6 ), getPercentOf( totalcount, .4 ) }; // { needed convicts, needed convicts }
  
temp.guilds = { "Convict", "Guard" };
  
temp.totalCount = 0;
 
  for ( 
temp.pl : players )
  {
    if ( 
pl.guild == "Events Team" )
    {
      continue;
    }
  
    if ( 
totalCount ++ > needed[ 0 ] )
    {
      
pl.guild = guilds[0];
    }
    else
    {
      
pl.guild = guilds[1];
    }
  }
}
function 
getPercentOf( totalCount, percent )
{
  
temp.p = int( totalCount * percent );
  return 
p <= 0 ? 0 : p;
} 
Haven't tested this, but I think it should work. I'm open to new ways to do this as well.

Formatting got messed up when I pasted it in, but I think I fixed it.
__________________
Reply With Quote