From a0ae297bf617b7941b35f8b2d83e789d5e9c632f Mon Sep 17 00:00:00 2001 From: shoopea Date: Tue, 29 Oct 2024 20:33:05 +0100 Subject: [PATCH] conditionnal warmup for rounds --- routes/game.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/routes/game.js b/routes/game.js index 8219fb4..09640d3 100644 --- a/routes/game.js +++ b/routes/game.js @@ -31,10 +31,10 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => { await rcon.execute_command(server_id, `game_mode 1`); execute_cfg_on_server(server_id, './cfg/live_competitive_24.cfg'); } else if (game == "3") { - await rcon.execute_command(server_id, `game_mode 1`); + await rcon.execute_command(server_id, `game_mode 0`); execute_cfg_on_server(server_id, './cfg/live_casual_16.cfg'); } else if (game == "4") { - await rcon.execute_command(server_id, `game_mode 1`); + await rcon.execute_command(server_id, `game_mode 0`); execute_cfg_on_server(server_id, './cfg/live_casual_24.cfg'); } else if (game == "5") { await rcon.execute_command(server_id, `game_mode 2`); @@ -44,9 +44,15 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => { await rcon.execute_command(server_id, `changelevel ${map}`); // Adding 1 second delay in executing warmup.cfg to make it effective after map has been changed. - setTimeout(() => { - execute_cfg_on_server(server_id, './cfg/warmup.cfg'); - }, 1000) + if (game == "1" || game == "3" || game == "5") { + setTimeout(() => { + execute_cfg_on_server(server_id, './cfg/warmup_16.cfg'); + }, 1000) + } else if (game == "2" || game == "4") { + setTimeout(() => { + execute_cfg_on_server(server_id, './cfg/warmup_24.cfg'); + }, 1000) + } return res.status(200).json({ message: 'Game Created!' }); } catch (error) {