start revamp

This commit is contained in:
shoopea 2024-10-29 20:15:00 +01:00
parent 7b44b540e1
commit c96cf2e93e
13 changed files with 368 additions and 149 deletions

View File

@ -1,22 +0,0 @@
mp_ct_default_secondary ""
mp_free_armor 1
mp_freezetime 10
mp_give_player_c4 0
mp_maxmoney 0
mp_respawn_immunitytime 0
mp_respawn_on_death_ct 0
mp_respawn_on_death_t 0
mp_roundtime 1.92
mp_roundtime_defuse 1.92
mp_roundtime_hostage 1.92
mp_t_default_secondary ""
mp_round_restart_delay 3
mp_team_intro_time 0
say Knife!
say Knife!
say Knife!
say Knife!
say Knife!
say Knife!
mp_restartgame 1
mp_warmup_end

View File

@ -11,6 +11,7 @@ cash_player_killed_enemy_factor 1
cash_player_killed_hostage -1000
cash_player_killed_teammate -300
cash_player_rescued_hostage 1000
cash_team_bonus_shorthanded 0
cash_team_elimination_bomb_map 3250
cash_team_elimination_hostage_map_ct 3000
cash_team_elimination_hostage_map_t 3000
@ -18,6 +19,7 @@ cash_team_hostage_alive 0
cash_team_hostage_interaction 600
cash_team_loser_bonus 1400
cash_team_loser_bonus_consecutive_rounds 500
cash_team_loser_bonus_shorthanded 0
cash_team_planted_bomb_but_defused 800
cash_team_rescued_hostage 600
cash_team_terrorist_win_bomb 3500
@ -76,12 +78,16 @@ mp_roundtime 1.92
mp_roundtime_defuse 1.92
mp_roundtime_hostage 1.92
mp_solid_teammates 1
mp_spectators_max 20
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_team_intro_time 0
mp_team_timeout_max 4
mp_team_timeout_time 30
mp_timelimit 0
mp_weapons_allow_map_placed 1
mp_weapons_allow_zeus 1
@ -107,18 +113,5 @@ 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
tv_relayvoice 1

View File

@ -11,6 +11,7 @@ cash_player_killed_enemy_factor 1
cash_player_killed_hostage -1000
cash_player_killed_teammate -300
cash_player_rescued_hostage 1000
cash_team_bonus_shorthanded 0
cash_team_elimination_bomb_map 3250
cash_team_elimination_hostage_map_ct 3000
cash_team_elimination_hostage_map_t 3000
@ -18,6 +19,7 @@ cash_team_hostage_alive 0
cash_team_hostage_interaction 600
cash_team_loser_bonus 1400
cash_team_loser_bonus_consecutive_rounds 500
cash_team_loser_bonus_shorthanded 0
cash_team_planted_bomb_but_defused 800
cash_team_rescued_hostage 600
cash_team_terrorist_win_bomb 3500
@ -76,12 +78,16 @@ mp_roundtime 1.92
mp_roundtime_defuse 1.92
mp_roundtime_hostage 1.92
mp_solid_teammates 1
mp_spectators_max 20
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_team_intro_time 0
mp_team_timeout_max 4
mp_team_timeout_time 30
mp_timelimit 0
mp_weapons_allow_map_placed 1
mp_weapons_allow_zeus 1
@ -107,18 +113,5 @@ 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
tv_relayvoice 1

117
cfg/live_competitive_16.cfg Normal file
View File

@ -0,0 +1,117 @@
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_bonus_shorthanded 0
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_loser_bonus_shorthanded 0
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_spectators_max 20
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_team_intro_time 0
mp_team_timeout_max 4
mp_team_timeout_time 30
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
sv_vote_command_delay 0
tv_relayvoice 1

117
cfg/live_competitive_24.cfg Normal file
View File

@ -0,0 +1,117 @@
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_bonus_shorthanded 0
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_loser_bonus_shorthanded 0
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 24
mp_molotovusedelay 0
mp_overtime_enable 1
mp_overtime_halftime_pausetimer 0
mp_overtime_maxrounds 6
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_spectators_max 20
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_team_intro_time 0
mp_team_timeout_max 4
mp_team_timeout_time 30
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
sv_vote_command_delay 0
tv_relayvoice 1

