Your statement of
I want to exempt op and voice from bad text or bad words.
implies that you already have code to handle the bad text or bad words. The code I gave you simply has a single remarked line to indicate where that code would go.
If you don't have a code to handle bad text/words, then I suggest looking on some of the other scripting sites for one, as they have been done a fair bit.
Some scripting sites you might want to try are Hawkee
, mIRC Scripts