A few things to note here:
if ($2 ison $chan)
if (%me. $+ $2)
on *:text:*:#:{
if (%me. $+ $nick) msg $chan $1-