6
cfg/live_restart.cfg Normal file
View File

@ -0,0 +1,6 @@
say Match is live!
say Match is live!
say Match is live!
mp_restartgame 3
mp_warmup_end

View File

@ -109,6 +109,3 @@ sv_talk_enemy_dead 0
sv_talk_enemy_living 0
sv_voiceenable 1
tv_relayvoice 0
say Match is live!
say Match is live!
say Match is live!

46
cfg/warmup_16.cfg Normal file
View File

@ -0,0 +1,46 @@
bot_kick
bot_quota 0
mp_autokick 0
mp_autoteambalance 0
mp_buy_anywhere 0
mp_buytime 15
mp_death_drop_gun 0
mp_free_armor 0
mp_ignore_round_win_conditions 0
mp_limitteams 0
mp_radar_showall 0
mp_respawn_on_death_ct 0
mp_respawn_on_death_t 0
mp_solid_teammates 0
mp_spectators_max 20
mp_maxmoney 16000
mp_startmoney 16000
mp_timelimit 0
sv_alltalk 0
sv_auto_full_alltalk_during_warmup_half_end 0
sv_coaching_enabled 1
sv_competitive_official_5v5 1
sv_deadtalk 1
sv_full_alltalk 0
sv_grenade_trajectory 0
sv_hibernate_when_empty 0
mp_weapons_allow_typecount -1
sv_infinite_ammo 0
sv_showimpacts 0
sv_voiceenable 1
sm_cvar sv_mute_players_with_social_penalties 0
sv_mute_players_with_social_penalties 0
tv_relayvoice 1
sv_cheats 0
mp_ct_default_melee weapon_knife
mp_ct_default_secondary weapon_hkp2000
mp_ct_default_primary ""
mp_t_default_melee weapon_knife
mp_t_default_secondary weapon_glock
mp_t_default_primary
mp_maxrounds 16
mp_warmup_start
mp_warmup_pausetimer 1
mp_warmuptime 9999
cash_team_bonus_shorthanded 0
cash_team_loser_bonus_shorthanded 0

View File

@ -44,6 +44,3 @@ mp_warmup_pausetimer 1
mp_warmuptime 9999
cash_team_bonus_shorthanded 0
cash_team_loser_bonus_shorthanded 0
say Warmup!
say Warmup!
say Warmup!

4
cfg/warmup_restart.cfg Normal file
View File

@ -0,0 +1,4 @@
mp_restartgame 1
say Warmup!
say Warmup!
say Warmup!

View File

