If an op were to do something like this:
/mode #chan +m-mi
your script would be fooled into triggering.
I'd use a simpler and safer method of detecting mode changes, $chan().mode:
on @!*:mode:#test: if *m* *m* iswmcs $1 $gettok($chan(#).mode,1,32) { mode # -m }