mIRC Homepage
Posted By: Joe_Dean PM All Online OPs - 10/05/08 06:49 AM
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?
Posted By: LittleJohn Re: PM All Online OPs - 10/05/08 12:44 PM
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
}
Posted By: hixxy Re: PM All Online OPs - 10/05/08 12:49 PM
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.
}
Posted By: Wims Re: PM All Online OPs - 10/05/08 01:25 PM
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
Posted By: RusselB Re: PM All Online OPs - 10/05/08 01:29 PM
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.
Posted By: Wims Re: PM All Online OPs - 10/05/08 01:41 PM
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.
Posted By: hixxy Re: PM All Online OPs - 10/05/08 01:56 PM
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.
}
Posted By: RusselB Re: PM All Online OPs - 10/05/08 07:10 PM
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.
Posted By: hixxy Re: PM All Online OPs - 11/05/08 11:01 AM
Yes, should've been $2 :p
Posted By: Riamus2 Re: PM All Online OPs - 12/05/08 02:51 AM
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)
© mIRC Discussion Forums