Thread: Events: Teams?
View Single Post
  #7  
Old 01-16-2011, 05:22 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Modulus is so not fun enough.

Randomizing with Sortvalue

PHP Code:
// Loop through each player in the level
for (temp.plplayers) {
  
// Make sure they aren't part of the ET
  
if (temp.pl.guild != "Events Team") {
    
// Add Player to Temp Players Array
    
temp.plyrs.add(temp.pl);
    
// Assign the Player a Random Sortvalue
    
temp.plyrs[temp.plyrs.size()-1].sortvalue random(0100);
  }
}
// Sort the Array by Value
temp.plyrs.sortbyvalue("sortvalue""float"false);
// Split the Array Appropriately and Assign Guild Tags
for (temp.pltemp.plyrs) {
  
// Your other code here

It's not really necessary to use a randomizer since the order of the players array isn't exactly public knowledge but for a queuing system it might be something to prevent players from stacking teams.
__________________
Quote:
Reply With Quote