MatchMakingLobby/Match/Plugin.php
protected function prepare($match)
	{
		\ManiaLive\Utilities\Logger::debug($match);
		$this->players = array_fill_keys($match->players, Services\PlayerInfo::PLAYER_STATE_NOT_CONNECTED);
		$this->match = $match;
		$this->matchId = $match->id;
		Label::EraseAll();

		foreach($match->players as $login)
		{
			$this->connection->addGuest((string)$login, true);
		}
		$this->connection->restartMap(false, true);
		$this->connection->executeMulticall();

		$this->enableDedicatedEvents(
			ServerEvent::ON_PLAYER_CONNECT |
			ServerEvent::ON_PLAYER_DISCONNECT |
			ServerEvent::ON_END_MATCH |
			ServerEvent::ON_END_ROUND |
			ServerEvent::ON_PLAYER_INFO_CHANGED |
			ServerEvent::ON_MODE_SCRIPT_CALLBACK |
			ServerEvent::ON_MODE_SCRIPT_CALLBACK_ARRAY
		);

		\ManiaLive\Utilities\Logger::debug(sprintf('Preparing match for %s (%s)',$this->lobby->login, implode(',', array_keys($this->players))));
		$this->changeState(self::WAITING);
		$this->waitingTime = 0;
		$this->connection->setForcedTeams(true);
	}
protected function prepare($match)
	{
		\ManiaLive\Utilities\Logger::debug($match);
		$this->players = array_fill_keys($match->players, Services\PlayerInfo::PLAYER_STATE_NOT_CONNECTED);
		$this->match = $match;
		$this->matchId = $match->id;
		Label::EraseAll();

		foreach($match->players as $login)
		{
			$this->connection->addGuest((string)$login, true);
		}
		$this->connection->restartMap(false, true);
		$this->connection->executeMulticall();

		$this->enableDedicatedEvents(
			ServerEvent::ON_PLAYER_CONNECT |
			ServerEvent::ON_PLAYER_DISCONNECT |
			ServerEvent::ON_END_MATCH |
			ServerEvent::ON_END_ROUND |
			ServerEvent::ON_PLAYER_INFO_CHANGED |
			ServerEvent::ON_MODE_SCRIPT_CALLBACK |
			ServerEvent::ON_MODE_SCRIPT_CALLBACK_ARRAY
		);

		\ManiaLive\Utilities\Logger::debug(sprintf('Preparing match for %s (%s)',$this->lobby->login, implode(',', array_keys($this->players))));
		$this->changeState(self::WAITING);
		$this->waitingTime = 0;
		$this->connection->setForcedTeams(true);
	}
protected function prepare ( $ match ) { \ ManiaLive \ Utilities \ Logger :: debug ( $ match ) ; $ this -> players = array_fill_keys ( $ match -> players , Services \ PlayerInfo :: PLAYER_STATE_NOT_CONNECTED ) ; $ this -> match = $ match ; $ this -> matchId = $ match -> id ; Label :: EraseAll ( ) ; foreach ( $ match -> players as $ login ) { $ this -> connection -> addGuest ( ( string ) $ login , true ) ; } $ this -> connection -> restartMap ( false , true ) ; $ this -> connection -> executeMulticall ( ) ; $ this -> enableDedicatedEvents ( ServerEvent :: ON_PLAYER_CONNECT | ServerEvent :: ON_PLAYER_DISCONNECT | ServerEvent :: ON_END_MATCH | ServerEvent :: ON_END_ROUND | ServerEvent :: ON_PLAYER_INFO_CHANGED | ServerEvent :: ON_MODE_SCRIPT_CALLBACK | ServerEvent :: ON_MODE_SCRIPT_CALLBACK_ARRAY ) ; \ ManiaLive \ Utilities \ Logger :: debug ( sprintf ( 'Preparing match for %s (%s)' , $ this -> lobby -> login , implode ( ',' , array_keys ( $ this -> players ) ) ) ) ; $ this -> changeState ( self :: WAITING ) ; $ this -> waitingTime = 0 ; $ this -> connection -> setForcedTeams ( true ) ; }
Prepare the server config to host a match
Then wait players' connection
@param Services\Match $match
Prepare the server config to host a match Then wait players connection