spectator mode?

is there a command in lua for when someone joins the server it puts them in spectator mode untill they choose a team?