Not all IRCds support the +h mode.
So maybe something like:
/mode $comchan($nick,%i) $+(+v,$iif(% isin $prefix,h $me)) $me
Without testing your code, I don't know how well it works but looking at this line:
if (r isincs $chan($chan).mode) {
$chan wouldn't have a value in the On Quit event.