fix const names

This commit is contained in:
shoopea 2024-10-29 20:25:01 +01:00
parent e9182933ca
commit 3133176813
3 changed files with 13 additions and 13 deletions

View File

@ -210,8 +210,8 @@ $(document).ready(function () {
const data = { const data = {
team1: $('#team1').val(), team1: $('#team1').val(),
team2: $('#team2').val(), team2: $('#team2').val(),
selectedMap: $('#selectedMap').val(), map: $('#map').val(),
game_mode: $('#game_mode').val(), mode: $('#mode').val(),
server_id: window.server_id server_id: window.server_id
}; };
send_post_request('/api/setup-game', data); send_post_request('/api/setup-game', data);

View File

@ -13,8 +13,8 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => {
const server_id = req.body.server_id; const server_id = req.body.server_id;
const team1 = req.body.team1; const team1 = req.body.team1;
const team2 = req.body.team2; const team2 = req.body.team2;
const selected_map = req.body.selectedMap; const map = req.body.map;
const game_sel = req.body.game_sel.toString(); const game = req.body.game.toString();
if (team1.trim() != "") { if (team1.trim() != "") {
await rcon.execute_command(server_id, `mp_teamname_1 "${team1}"`); 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}"`); 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`); await rcon.execute_command(server_id, `game_mode 1`);
execute_cfg_on_server(server_id, './cfg/live_competitive_16.cfg'); 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`); await rcon.execute_command(server_id, `game_mode 1`);
execute_cfg_on_server(server_id, './cfg/live_competitive_24.cfg'); 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`); await rcon.execute_command(server_id, `game_mode 1`);
execute_cfg_on_server(server_id, './cfg/live_casual_16.cfg'); 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`); await rcon.execute_command(server_id, `game_mode 1`);
execute_cfg_on_server(server_id, './cfg/live_casual_24.cfg'); 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`); await rcon.execute_command(server_id, `game_mode 2`);
execute_cfg_on_server(server_id, './cfg/live_wingman.cfg'); 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, `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. // Adding 1 second delay in executing warmup.cfg to make it effective after map has been changed.
setTimeout(() => { setTimeout(() => {

View File

@ -95,8 +95,8 @@
<input type="text" id="team2" name="team2" class="form-control"> <input type="text" id="team2" name="team2" class="form-control">
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="gamesel" class="form-label">Game Selection:</label> <label for="game" class="form-label">Game Selection:</label>
<select id="game_sel" name="gamesel" class="form-select"> <select id="game" name="game" class="form-select">
<option value="1">Competitive Short</option> <option value="1">Competitive Short</option>
<option value="2">Competitive Long</option> <option value="2">Competitive Long</option>
<option value="3">Casual Short</option> <option value="3">Casual Short</option>
@ -106,7 +106,7 @@
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="map" class="form-label">Map:</label> <label for="map" class="form-label">Map:</label>
<select id="selectedMap" name="map" class="form-select"> <select id="map" name="map" class="form-select">
<option value="cs_italy">cs_italy</option> <option value="cs_italy">cs_italy</option>
<option value="cs_office">cs_office</option> <option value="cs_office">cs_office</option>
<option value="de_ancient">de_ancient</option> <option value="de_ancient">de_ancient</option>