function setCommands($commands)
 {
     try {
         $service = new \DedicatedManager\Services\ScriptService();
         $matchCommands = $service->getActions($this->server->connection);
         foreach ($commands as $key => $value) {
             switch ($matchCommands[$key]->type) {
                 case 'int':
                     $commands[$key] = (int) $value;
                     break;
                 case 'double':
                     $commands[$key] = (double) $value;
                     break;
                 case 'boolean':
                     $commands[$key] = (bool) $value;
                     break;
                 case 'string':
                 default:
                     $commands[$key] = (string) $value;
             }
         }
         $this->server->connection->sendModeScriptCommands($commands);
         $this->session->set('success', _('Commands successfully passed'));
     } catch (\Exception $e) {
         \ManiaLib\Application\ErrorHandling::logException($e);
         $this->session->set('error', _('An error occured while setting commands'));
     }
     $this->request->redirectArgList('../commands', 'host', 'port');
 }
 function maps()
 {
     set_time_limit(0);
     list(, , $system) = $this->fetchAndAssertConfig(_('selecting maps'));
     $gameInfos = $this->fetchAndAssertSettings(_('selecting maps'));
     $service = new \DedicatedManager\Services\TitleService();
     $environment = $service->getEnvironment($system->title);
     if ($gameInfos->gameMode == GameInfos::GAMEMODE_SCRIPT) {
         $service = new \DedicatedManager\Services\ScriptService();
         $type = $service->getFileMapType($gameInfos->scriptName, $system->title);
     } else {
         $type = array('Race');
     }
     $isLaps = $gameInfos->gameMode == GameInfos::GAMEMODE_LAPS;
     $service = new \DedicatedManager\Services\MapService();
     $this->response->files = $service->getList('', true, $isLaps, $type, $environment);
     $this->response->selected = $this->session->get('selected', array());
     $this->response->randomize = $this->session->get('randomize', false);
     $header = \DedicatedManager\Helpers\Header::getInstance();
     $header->rightText = _('Back to game settings');
     $header->rightIcon = 'back';
     $header->rightLink = $this->request->createLinkArgList('../rules');
 }