Heh... it's those elseif's causing the problem. Change:

Code:
if ($hget(%active.chan,$1)) {
  var %hreplace = $hget(%active.chan,$1)
  if (hnick isin %hreplace) && (hchan isin %hreplace) {
    msg $chan $replace(%hreplace,hnick,$2,hchan,$chan,hname,$nick)
  }
  elseif (hnick isin %hreplace) {
    msg $chan $replace(%hreplace,hnick,$2)
  }
  elseif (hchan isin %hreplace) {
    msg $chan $replace(%hreplace,hchan,$chan)
  }
  elseif (hname isin %hreplace) {
    msg $chan $replace(%hreplace,hname,$nick)
  }
  else { msg $chan %hreplace }
}


to:

Code:
if ($hget(%active.chan,$1)) {
  var %hreplace = $replacex($hget(%active.chan,$1),hnick,$2,hchan,$chan,hname,$nick)
  msg $chan %hreplace
}


Or, get rid of the variable altogether:

Code:
if ($hget(%active.chan,$1)) {
  msg $chan $replacex($hget(%active.chan,$1),hnick,$2,hchan,$chan,hname,$nick)
}