
edited poweradminurt snippet
By: a guest on
Jun 25th, 2012 | syntax:
Python | size: 1.03 KB | hits: 17 | expires: Never
# check if player was allowed to join this team
if not self.countteams():
self._balancing = False
self.error('Aborting teambalance. Counting teams failed!')
return False
if abs(self._teamred - self._teamblue) <= self._teamdiff:
# teams are balanced
self.verbose('Teams are balanced, red: %s, blue: %s' %(self._teamred, self._teamblue))
# done balancing
self._balancing = False
return None
else:
# teams are not balanced
self.verbose('Teams are NOT balanced, red: %s, blue: %s' %(self._teamred, self._teamblue))
if self._teamred > self._teamblue:
# join the blue team
self.verbose('Forcing %s to the Blue team' % client.name)
self.console.write('forceteam %s blue' % client.cid)
else:
# join the red team
self.verbose('Forcing %s to the Red team' % client.name)
self.console.write('forceteam %s red' % client.cid)