mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2005
Posts: 194
A
Vogon poet
OP Offline
Vogon poet
A
Joined: Feb 2005
Posts: 194
Code:
on @*:TEXT:*:#: { 
  if ($nick isop #) return 
  if ($read(protect2.txt,w,$+(,$nick))) { return }
  if ($read(profanity.txt,w, $strip($1-))) {
    set -u1800 %rlpro. [ $+ [ $address($nick,2) ] ] $calc( %rlpro. [ $+ [ $address($nick,2) ] ] + 1)
    if (%rlpro. [ $+ [ $address($nick,2) ] ] == 1) /msg # Please Don't Use Any Profanity $nick - First Warning! 
    if (%rlpro. [ $+ [ $address($nick,2) ] ] == 2) /msg # Second and Last Warning $nick - Next Time you will be Kicked! 
    if (%rlpro. [ $+ [ $address($nick,2) ] ] >= 3) {
      ban -u600 $chan $address | /kick # $nick You Were Warned About Using Profanity! (10 Minute Ban)
    }
  }
}

Hey. I have this for my profanity kick. How can I add wildcards so that saying: blah #%$^ blah, blah *&^$, &*^$*% blah, and blah%$%blah will trigger it also?


"God sometimes puts us in the dark for us to see the light"
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Hmm, couldn't you do something like...
Code:
if ($wildtok($1-,$+(*,$read(profanity.txt,w,$1-),*),1,32)) { do something }

Joined: Feb 2005
Posts: 194
A
Vogon poet
OP Offline
Vogon poet
A
Joined: Feb 2005
Posts: 194
Excelent Thanks. I knew there had to be an easy way to do this. Afterall, what good is a swear kick if it's only triggered by that word by itself on one line. !Thanks!


"God sometimes puts us in the dark for us to see the light"
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You're welcome.

Joined: Feb 2005
Posts: 194
A
Vogon poet
OP Offline
Vogon poet
A
Joined: Feb 2005
Posts: 194
Hey. I just noticed this. With the following code, anyone who is NOT op is kicked for saying ANY word. I had a visitor come in who was not an op, they said hello, and it gave them the first warning. Obiously "hello" nor any other non-swear words are in the profanity.txt file. Im confused. I'm sure it's a stupid screw-up by me, which I have found is not uncommon. Would someone please tell me what the heck is going on? Also, if you see an easy way to clean up this code and make it more efficiant please let me know. Thanks.
Code:
 on @*:TEXT:*:#: { 
  if ($nick isop #) return 
  if ($read(protect2.txt,w,$+(,$nick))) { return }
  if ($wildtok($1-,$+(*,$read(profanity.txt,w,$1-),*),1,32)) {
    set -u1800 %rlpro. [ $+ [ $address($nick,2) ] ] $calc( %rlpro. [ $+ [ $address($nick,2) ] ] + 1)
    if (%rlpro. [ $+ [ $address($nick,2) ] ] == 1) /msg # Please Don't Use Any Profanity $nick - First Warning! 
    if (%rlpro. [ $+ [ $address($nick,2) ] ] == 2) /msg # Second and Last Warning $nick - Next Time you will be Kicked! 
    if (%rlpro. [ $+ [ $address($nick,2) ] ] >= 3) {
      ban -u600 $chan $address | /kick # $nick You Were Warned About Using Profanity! (10 Minute Ban)
    }
  }
} 


"God sometimes puts us in the dark for us to see the light"
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Of course, because $+(*,$read(profanity.txt,w,$1-),*) will be "**" if there isn't a result from the $read(), and
$wildtok($1-,**,1,32) is going to be the first word. :tongue:

You could use $$read(), but profanity.txt would need a line containing the whole of $1-.

Better off making it use a hash table, like here. Just modify the on open and on text events to suit.

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
BTW:
Code:
  if ($read(protect2.txt,w,$+(,$nick))) { return }

^^ You could use mIRCs protect feature
  • /protect [-rw] <on|off|nick> [#channel1,#channel2,...] [type] [network]
    e.g. /protect fred101!*@*.host.com #chanel5 Netwrok

Code:
  if $protect($nick) { return }
  ; ^ for any matching protect entry
  if $nick isprotect # { return }
  ; ^ for channel specific protect entry


Combine the first two lines
Code:
  if ($nick isop # || $protect($nick)) { return }
  if ($nick isop # || $nick isprotect #) { return }


Link Copied to Clipboard