tellraw @s ["",{"text":"Welcome to ","color":"green"},{"text":"Phaic's Capture the Flag","bold":true,"color":"yellow"},{"text":"!","color":"green"}]

tag @s remove justJoined
tag @s add joined
tag @s remove dead

tag @s remove playing
gamemode adventure @s
clear @s

spawnpoint @s 8 ~ 8 0 ~

scoreboard players add @s invulnerable_timer 0
scoreboard players add @s credits 0

tag @s remove in_game
tag @s remove has_flag
tag @s remove has_light_purple_flag
tag @s remove has_aqua_flag
tag @s remove has_yellow_flag
tag @s remove has_green_flag

recipe take @s *

execute store result score @s real_ID run data get entity @s UUID[0]

attribute @s minecraft:fall_damage_multiplier base set 0

team join lobby
function pctf:tp/lobby

gamerule disableElytraMovementCheck true

execute if entity @s[tag=edit_mode] run function pctf:mode/z_map_maker/edit/left

scoreboard players add @s dm_num 0
scoreboard players add @s km_num 0
scoreboard players add @s at_num 0

execute if score @s dm_num matches 0 run scoreboard players set @s dm_num -1
execute if score @s km_num matches 0 run scoreboard players set @s km_num -1
execute if score @s at_num matches 0 run scoreboard players set @s at_num -1

scoreboard players add @s total_kills 0
scoreboard players add @s total_wins 0

scoreboard players operation @s lob_pre = @s credits