mIRC Home    About    Download    Register    News    Help

Print Thread
#219674 25/03/10 10:44 AM
N
Nicmavr
Nicmavr
N
Hello everyone,

I've recently been trying to set up an anti-flood bot for my channel. My channel is on freenode.net and I want my bot to be able to op via ChanServ, mute the flooder and then deop again via ChanServ, in that order. Here is the script:

Code:
on *:TEXT:*:#:{
  inc -u4 %spam. [ $+ [ $nick ] ]
  if (%spam. [ $+ [ $nick ] ] == 6) {
    msg ChanServ op $chan
    mute $chan $nick
    msg ChanServ deop $chan
  }
}


For some reason, my bot isn't executing the script commands in the right order. Instead of opping first, it executes the *mute command FIRST, and THEN ops and deops. I know this because this is what I get on my bot's screen:

Code:
* AFPbot: you're not channel operator
* ChanServ sets mode: +o AFPbot
* ChanServ sets mode: -o AFPbot


And of course, I result in having a failing anti-flood bot.
Can someone please explain why it does this and how I can fix it?

Regards,

Nicmavr

Joined: Dec 2002
Posts: 1,999
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 1,999

It's because your script isn't waiting for ChanServ to op you before executing the next command. Try this.

Code:

on *:TEXT:*:#: {
  inc -u4 %spam. [ $+ [ $nick ] ]
  if (%spam. [ $+ [ $nick ] ] == 6) {
    set -u10 %mutechan #
    set -u10 %mutenick $nick
    msg ChanServ op #
  }
}
on *:OP:%mutechan: {
  if (($opnick == $me) && (%mutenick ison #)) mute # %mutenick
  msg ChanServ deop #
  unset %mutechan %mutenick
}


Last edited by RoCk; 25/03/10 02:31 PM.
N
Nicmavr
Nicmavr
N
Tried it, but it doesn't seem to be working. All it does is op via ChanServ and finish, no muting, deoping, etc... :\

Last edited by Nicmavr; 25/03/10 02:04 PM.
Joined: Dec 2002
Posts: 1,999
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 1,999

Sorry, it was missing a bracket. I edited the code above. Try it again.

N
Nicmavr
Nicmavr
N
Yeah, its good now. Thanks a lot! grin


Link Copied to Clipboard