コード例 #1
0
        public override GameResult SetConfigParams(ConfigParams configParams)
        {
            var result = base.SetConfigParams(configParams);

            var host = $"cd {Path}/{GameName}/serverfiles/{GameCode}/cfg;";

            Client.RunCommand(host + $"chmod 777 {GameName}{GameServerId}.cfg;");
            Client.RunCommand(host + $"echo  \"hostname \\\"{configParams.GetVal("hostname")}\\\"\" > {GameName}{GameServerId}.cfg;");
            Client.RunCommand(host + $"echo  \"rcon_password \\\"{configParams.GetVal("rcon_password")}\\\"\" >> {GameName}{GameServerId}.cfg;");
            Client.RunCommand(host + $"echo  \"sv_password \\\"{configParams.GetVal("sv_password")}\\\"\" >> {GameName}{GameServerId}.cfg;");
            Client.RunCommand(host + $"echo  \"log on\nsv_logbans 1\nsv_logecho 1\nsv_logfile 1\nsv_log_onefile 0\" >> {GameName}{GameServerId}.cfg;");
            Client.RunCommand(host + $"echo  \"sv_aim 0\npausable 0\nsv_maxspeed 320\" >> {GameName}{GameServerId}.cfg;");
            Client.RunCommand(host + $"echo  \"mp_timelimit {configParams.GetVal("mp_timelimit")}\" >> {GameName}{GameServerId}.cfg;");
            Client.RunCommand(host + $"echo  \"sv_cheats 0\nexec listip.cfg\nexec banned.cfg\" >> {GameName}{GameServerId}.cfg;");

            if (!CompleteInstal())
            {
                result.Error        = GameHostTypeError.CantCreate;
                result.Succes       = false;
                result.ErrorMessage = "Error сreate config file";
            }
            return(result);
        }