Using things like the enfo-type thing is simple, just turn off the trigger after its used.
If you are doing something like buying it from an altar, it would like something like this.
Event - Unit - A Unit finishes training A Unit (generic unit event)
Condition - Unit Type Comparison - Unit type of (trained unit) Equal to (your unit)
Action - Turn Off (this trigger)
Turn On (Trigger below)
Same Events and conditions
Action - Remove (trained unit)
Game - Display to blahblahblah (Somebody has already trained that hero! choose another!)
(extra - Player - Add Properties(if they paid for it))