I'd like for someone to write a script which swaps teams after each round. For example if the player is a CT than after round he would be T. I would use it my server, as well it would help me learn about lua more.
Thanks!
addhook("startround_prespawn", "swapteams") function swapteams(mode) 	local playerlist=player(0,"table") 	for _,id in pairs(playerlist) do 		if (player(id, "team") == 1) then 			parse("makect "..id) 		elseif (player(id, "team") == 2) then 			parse("maket "..id)			 		end 	end end
addhook("endround","_endround") function _endround(m) local playerlist=player(0,"table") for _,id in pairs(playerlist) do if player(id, "team") == 1 then parse("makect "..id) elseif player(id, "team") == 2 then parse("maket "..id) end end end
addhook("startround_prespawn", "swapteams") function swapteams(mode) 	local playerlist=player(0,"table") 	for _,id in pairs(playerlist) do 		if (player(id, "team") == 1) then 			parse("makect "..id) 		elseif (player(id, "team") == 2) then 			parse("maket "..id)			 		end 	end end
addhook("endround","_endround") function _endround(m) local playerlist=player(0,"table") 	if(m ~= 4 and m ~= 3) then 		for _,id in pairs(playerlist) do 			if player(id, "team") == 1 then 				parse("makect "..id) 			elseif player(id, "team") == 2 then 				parse("maket "..id) 			end 		end 	end end