mIRC Home    About    Download    Register    News    Help

Print Thread
#260653 30/05/17 05:57 PM
Joined: Sep 2015
Posts: 33
D
Deerayn Offline OP
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Sep 2015
Posts: 33
So I try to redo blacklist word script I got a problem with third part ( check blocked words ) now its a mess.. laugh

Code:
on *:TEXT:!blacklist add*:#: {
  if ($nick == deerayn_) {
    write blacklist.txt $3
    msg # $3 Has been added to my blacklist, anyone using $3 will be timed out for 10 minutes.
  }
  else {
    msg # Sorry $nick $+ , you do not have permission to add words to the blacklist
  }
}
on *:TEXT:!blacklist del*:#: {
  if ($nick == deerayn_) {
    if ($read(blacklist.txt,w,$3 )) {
      write $+(-dl,$readn) blacklist.txt
      msg # $3 Has been removed from the blacklist
    }
    else {
      msg # Sorry $nick $+ , you do not have permission to remove words from my blacklist
    }
  }
}
on *:TEXT:*:#: {
  if ($nick == isop #) return
  if ($read(blacklist.txt, n, $1-))
  msg # $nick --> Do not use Blacklisted Words. (Timeout)
  msg # .timeout $nick 600
}

Last edited by Deerayn; 30/05/17 05:59 PM.
Deerayn #260654 31/05/17 07:31 AM
Joined: Jan 2005
Posts: 192
Vogon poet
Offline
Vogon poet
Joined: Jan 2005
Posts: 192
if ($nick == isop #) return

isop is operator just like == (equal to)
Your expression reads: If nick is equal to is operator on channel.
Should be if (v1 operator v2) you have if (v1 operator operator v2)
Should be: If nick is operator on channel.
So you use: if ($nick isop #) return

if ($read(blacklist.txt, n, $1-))
This will always return the first line of blacklist.txt
You would need s switch as well.
This approach however will work only if people talk in single words and not sentences.

Also your conditional block is not formatted right.
IF (condition) {
commands
}

Code:
on *:TEXT:*:#: {
  if ($nick isop #) return
  var %i = 1
  while (%i <= $lines(blacklist.txt)) {
    if ($read(blacklist.txt, %i) isin $1-) {
      msg # $nick --> Do not use Blacklisted Words. (Timeout)
      msg # .timeout $nick 600
      halt
    }
    inc %i
  }
}


-
Just a sidenote. Im sure some people would probably disagree with me or at least fight over right and wrong but personally I would try to avoid reading a file from disk every time someone says something on a channel.
-


echo -a $signature
Brax #260656 31/05/17 03:14 PM
Joined: Sep 2015
Posts: 33
D
Deerayn Offline OP
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Sep 2015
Posts: 33
($nick == isop #) I forgot to change it back for this part, I had my name here :p

And script is working I think, Thanks for help.


Link Copied to Clipboard