A fast way is moving everyone to terrorist at the end of the round and then picking random 5 people to be the CTs. You can use functions register_logevent and get_players, just search the forums on those.
Edit: The use of cs_set_user_team is still essential here.