Create a unit array and store all heroes in it at their corrosponding index to the player who owns them. The first player in WC3 has the number 0 when passed to the native whereas in SC2 or if using the GUI parameter in WC3 it is 1.
Once a wave ends (or a wave begins)...
For every player matching the conditions that he is valid for revival (was playing at some stage or is still playing, the choice is yours)....
If the hero stored in the index of the player slot number is dead...
Revive the hero stored in the index of the player slot number ...
Additionally if players can have multiple heroes, you may wish to use a partial array to store the heroes independiently of player and just loop through them and revive the dead ones once the round ends.