I dont understand your system. Where do you set/clear the switch and where CCs are counted?
You can use looping system to loop through all CCs and giving minerals for each of them. If there was only one player you could have used such triggers:
Trigger 1:
Owners:
Player 1.
Conditions:
Current Player brings At Least 1 Command Center to Anywhere.
Actions:
Give 1 Command Center owned by Current Player at Anywhere to Player 9. (for example)
Add 1 Mineral for Current Player.
Preserve Trigger.
Trigger 2:
Owners:
Player 1.
Conditions:
Current Player brings Exactly 0 Command Center to Anywhere.
Actions:
Wait for 500 milliseconds. (if you like a delay)
Give All Command Center owned by Player 9 at Anywhere to Current Player.
Preserve Trigger.
That way all CCs one by one would be given to Player 9 and when it happens there would be a delay and the next loop will come.
There are two problems with this method. The first, is that your command centers are given to another player and you cant select them till the loop ends. The second is that if there are several players all their CCs would shuffle in Player 9 hands

The best solution is to create invincible burrowed zerg units for unused players exactly under CCs (of course create at other place and then move em there) and give them to other unused player when circling through them (for example you can use P9 and P10), as I did with CCs. That way the CC indentifies the Owner and the burrowed unit identifies whether the CC was counted (when it controlled by one player, for ex. P9) or not (when it controlled by one player, for ex. P10).
If burrowed units are too complicated you can just have loops of reward executed one after another for each player and then CCs wont shuffle.
You can check the tutorials if you dont understand. There must be an article about looping through buildings. I dont remember how it is called. Mabe
this can help.