$execute as @n[type=marker,tag=map_lobby,tag=not_active,tag=!finished,scores={map_id=$(y)..}] at @s run return run function pctf:mode/z_map_maker/next_map/found
execute if score .not_finished_maps lobby matches 3.. run return run tellraw @s {"text":"There are already 3 unfinished maps! Complete these before making more!","color":"red"}
$tag @n[type=marker,tag=map_lobby,tag=not_active,tag=!finished,scores={map_id=$(w)..}] add ignore_me

execute store result score .map_num temp run scoreboard players get @s map_maker_id
scoreboard players add .map_num temp 1

scoreboard players set .result temp 1000

execute store result storage pctf:map_location input.map_id int 1 run scoreboard players get @s map_maker_id
execute store result storage pctf:map_location input.xz int 1 run scoreboard players operation .result temp *= .map_num temp

$tp @s @n[type=marker,tag=map_lobby,tag=not_active,tag=!finished,scores={map_id=$(w)..}]
$execute at @n[type=marker,tag=map_lobby,tag=not_active,tag=!finished,scores={map_id=$(w)..}] run function pctf:mode/z_map_maker/tp_loop

tag @e[tag=ignore_me] remove ignore_me