/** !nextmap command. Return next map. * This function is the command !next. Return next map. * * \param $player The player who send the command. * \param $command The command's parameters. * * \return Nothing. */ public function CommandNext($player, $command) { $nextmap = Rcon::g_nextmap(); $nextmap = explode('"', $nextmap); $nextmap = trim(str_replace('^7', '', $nextmap[2])); if ($nextmap != '') { RCon::tell($player, 'Nextmap is : $0', array($nextmap)); return TRUE; } else { $servername = Server::getName(); if ($this->config[$servername]['CycleMapFile'] !== NULL) { $content = Server::fileGetContents($this->config[$servername]['CycleMapFile']); if ($content !== FALSE) { $tab_maps = explode("\n", $content); $current_map = Server::getServer()->serverInfo['mapname']; $index = 0; while ($index <= count($tab_maps) - 1) { if ($current_map == $tab_maps[$index]) { break; } else { $index++; } if ($tab_maps[$index] == '{') { for (; $tab_maps[$index - 1] != '}'; $index++) { } } } $index++; if ($tab_maps[$index] == '{') { for (; $tab_maps[$index - 1] != '}'; $index++) { } } if (isset($tab_maps[$index])) { $nextmap = $tab_maps[$index]; } else { $nextmap = $tab_maps[0]; } RCon::tell($player, 'Nextmap is : $0', array($nextmap)); return TRUE; } } } RCon::tell($player, "We don't know the next map"); }