How to limit an item per tribe

Hello, doing a mod with a safezone emitter, and already managed to limit the number a player / tribe can have.

but if ppl join an other tribe or merge tribes, they can exceed these limit.

i think there are 3 ways to prevent it

  1. prevent joining / merging tribes when you have already placed safezones - maybe disable option in radial menu (but cant find this)
  2. deactivating and prevent activating when to many (maybe simillar to turrets but for structures per tribe instead of structures in range?)
  3. destroy all safezones of both tribes when joining / merging tribes (how to do this ?)

only did all in shieldemitter_storagebox till now…

sadly cant get this to work… really would like to implement 1., but cant find a way to do it.

could anyone please tell me how to do it or the other 2 ways ?