diff --git a/public/js/console.js b/public/js/console.js index 3fd0240..0b2f5ee 100644 --- a/public/js/console.js +++ b/public/js/console.js @@ -210,8 +210,8 @@ $(document).ready(function () { const data = { team1: $('#team1').val(), team2: $('#team2').val(), - selectedMap: $('#selectedMap').val(), - game_mode: $('#game_mode').val(), + map: $('#map').val(), + mode: $('#mode').val(), server_id: window.server_id }; send_post_request('/api/setup-game', data); diff --git a/routes/game.js b/routes/game.js index 508c02b..8219fb4 100644 --- a/routes/game.js +++ b/routes/game.js @@ -13,8 +13,8 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => { const server_id = req.body.server_id; const team1 = req.body.team1; const team2 = req.body.team2; - const selected_map = req.body.selectedMap; - const game_sel = req.body.game_sel.toString(); + const map = req.body.map; + const game = req.body.game.toString(); if (team1.trim() != "") { await rcon.execute_command(server_id, `mp_teamname_1 "${team1}"`); @@ -24,24 +24,24 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => { await rcon.execute_command(server_id, `mp_teamname_2 "${team2}"`); } - if (game_sel == "1") { + if (game == "1") { await rcon.execute_command(server_id, `game_mode 1`); execute_cfg_on_server(server_id, './cfg/live_competitive_16.cfg'); - } else if (game_sel == "2") { + } else if (game == "2") { await rcon.execute_command(server_id, `game_mode 1`); execute_cfg_on_server(server_id, './cfg/live_competitive_24.cfg'); - } else if (game_sel == "3") { + } else if (game == "3") { await rcon.execute_command(server_id, `game_mode 1`); execute_cfg_on_server(server_id, './cfg/live_casual_16.cfg'); - } else if (game_sel == "4") { + } else if (game == "4") { await rcon.execute_command(server_id, `game_mode 1`); execute_cfg_on_server(server_id, './cfg/live_casual_24.cfg'); - } else if (game_sel == "5") { + } else if (game == "5") { await rcon.execute_command(server_id, `game_mode 2`); execute_cfg_on_server(server_id, './cfg/live_wingman.cfg'); } await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`); - await rcon.execute_command(server_id, `changelevel ${selected_map}`); + 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(() => { diff --git a/views/manage.ejs b/views/manage.ejs index 3e9fea1..35ae3a4 100644 --- a/views/manage.ejs +++ b/views/manage.ejs @@ -95,8 +95,8 @@
- - @@ -106,7 +106,7 @@
-