diff --git a/cfg/live24.cfg b/cfg/live.cfg similarity index 100% rename from cfg/live24.cfg rename to cfg/live.cfg diff --git a/cfg/live16.cfg b/cfg/live16.cfg deleted file mode 100644 index 8a01836..0000000 --- a/cfg/live16.cfg +++ /dev/null @@ -1,124 +0,0 @@ -ammo_grenade_limit_default 1 -ammo_grenade_limit_flashbang 2 -ammo_grenade_limit_total 4 -bot_quota 0 -cash_player_bomb_defused 300 -cash_player_bomb_planted 300 -cash_player_damage_hostage -30 -cash_player_interact_with_hostage 300 -cash_player_killed_enemy_default 300 -cash_player_killed_enemy_factor 1 -cash_player_killed_hostage -1000 -cash_player_killed_teammate -300 -cash_player_rescued_hostage 1000 -cash_team_elimination_bomb_map 3250 -cash_team_elimination_hostage_map_ct 3000 -cash_team_elimination_hostage_map_t 3000 -cash_team_hostage_alive 0 -cash_team_hostage_interaction 600 -cash_team_loser_bonus 1400 -cash_team_loser_bonus_consecutive_rounds 500 -cash_team_planted_bomb_but_defused 800 -cash_team_rescued_hostage 600 -cash_team_terrorist_win_bomb 3500 -cash_team_win_by_defusing_bomb 3500 -cash_team_win_by_hostage_rescue 2900 -cash_team_win_by_time_running_out_bomb 3250 -cash_team_win_by_time_running_out_hostage 3250 -ff_damage_reduction_bullets 0.33 -ff_damage_reduction_grenade 0.85 -ff_damage_reduction_grenade_self 1 -ff_damage_reduction_other 0.4 -mp_afterroundmoney 0 -mp_autokick 0 -mp_autoteambalance 0 -mp_backup_restore_load_autopause 1 -mp_backup_round_auto 1 -mp_buy_anywhere 0 -mp_buy_during_immunity 0 -mp_buytime 20 -mp_c4timer 40 -mp_ct_default_melee weapon_knife -mp_ct_default_primary "" -mp_ct_default_secondary weapon_hkp2000 -mp_death_drop_defuser 1 -mp_death_drop_grenade 2 -mp_death_drop_gun 1 -mp_defuser_allocation 0 -mp_display_kill_assists 1 -mp_endmatch_votenextmap 0 -mp_forcecamera 1 -mp_free_armor 0 -mp_freezetime 18 -mp_friendlyfire 1 -mp_give_player_c4 1 -mp_halftime 1 -mp_halftime_duration 15 -mp_halftime_pausetimer 0 -mp_ignore_round_win_conditions 0 -mp_limitteams 0 -mp_match_can_clinch 1 -mp_match_end_restart 0 -mp_maxmoney 16000 -mp_maxrounds 16 -mp_molotovusedelay 0 -mp_overtime_enable 1 -mp_overtime_halftime_pausetimer 0 -mp_overtime_maxrounds 4 -mp_overtime_startmoney 10000 -mp_playercashawards 1 -mp_randomspawn 0 -mp_respawn_immunitytime 0 -mp_respawn_on_death_ct 0 -mp_respawn_on_death_t 0 -mp_round_restart_delay 5 -mp_roundtime 1.92 -mp_roundtime_defuse 1.92 -mp_roundtime_hostage 1.92 -mp_solid_teammates 1 -mp_starting_losses 1 -mp_startmoney 800 -mp_t_default_melee weapon_knife -mp_t_default_primary "" -mp_t_default_secondary weapon_glock -mp_teamcashawards 1 -mp_timelimit 0 -mp_weapons_allow_map_placed 1 -mp_weapons_allow_zeus 1 -mp_weapons_glow_on_ground 0 -mp_win_panel_display_time 3 -occlusion_test_async 0 -spec_freeze_deathanim_time 0 -spec_freeze_panel_extended_time 0 -spec_freeze_time 2 -spec_freeze_time_lock 2 -spec_replay_enable 0 -sv_allow_votes 1 -sv_auto_full_alltalk_during_warmup_half_end 0 -sv_coaching_enabled 1 -sv_competitive_official_5v5 1 -sv_damage_print_enable 0 -sv_deadtalk 1 -sv_hibernate_postgame_delay 300 -sv_holiday_mode 0 -sv_ignoregrenaderadio 0 -sv_infinite_ammo 0 -sv_occlude_players 1 -sv_talk_enemy_dead 0 -sv_talk_enemy_living 0 -sv_voiceenable 1 -tv_relayvoice 1 -mp_team_timeout_max 4 -mp_team_timeout_time 30 -sv_vote_command_delay 0 -cash_team_bonus_shorthanded 0 -cash_team_loser_bonus_shorthanded 0 -mp_spectators_max 20 -mp_team_intro_time 0 -say Match is live! -say Match is live! -say Match is live! -say use call timeout for TAC and type Tech ( Admin will pause the game ) -say use call timeout for TAC and type Tech ( Admin will pause the game ) -mp_restartgame 3 -mp_warmup_end \ No newline at end of file diff --git a/routes/game.js b/routes/game.js index f5b4ded..db7236f 100644 --- a/routes/game.js +++ b/routes/game.js @@ -24,14 +24,10 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => { if (team2.trim() != "") { await rcon.execute_command(server_id, `mp_teamname_2 "${team2}"`); } + await rcon.execute_command(server_id, `game_mode ${game_mode}`); if (game_mode == "1") { - await rcon.execute_command(server_id, `game_mode 1`); - execute_cfg_on_server(server_id, './cfg/live16.cfg'); + execute_cfg_on_server(server_id, './cfg/live.cfg'); } else if (game_mode == "2") { - await rcon.execute_command(server_id, `game_mode 1`); - execute_cfg_on_server(server_id, './cfg/live24.cfg'); - } else if (game_mode == "3") { - await rcon.execute_command(server_id, `game_mode 2`); execute_cfg_on_server(server_id, './cfg/live_wingman.cfg'); } // rcon.rcons[server_id].execute(`mp_warmup_pausetimer 1`); @@ -44,7 +40,7 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => { execute_cfg_on_server(server_id, './cfg/warmup.cfg'); }, 1000) - //return res.status(200).json({ message: 'Game Created!' }); + return res.status(200).json({ message: 'Game Created!' }); } catch (error) { console.log(error); res.status(500).json({ error: 'Internal server error' }); @@ -56,7 +52,7 @@ router.post('/api/restart', is_authenticated, async (req, res) => { const server_id = req.body.server_id; // rcon.rcons[server_id].execute('mp_restartgame 1'); await rcon.execute_command(server_id, `mp_restartgame 1`); - //return res.status(200).json({ message: 'Game restarted' }); + return res.status(200).json({ message: 'Game restarted' }); } catch (error) { console.log(error); res.status(500).json({ error: 'Internal server error' }); @@ -70,7 +66,7 @@ router.post('/api/start-warmup', is_authenticated, async (req, res) => { await rcon.execute_command(server_id, `mp_restartgame 1`); execute_cfg_on_server(server_id, './cfg/warmup.cfg'); - //return res.status(200).json({ message: 'Warmup started!' }); + return res.status(200).json({ message: 'Warmup started!' }); } catch (error) { console.log(error); res.status(500).json({ error: 'Internal server error' }); @@ -86,7 +82,7 @@ router.post('/api/start-knife', is_authenticated, async (req, res) => { await rcon.execute_command(server_id, `mp_restartgame 1`); execute_cfg_on_server(server_id, './cfg/knife.cfg'); - //return res.status(200).json({ message: 'Knife started!' }); + return res.status(200).json({ message: 'Knife started!' }); } catch (error) { console.log(error); res.status(500).json({ error: 'Internal server error' }); @@ -98,7 +94,7 @@ router.post('/api/swap-team', is_authenticated, async (req, res) => { const server_id = req.body.server_id; // rcon.rcons[server_id].execute('mp_swapteams'); await rcon.execute_command(server_id, `mp_swapteams`); - //return res.status(200).json({ message: 'Teams Swapped!' }); + return res.status(200).json({ message: 'Teams Swapped!' }); } catch (error) { res.status(500).json({ error: 'Internal server error' }); } @@ -113,19 +109,16 @@ router.post('/api/go-live', is_authenticated, async (req, res) => { const response = await rcon.execute_command(server_id, `game_mode`); const game_mode = response.split("=")[1].trim().toString(); if (game_mode == "1") { - console.log("Executing live16.cfg") - execute_cfg_on_server(server_id, './cfg/live16.cfg'); + console.log("Executing live.cfg") + execute_cfg_on_server(server_id, './cfg/live.cfg'); } else if (game_mode == "2") { - console.log("Executing live24.cfg") - execute_cfg_on_server(server_id, './cfg/live24.cfg'); - } else if (game_mode == "3") { console.log("Executing live_wingman.cfg") execute_cfg_on_server(server_id, './cfg/live_wingman.cfg'); } // rcon.rcons[server_id].execute('mp_restartgame 1'); await rcon.execute_command(server_id, `mp_restartgame 1`); - //return res.status(200).json({ message: 'Match is live!!' }); + return res.status(200).json({ message: 'Match is live!!' }); } catch (error) { console.log(error); res.status(500).json({ error: 'Internal server error' }); @@ -139,7 +132,7 @@ router.post('/api/list-backups', is_authenticated, async (req, res) => { // const response = await rcon.rcons[server_id].execute('mp_backup_restore_list_files'); const response = await rcon.execute_command(server_id, "mp_backup_restore_list_files"); console.log('Server response:', response); - //return res.status(200).json({ message: response }); + return res.status(200).json({ message: response }); } catch (error) { console.log(error) res.status(500).json({ error: 'Internal server error' }); @@ -159,7 +152,7 @@ router.post('/api/restore-round', is_authenticated, async (req, res) => { // rcon.rcons[server_id].execute('mp_pause_match'); await rcon.execute_command(server_id, `mp_backup_restore_load_file backup_round${round_number}.txt`); await rcon.execute_command(server_id, `mp_pause_match`); - //return res.status(200).json({ message: 'Round Restored!' }); + return res.status(200).json({ message: 'Round Restored!' }); } catch (error) { res.status(500).json({ error: 'Internal server error' }); } @@ -176,9 +169,9 @@ router.post('/api/restore-latest-backup', is_authenticated, async (req, res) => // rcon.rcons[server_id].execute('mp_pause_match'); await rcon.execute_command(server_id, `mp_backup_restore_load_file ${last_round_file}`); await rcon.execute_command(server_id, `mp_pause_match`); - //return res.status(200).json({ message: `Latest Round Restored! (${last_round_file})` }); + return res.status(200).json({ message: `Latest Round Restored! (${last_round_file})` }); } else { - //return res.status(200).json({ message: 'No latest backup found!' }); + return res.status(200).json({ message: 'No latest backup found!' }); } } catch (error) { @@ -193,7 +186,7 @@ router.post('/api/pause', is_authenticated, async (req, res) => { const server_id = req.body.server_id; // rcon.rcons[server_id].execute('mp_pause_match'); const response = await rcon.execute_command(server_id, 'mp_pause_match'); - //return res.status(200).json({ message: 'Game paused' }); + return res.status(200).json({ message: 'Game paused' }); } catch (error) { res.status(500).json({ error: 'Internal server error' }); } @@ -205,7 +198,7 @@ router.post('/api/unpause', is_authenticated, async (req, res) => { const server_id = req.body.server_id; // rcon.rcons[server_id].execute('mp_unpause_match'); const response = await rcon.execute_command(server_id, 'mp_unpause_match'); - //return res.status(200).json({ message: 'Game unpaused' }); + return res.status(200).json({ message: 'Game unpaused' }); } catch (error) { res.status(500).json({ error: 'Internal server error' }); } @@ -219,10 +212,10 @@ router.post('/api/rcon', is_authenticated, async (req, res) => { const response = await rcon.execute_command(server_id, command); if (response == 200) { - //return res.status(200).json({ message: 'Command sent!' }); + return res.status(200).json({ message: 'Command sent!' }); } - //return res.status(200).json({ message: 'Command sent! Response received:\n' + response.toString() }); + return res.status(200).json({ message: 'Command sent! Response received:\n' + response.toString() }); } catch (error) { res.status(500).json({ error: 'Internal server error' }); } @@ -234,7 +227,7 @@ router.post('/api/say-admin', is_authenticated, async (req, res) => { const message = req.body.message; const message_to_send = "say " + message; await rcon.execute_command(server_id, message_to_send); - //return res.status(200).json({ message: 'Message sent!' }); + return res.status(200).json({ message: 'Message sent!' }); } catch (error) { res.status(500).json({ error: 'Internal server error' }); } diff --git a/views/manage.ejs b/views/manage.ejs index 201ebb8..5d23a97 100644 --- a/views/manage.ejs +++ b/views/manage.ejs @@ -117,9 +117,8 @@