$execute unless entity @e[tag=map_lobby,scores={map_id=$(map_id)},tag=in_game] run return run tellraw @s {"text":"There is no active game on map $(map_id)","color":"red"}
$scoreboard players set @e[type=marker,tag=map_lobby,scores={map_id=$(map_id)}] countdown -1
$tellraw @a {"text":"Stopped game$(map_id)","color":"dark_red"}
$function pctf:logic/game/clear_objects {map_id: "$(map_id)"}
scoreboard players set .game_in_progress lobby 0
team join lobby @a
tag @a remove playing
tag @a remove end_game
gamemode adventure @a
clear @a
execute as @a run function pctf:tp/lobby

$tag @e[tag=map_lobby,scores={map_id=$(map_id)},tag=in_game] remove in_game