diff --git a/backend/src/match.ts b/backend/src/match.ts index e3825db..64fb099 100644 --- a/backend/src/match.ts +++ b/backend/src/match.ts @@ -266,7 +266,7 @@ export const say = async (match: Match, message: string) => { export const getConfigVar = async (match: Match, configVar: string): Promise => { const response = await execRcon(match, configVar); - const configVarPattern = new RegExp(`^"${configVar}" = "(.*?)"`); + const configVarPattern = new RegExp(`^${configVar} = (.*)`); const configVarMatch = response.match(configVarPattern); if (configVarMatch) { return configVarMatch[1]!; diff --git a/backend/src/matchMap.ts b/backend/src/matchMap.ts index 99afec5..85dae36 100644 --- a/backend/src/matchMap.ts +++ b/backend/src/matchMap.ts @@ -168,7 +168,8 @@ export const loadMap = async (match: Match.Match, matchMap: IMatchMap) => { await Match.say(match, `MAP WILL BE CHANGED TO ${matchMap.name} IN 15 SECONDS`); match.log(`change map to ${matchMap.name} (in 15 seconds)`); const response = await Match.execRcon(match, `maps ${matchMap.name}`); - if (!response.includes(` ${matchMap.name}.bsp`)) { + const maps = response.trim().split("\n").map((map) => map.trim()); + if (!maps.includes(matchMap.name)) { match.log(`Map ${matchMap.name} could not be found on the server`); await Match.say(match, `Map ${matchMap.name} could not be found on the server`); return; @@ -215,7 +216,7 @@ const startMatch = async (match: Match.Match, matchMap: IMatchMap) => { }; const refreshOvertimeAndMaxRoundsSettings = async (match: Match.Match, matchMap: IMatchMap) => { - matchMap.overTimeEnabled = (await Match.getConfigVar(match, 'mp_overtime_enable')) === '1'; + matchMap.overTimeEnabled = (await Match.getConfigVar(match, 'mp_overtime_enable')) === "true"; matchMap.overTimeMaxRounds = parseInt(await Match.getConfigVar(match, 'mp_overtime_maxrounds')); matchMap.maxRounds = parseInt(await Match.getConfigVar(match, 'mp_maxrounds')); MatchService.scheduleSave(match);