Froggie, why not use the on action regex instead:
on $*:ACTION:$(/\bslaps\b.*\b\Q $+ $replace($me,\E,\E\\E\Q) $+ \E\b/iS):#:{
msg $chan DON'T SLAP ME!
}
You save yourself an if statement and a local variable. A trigger flood control may be put into consideration so the client that runs the code doesn't get scrolled.