Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function Teams($useraction = 0)
- {
- $teams = 0;
- if($this->_main->teams_nb[1] >= ($this->_main->teams_nb[2]+2)) // Si les bleus sont +2 (2), on en envoie vers les rouges (1)
- {
- $nombre_trop = floor(($this->_main->teams_nb[1]-$this->_main->teams_nb[2])/2);
- $teams_plus = 1;
- $teams_moins = 2;
- $teams = 1;
- }
- elseif($this->_main->teams_nb[2] >= ($this->_main->teams_nb[1]+2)) // Si les Rouges sont +2 (1), on en envoie vers les bleus (2)
- {
- $nombre_trop = floor(($this->_main->teams_nb[2]-$this->_main->teams_nb[1])/2);
- $teams_plus = 2;
- $teams_moins = 1;
- $teams = 1;
- }
- else
- {
- $teams = 0;
- }
- // Après infos récuperer while et foreach
- if($teams == 1)
- {
- // Array pour forceteam
- $teams_array = array('', 'red', 'blue');
- while($nombre_trop > 0)
- {
- $array_keys = array_keys($this->_main->teams[$teams_plus]);
- $rand = $array_keys[rand(0, (count($array_keys)-1))];
- $teams_moins2 = $teams_array[$teams_moins];
- $this->_main->query->RCon('forceteam '.$rand.' '.$teams_moins2.'');
- --$nombre_trop;
- }
- if($useraction) $this->_main->query->tell($this->_main->clientID, 'Teams equilibrees !');
- }
- else
- {
- if($useraction) $this->_main->query->tell($this->_main->clientID, 'Teams deja equilibrees !');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment