Don't like ads? PRO users don't see any ads ;-)
Guest

edited poweradminurt snippet

By: a guest on Jun 25th, 2012  |  syntax: Python  |  size: 1.03 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # check if player was allowed to join this team
  2.         if not self.countteams():
  3.           self._balancing = False
  4.           self.error('Aborting teambalance. Counting teams failed!')
  5.           return False
  6.         if abs(self._teamred - self._teamblue) <= self._teamdiff:
  7.           # teams are balanced
  8.           self.verbose('Teams are balanced, red: %s, blue: %s' %(self._teamred, self._teamblue))
  9.           # done balancing
  10.           self._balancing = False
  11.           return None
  12.         else:
  13.           # teams are not balanced
  14.           self.verbose('Teams are NOT balanced, red: %s, blue: %s' %(self._teamred, self._teamblue))
  15.  
  16.  
  17.           if self._teamred > self._teamblue:
  18.             # join the blue team
  19.             self.verbose('Forcing %s to the Blue team' % client.name)
  20.             self.console.write('forceteam %s blue' % client.cid)
  21.           else:
  22.             # join the red team
  23.             self.verbose('Forcing %s to the Red team' % client.name)
  24.             self.console.write('forceteam %s red' % client.cid)