If its a custom map (not melee), and scenario is like a AoS or on ORPG, just limit pop. Give a player just 5 population, and make every hero cost only 5 population. Then each player can have only 1 hero.
But if you want the player can have mercenaries, then deside witch is the max number of mercenaries. I will take 10. Then simply give each player 25 population. Make each hero cost 15 population, and each mercenary, that you can buy later, 1 population.
You can give population by giving each player a circle of power infront of taverns on witch a player buys heroes. And in same time you get a herobuyer.
If your wondering about a custom hero witch can be bought many times, you have to go to advanced options and make cpu see it as a hero not as a unit. I dont remember the path.