How would I randomly pick one alive person on a server, and place on the Terrorist team, and place all the others on the Counter Terrorist Team.
Again, thanks
Scripts
Pick a player at random
Pick a player at random
function RandomPlayer()
	local t = {}
	for _, id in pairs(player(0,"table")) do
		if player(id,"team") > 0 then
			table.insert(t,id)
		end
	end
	if #t > 0 then
		return t[math.random(1,#t)]
	end
	return nil
end
function SetTeams()
	local p = RandomPlayer()
	if p == nil then return nil end
	if player(p,"team") ~= 1 then parse("maket "..p) end
	for _, id in pairs(player(0,"table")) do
		if player(id,"team") > 0 and id ~= p then
			parse("makect "..id)
		end
	end
end
countDown = 10
addhook("startround","onStart")
function onStart()
	countDown = 10
end
addhook("second","onSec")
function onSec()
	if countDown > 0 then
		countDown = countDown - 1
		msg(countDown.."@C")
	elseif countDown == 0 then
		countDown = -1
		SetTeams()
	end
end
function RandomPlayer()
	local t = {}
	for _, id in pairs(player(0,"table")) do
		if player(id,"team") > 0 then
			table.insert(t,id)
		end
	end
	if #t > 0 then
		return t[math.random(1,#t)]
	end
	return nil
end
function SetTeams()
	local p = RandomPlayer()
	if p == nil then return nil end
	if player(p,"team") ~= 1 then
		local TEnts = {}
		for x = 0, map("xsize")+1 do
			for y = 0, map("ysize")+1 do
				if entity(x,y,"exists") then
					if string.lower(entity(x,y,"typename") )== "info_t" then
						table.insert(TEnts,{x = x,y = y})
					end
				end
			end
		end
		parse("maket "..p)
		if #TEnts > 0 then
			local randEnt = TEnts[math.random(1,#TEnts)]
			parse("spawnplayer "..p.." "..((randEnt.x*32)+16).." "..(randEnt.y*32)+16)
		end
	end
	
	local ctEnts = {}
	for x = 0, map("xsize")+1 do
		for y = 0, map("ysize")+1 do
			if entity(x,y,"exists") then
				if string.lower(entity(x,y,"typename") )== "info_ct" then
					table.insert(ctEnts,{x = x,y = y})
				end
			end
		end
	end
	for _, id in pairs(player(0,"table")) do
		if player(id,"team") > 0 and id ~= p and player(id,"team") ~= 2 then
			parse("makect "..id)
			if #ctEnts > 0 then
				local randEnt = ctEnts[math.random(1,#ctEnts)]
				parse("spawnplayer "..id.." "..((randEnt.x*32)+16).." "..(randEnt.y*32)+16)
			end
		end
	end
end
countDown = 10
addhook("startround","onStart")
function onStart()
	countDown = 10
end
addhook("second","onSec")
function onSec()
	if countDown > 0 then
		countDown = countDown - 1
		msg(countDown.."@C")
	elseif countDown == 0 then
		countDown = -1
		SetTeams()
	end
end
Thanks, it seems to work. I'll surely credit you! 