mIRC Home    About    Download    Register    News    Help

Print Thread
#199171 10/05/08 06:49 AM
J
Joe_Dean
Joe_Dean
J
I made a script so that when an OP types !adminalert <name>, they are alerted when that name joins the channel. I finally got it working, and it works nicely, however I want the script to PM every op in the channel.

Is there a way I can get it to do this without individually adding each OPs name in the script?

#199179 10/05/08 12:44 PM
L
LittleJohn
LittleJohn
L
This is a modified list ops might need to be edited a bit and I know that using a while statment would be best but this should do the trick. Check the mIRC help files on how to use a while statment and the if-then-else for the isop statment. these will help.

Alias MSGOPS {
echo 4 * Notifying Op's on #
set %i 1
:next
set %nick $nick(#,%i)
if %nick == $null goto done
if %nick isop # MSG $1-
inc %i
goto next
:done
echo 4 * End of Ops list
}

#199180 10/05/08 12:49 PM
Joined: Sep 2005
Posts: 2,630
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,630
Code:
on @*:text:!adminalert &:#: set %watch $addtok(%watch,$1,32)
on !*:join:#:{
  if ($istok(%watch,$nick,32)) onotice # $nick just joined and is on the watch list.
}

hixxy #199187 10/05/08 01:25 PM
Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
Originally Posted By: hixxy
on @*:text:!adminalert &:#: set %watch $addtok(%watch,$1,32)
I'm not sure the "bot" have to be an op with this event.Only the users that type the command have to, so you should have a if ($nick isop $chan), and you're adding $1 to %watch, should be $2 smile


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #199188 10/05/08 01:29 PM
Joined: Aug 2004
Posts: 7,168
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,168
The bot will have to have ops, as only ops can use the onotice or omsg commands, but it looks like you're right about hixxy using $1 where it should be $2 in the $addtok.

Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
The OP never said the "bot" have to be an ops, even when he have to alert, but i agree it makes sense.In any case there still miss a if statement because the user that type the !command have to be an op too.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #199190 10/05/08 01:56 PM
Joined: Sep 2005
Posts: 2,630
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,630
Code:
on *:text:!adminalert &:#:{
  if ($nick isop #) set %watch $addtok(%watch,$1,32)
}
on !*:join:#:{
  if ($istok(%watch,$nick,32)) notice @ $+ # $nick just joined and is on the watch list.
}

hixxy #199211 10/05/08 07:10 PM
Joined: Aug 2004
Posts: 7,168
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,168
Would not
Code:
on *:text:!adminalert &:#:{
  if ($nick isop #) set %watch $addtok(%watch,$1,32)
}
simply end up setting %watch to !adminalert ?

My reading of the OP's original request seems to make this to make more sense
Code:
on *:text:!adminalert*:#:{
  if $nick !isop # {    .msg $nick This command is reserved for channel ops  }
  elseif !$2 {    .msg $nick Please use the correct format of !adminalert <nick(s)>  }
  else {
    var %a = $replace($2-,$chr(44),$chr(32)), %b = 1, %c = $numtok(%a,32)
    while %b <= %c {
      set %watch $addtok(%watch,$gettok(%a,%b,32),32)
      inc %b
    }
  }
}
on @*:join:#:{
  if $istok(%watch,$nick,32) {    .omsg Watched nick $nick has joined $chan  }
}

Admittedly the OP didn't ask for the ability to add more than one nick at the same time, or for the message if the person didn't have access to the command or for the message if the command wasn't issued properly.

Joined: Sep 2005
Posts: 2,630
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,630
Yes, should've been $2 :p

#199296 12/05/08 02:51 AM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
LittleJohn: If you're going to use $nick(#,%i) or similar to loop, you can use the extra parameter of "o" to specify only looping through ops rather than having a separate IF.

$nick(#,%i,o)


Link Copied to Clipboard