@ -154,12 +154,6 @@ $(document).ready(function () {
}
});
$('#knife_start').on('click', function () {
if (confirm("Are you sure you want to start the knife round?")) {
send_post_request('/api/start-knife');
}
});
$('#swap_team').on('click', function () {
if (confirm("Are you sure you want to swap teams?")) {
send_post_request('/api/swap-team');

View File

@ -14,28 +14,32 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => {
const team1 = req.body.team1;
const team2 = req.body.team2;
const selected_map = req.body.selectedMap;
const game_mode = req.body.game_mode.toString();
// rcon.rcons[server_id].execute(`mp_teamname_1 "${team1}"`);
// rcon.rcons[server_id].execute(`mp_teamname_2 "${team2}"`);
// rcon.rcons[server_id].execute(`game_mode ${game_mode}`);
const game_sel = req.body.game_mode.toString();
if (team1.trim() != "") {
await rcon.execute_command(server_id, `mp_teamname_1 "${team1}"`);
}
if (team2.trim() != "") {
await rcon.execute_command(server_id, `mp_teamname_2 "${team2}"`);
}
if (game_mode == "1") {
if (game_sel == "1") {
await rcon.execute_command(server_id, `game_mode 1`);
execute_cfg_on_server(server_id, './cfg/live16.cfg');
} else if (game_mode == "2") {
execute_cfg_on_server(server_id, './cfg/live_competitive_16.cfg');
} else if (game_sel == "2") {
await rcon.execute_command(server_id, `game_mode 1`);
execute_cfg_on_server(server_id, './cfg/live24.cfg');
} else if (game_mode == "3") {
execute_cfg_on_server(server_id, './cfg/live_competitive_24.cfg');
} else if (game_sel == "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") {
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") {
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`);
// rcon.rcons[server_id].execute(`changelevel ${selected_map}`);
await rcon.execute_command(server_id, `mp_warmup_pausetimer 1`);
await rcon.execute_command(server_id, `changelevel ${selected_map}`);
@ -44,7 +48,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' });
@ -54,9 +58,8 @@ router.post('/api/setup-game', is_authenticated, async (req, res) => {
router.post('/api/restart', is_authenticated, async (req, res) => {
try {
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' });
@ -66,27 +69,10 @@ router.post('/api/restart', is_authenticated, async (req, res) => {
router.post('/api/start-warmup', is_authenticated, async (req, res) => {
try {
const server_id = req.body.server_id;
// rcon.rcons[server_id].execute('mp_restartgame 1');
await rcon.execute_command(server_id, `mp_restartgame 1`);
execute_cfg_on_server(server_id, './cfg/warmup.cfg');
execute_cfg_on_server(server_id, './cfg/warmup_restart.cfg');
//return res.status(200).json({ message: 'Warmup started!' });
} catch (error) {
console.log(error);
res.status(500).json({ error: 'Internal server error' });
}
});
router.post('/api/start-knife', is_authenticated, async (req, res) => {
try {
const server_id = req.body.server_id;
// rcon.rcons[server_id].execute('mp_warmup_end');
// rcon.rcons[server_id].execute('mp_restartgame 1');
await rcon.execute_command(server_id, `mp_warmup_end`);
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: 'Warmup started!' });
} catch (error) {
console.log(error);
res.status(500).json({ error: 'Internal server error' });
@ -96,9 +82,8 @@ router.post('/api/start-knife', is_authenticated, async (req, res) => {
router.post('/api/swap-team', is_authenticated, async (req, res) => {
try {
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' });
}
@ -107,25 +92,36 @@ router.post('/api/swap-team', is_authenticated, async (req, res) => {
router.post('/api/go-live', is_authenticated, async (req, res) => {
try {
const server_id = req.body.server_id;
// rcon.rcons[server_id].execute('mp_warmup_end');
await rcon.execute_command(server_id, `mp_warmup_end`);
// const response = await rcon.rcons[server_id].execute('game_mode');
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');
response = await rcon.execute_command(server_id, `game_type`);
const game_type = response.split("=")[1].trim().toString();
response = await rcon.execute_command(server_id, `mp_maxrounds`);
const maxrounds = response.split("=")[1].trim().toString();
if (game_mode == "1" && maxrounds == "16") {
console.log("Executing live_competitive_16.cfg")
execute_cfg_on_server(server_id, './cfg/live_competitive_16.cfg');
} else if (game_mode == "1" && maxrounds == "24") {
console.log("Executing live_competitive_24.cfg")
execute_cfg_on_server(server_id, './cfg/live_competitive_24.cfg');
} else if (game_mode == "0" && maxrounds == "16") {
console.log("Executing live_casual_16.cfg")
execute_cfg_on_server(server_id, './cfg/live_casual_16.cfg');
} else if (game_mode == "0" && maxrounds == "24") {
console.log("Executing live_casual_24.cfg")
execute_cfg_on_server(server_id, './cfg/live_casual_24.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!!' });
execute_cfg_on_server(server_id, './cfg/live_restart.cfg');
return res.status(200).json({ message: 'Match is live!!' });
} catch (error) {
console.log(error);
res.status(500).json({ error: 'Internal server error' });
@ -136,10 +132,9 @@ router.post('/api/go-live', is_authenticated, async (req, res) => {
router.post('/api/list-backups', is_authenticated, async (req, res) => {
try {
const server_id = req.body.server_id;
// 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' });
@ -155,11 +150,9 @@ router.post('/api/restore-round', is_authenticated, async (req, res) => {
round_number = "0" + round_number;
}
console.log(`SENDING mp_backup_restore_load_file backup_round${round_number}.txt`)
// rcon.rcons[server_id].execute(`mp_backup_restore_load_file backup_round${round_number}.txt`);
// 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' });
}
@ -168,17 +161,14 @@ router.post('/api/restore-round', is_authenticated, async (req, res) => {
router.post('/api/restore-latest-backup', is_authenticated, async (req, res) => {
try {
const server_id = req.body.server_id;
// const response = await rcon.rcons[server_id].execute('mp_backup_round_file_last');
const response = await rcon.execute_command(server_id, `mp_backup_round_file_last`);
const last_round_file = response.split("=")[1].trim().toString();
if (last_round_file.includes('.txt')) {
// rcon.rcons[server_id].execute(`mp_backup_restore_load_file ${last_round_file}`);
// 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) {
@ -191,9 +181,8 @@ router.post('/api/restore-latest-backup', is_authenticated, async (req, res) =>
router.post('/api/pause', is_authenticated, async (req, res) => {
try {
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' });
}
@ -203,9 +192,8 @@ router.post('/api/pause', is_authenticated, async (req, res) => {
router.post('/api/unpause', is_authenticated, async (req, res) => {
try {
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 +207,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 +222,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' });
}
@ -310,7 +298,6 @@ async function execute_cfg_on_server(server_id, cfg_path) {
try {
if (item < exported_lines.length) {
console.log("Executing on server:", exported_lines[item]);
// rcon.rcons[server_id].execute(exported_lines[item]);
await rcon.execute_command(server_id, exported_lines[item]);
// Wait for 100ms before moving to the next iteration

View File

@ -94,7 +94,16 @@
<label for="team2" class="form-label">Team 2:</label>
<input type="text" id="team2" name="team2" class="form-control">
</div>
<div class="mb-3">
<label for="gamesel" class="form-label">Game Selection:</label>
<select id="game_sel" name="gamesel" class="form-select">
<option value="1">Competitive Short</option>
<option value="2">Competitive Long</option>
<option value="3">Casual Short</option>
<option value="4">Casual Long</option>
<option value="5">Wingman</option>
</select>
</div>
<div class="mb-3">
<label for="map" class="form-label">Map:</label>
<select id="selectedMap" name="map" class="form-select">
@ -114,14 +123,6 @@
<option value="de_vertigo">de_vertigo</option>
</select>
</div>
<div class="mb-3">
<label for="gamemode" class="form-label">Gamemode:</label>
<select id="game_mode" name="gamemode" class="form-select">
<option value="1">Competitive Short</option>
<option value="2">Competitive Long</option>
<option value="3">Wingman</option>
</select>
</div>
<div class="mb-3">
<button type="submit" name="action" value="pause" class="btn btn-primary">
<svg viewBox="0 0 1024 1024" width="20" height="20" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg" fill="#ffffff"
@ -212,17 +213,6 @@
<path d="M11.742 8.47 5.975 12.764a.5.5 0 0 1-.31.108H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h1.665a.5.5 0 0 1 .31.108l5.767 4.294a.5.5 0 0 1 0 .816z"/>
</svg> Start Warmup
</button>
<button type="submit" id="knife_start" name="action" class="btn btn-success">
<svg height="16" width="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
<g id="SVGRepo_iconCarrier">
<path
d="M14.7245 11.2754L16 12.4999L10.0129 17.8218C8.05054 19.5661 5.60528 20.6743 3 20.9999L3.79443 19.5435C4.6198 18.0303 5.03249 17.2737 5.50651 16.5582C5.92771 15.9224 6.38492 15.3113 6.87592 14.7278C7.42848 14.071 8.0378 13.4615 9.25644 12.2426L12 9.49822M11.5 8.99787L17.4497 3.04989C18.0698 2.42996 19.0281 2.3017 19.7894 2.73674C20.9027 3.37291 21.1064 4.89355 20.1997 5.80024L19.8415 6.15847C19.6228 6.3771 19.3263 6.49992 19.0171 6.49992H18L16 8.49992V8.67444C16 9.16362 16 9.40821 15.9447 9.63839C15.8957 9.84246 15.8149 10.0375 15.7053 10.2165C15.5816 10.4183 15.4086 10.5913 15.0627 10.9372L14.2501 11.7498L11.5 8.99787Z"
stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</g>
</svg> Start Knife Round
</button>
<button type="submit" id="swap_team" name="action" class="btn btn-success">
<svg viewBox="0 0 24 24" fill="none" width="16" height="16" xmlns="http://www.w3.org/2000/svg" stroke="#ffffff">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>