Base_teamplay already handles grabbing and capturing flags. You can do a lot just by including base_teamplay and modifying it to do what you need to do. If you look at the
documentation for info_ff_script, it has a list of callbacks, which are game events you can tap into and insert your own custom behavior.
Controlling spawn points is easy. They have a callback called
validspawn. If it returns true, a player can spawn there. You can do any kind of logic and turn a group of spawns on or off.