It's a lot of work, the code is 1500 lines long.
Anyway, here's a very basic duel system I threw together that allows for 1v1 duels and could be expanded to allow for team duels and other stuff like that. It's really just to give you an idea of how you could create this yourself. Type -duel # (player number, 1->24) to challenge someone to a 1v1. They need to type -duel # using your number for the duel to start. Only one duel can occur at a time. A duel ends when a hero dies. You can cancel a duel request by typing -cancel.