mIRC Homepage
Posted By: ToRmEnTeD Op notice for @'s AND %'s ? - 07/12/08 10:33 PM
Hey guys.. I am in need of a simple script that will who is a user on join and send a OPNOTICE to all of the @'s and %'s in the room at that time. Up untill now i been using a built in script to do this but it only sends notice to @'s i need to send to both @'s and %'s
So basicly when a user joins i need it to say something like

"Guest839 Is also in - #Adult_Zone and then a msg here would be nice"
thats it and thats the channel i need it to warn against.

If anyone is up to this or knows of one that does exaclty this please let me know. As always I greatly apprecate you all
Posted By: RusselB Re: Op notice for @'s AND %'s ? - 07/12/08 11:46 PM
Note: For this to work correctly, the client running the code must join the channel(s) after the code is installed.
Code:
on *:join:#:{
  if $nick == $me {
    var %a = 1, %b = $nick($chan,0,oh)
    while %a <= %b {
      set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$nick($chan,%a,oh),44)
      inc %a
    }
  }
  else {
    var %ohchan = $chan
    .enable #ohnotice
    .whois $nick
  }
}
#ohnotice off
raw 318:*:{
  .disable #ohnotice
  haltdef
}
raw 319:*:{
  .notice $($+(%,ohnotice,$network,.,%ohchan),2) $2 is also $3-
  haltdef
}
#ohnotice end
on *:op:#:{
  set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$opnick,44)
}
on *:help:#:{
  set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$hnick,44)
}
on *:deop:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$opnick,1,44)
}
on *:dehelp:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$hnick,1,44)
}
on *:quit:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$nick,1,44)
}
on *:part:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$nick,1,44)
}
on *:kick:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$knick,1,44)
}
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 08/12/08 03:49 AM
Thanks as always but yeah i am not understanding this script at all....Is there something i should see ? A menu or a place in the code to enter a channel and msg or anything? I just for some reason cant seem to find anything i guess?
Posted By: RusselB Re: Op notice for @'s AND %'s ? - 08/12/08 05:42 AM
Only if you're in multiple channels and only want it to work in certain specific channels.
If so, go through the code and find each line that starts with the word ON
Near the end of, most of, those lines, you will see the # character.
Replace the # character at that location with the name of the channel you want it to work on. If more than one channel, separate the channel names with a comma.

This code sends a message stating what channels the person that just joined is also in at the time of the joining, and it is sent via /notice to all of the ops and half-ops in the channel.

You're going to have to clarify what you mean/want by in reference to "A menu or a place in the code to enter a channel and msg or anything?"
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 08/12/08 05:21 PM
I think that maybe i didnt ask for something right so im going to reword exactly what im looking for.

I own a channel on,

www.everywherechat.com

My channel is called #chat18+

Another channel on the same server is called #Adult_zone

I need a op/% Notice to be sent to my staff when ANY user joins #chat18+ while also in #Adult_Zone
I CANNOT idle anything inside #Adult_Zone so it has to be done by /whois on join to every users.
The op Notice that is sent i would Really like to be able edit depending on whats going on...
With that said ...Is this still what you gave me ?
Posted By: RusselB Re: Op notice for @'s AND %'s ? - 08/12/08 05:44 PM
Not exactly, but it's close. I can't do the modifications at the moment, but will when I get home from work.
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 08/12/08 06:07 PM
ok thanks man, Im gonna look some more at what you gave me and see if i can understand it more
Posted By: RusselB Re: Op notice for @'s AND %'s ? - 09/12/08 01:50 AM
Here's the re-write, and I tried to make it as "kiddie-proof" as I could.
Code:
on *:input:*:{
  if $1 == !addchan {    chan add $strip($2-)  }
  elseif $1 == !remchan {    chan rem $strip($2-)  }
}
on *:text:!*:*:{
  if $istok($($+(%,op.,$network,.,$chan),2),$nick,32) {
    if $1 == !addchan {    chan add $strip($2-)  }
    elseif $1 == !remchan {    chan rem $strip($2-)  }
  }
}
on *:start:{
  if !$hget(badchan) { .hmake badchan 100 }
  if $exists($scriptdirbadchan.hsh) { .hload badchan $scriptdirbadchan.hsh }
  .scon -at1 checkops
}
on *:exit:{
  .hsave badchan $scriptdirbadchan.hsh
}
on *:disconnect:{
  .hsave badchan $scriptdirbadchan.hsh
}
alias -l checkops {
  var %b = $chan(0)
  while %b {
    var %c = $nick($chan(%b),0,oh)
    while %c {
      set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$nick($chan(%b),%c,oh),44)
      dec %c
    }
    dec %b
  }
}
alias chan {
  if $1 == add {
    if !$2 {
      .msg $nick Usage !addchan #channel_1,#channel_2,#channel_3 Message
      .msg $nick Multiple channels can be specified by comma separating them.
      .msg $nick A common message regarding all specified channels can be entered by separating the message from the channels with a space.
    }
    else {
      var %a = $numtok($2,44)
      while %a {
        .hadd -m Badchan $gettok($2,%a,44) $iif($3-,$3-,Bad Channel)
        dec %a
      }
    }
  }
  elseif $1 == rem {
    if !$2 {
      .msg $nick Usage !remchan #channel_1,#channel_2,#channel_3
      .msg $nick Multiple channels can be specified by comma separating them.
    }
    else {
      var %a = $numtok($2,44)
      while %a {
        .hdel Badchan $gettok($2,%a,44)
        dec %a
      }
    }
  }
}
on *:join:#:{
  var %ohchan = $chan
  .enable #ohnotice
  .whois $nick
}
#ohnotice off
raw 318:*:{
  .disable #ohnotice
  haltdef
}
raw 319:*:{
  var %a = $numtok($3-,32)
  while $hget(Badchan,$gettok($3-,%a,32)) {
    .notice $($+(%,ohnotice,$network,.,%ohchan),2) $2 is also on $gettok($3-,%a,32) with a warning message of $hget(Badchan,$gettok($3-,%a,32))
    dec %a
  }
  haltdef
}
#ohnotice end
on *:op:#:{
  set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$opnick,44)
}
on *:help:#:{
  set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$hnick,44)
}
on *:deop:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$opnick,1,44)
}
on *:dehelp:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$hnick,1,44)
}
on *:quit:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$nick,1,44)
}
on *:part:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$nick,1,44)
}
on *:kick:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$knick,1,44)
}


Ops & half-ops have the ability to add/remove channel(s) that are notified upon. A message can be supplied, but if one isn't, then a default message of Bad Channel will be used automatically.

Let me know if there are any problems and/or if you need an explanation.
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 09/12/08 02:56 AM
I am feeling like a dumb ass. It seems that the chans are set by either typing the !addchan #channel into the room or by sending it to the client using the script via msg.... It dont seem to respond to anything i do ?
Im sorry frown Guees i need the explanation...
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 09/12/08 04:17 PM
ok I did manage to get this working....Kinda. lol im still trying
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 09/12/08 04:43 PM
I cant seem to get the msg to work..And it pulls a msg called
"bad channel" I cant even find that string in the code to change the defult?

This is all im having probs with i think..
Posted By: RusselB Re: Op notice for @'s AND %'s ? - 09/12/08 05:41 PM
Code:
.hadd -m Badchan $gettok($2,%a,44) $iif($3-,$3-,Bad Channel)
 
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 09/12/08 06:44 PM
Ok im having issues with it all the way around
Exaclty what is the method for adding and removing a channel?

Looking at the script it looks like if i typed

!addchan #Adult_Zone And a msg here

that its what it would be looking for...
But i dont get any response from the client running the script and i dont get any msgs what so ever.

I am using it on a brand new install of the newsest Mirc

I loaded the script, Joined the channel. Then from my other client i issued the !addchan command..

is this the correct method ?
Posted By: RusselB Re: Op notice for @'s AND %'s ? - 10/12/08 12:53 AM
You're not seeing a reply message, as I didn't include a reply messsage in the code, aside from an informational message if the parameter was missing.

That is the correct format.

I can't edit my earlier post at this point, but I will copy & paste the script, adding some more informational messages.
Posted By: RusselB Re: Op notice for @'s AND %'s ? - 10/12/08 12:59 AM
This script is designed to be used remotely (ie: using another client) or directly (using the client that is running the script)

The ON TEXT event is for remote access, and the ON INPUT event is for direct access. The format for the commands is the same no matter which access is being used.
Code:
on *:input:*:{
  if $1 == !addchan {    chan add $strip($2-)  }
  elseif $1 == !remchan {    chan rem $strip($2-)  }
}
on *:text:!*:*:{
  if $istok($($+(%,op.,$network,.,$chan),2),$nick,32) {
    if $1 == !addchan {    chan add $strip($2-)  }
    elseif $1 == !remchan {    chan rem $strip($2-)  }
  }
}
on *:start:{
  if !$hget(badchan) { .hmake badchan 100 }
  if $exists($scriptdirbadchan.hsh) { .hload badchan $scriptdirbadchan.hsh }
  .scon -at1 checkops
}
on *:exit:{
  .hsave badchan $scriptdirbadchan.hsh
}
on *:disconnect:{
  .hsave badchan $scriptdirbadchan.hsh
}
alias -l checkops {
  var %b = $chan(0)
  while %b {
    var %c = $nick($chan(%b),0,oh)
    while %c {
      set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$nick($chan(%b),%c,oh),44)
      dec %c
    }
    dec %b
  }
}
alias chan {
  if $1 == add {
    if !$2 {
      .msg $nick Usage !addchan #channel_1,#channel_2,#channel_3 Message
      .msg $nick Multiple channels can be specified by comma separating them.
      .msg $nick A common message regarding all specified channels can be entered by separating the message from the channels with a space.
    }
    else {
      var %a = $numtok($2,44)
      while %a {
        .hadd -m Badchan $gettok($2,%a,44) $iif($3,$3-,Bad Channel)
        dec %a
      }
      .msg $nick Bad channels $2 have been added with the message of $iif($3,$3-,Bad Channel)
    }
  }
  elseif $1 == rem {
    if !$2 {
      .msg $nick Usage !remchan #channel_1,#channel_2,#channel_3
      .msg $nick Multiple channels can be specified by comma separating them.
    }
    else {
      var %a = $numtok($2,44)
      while %a {
        .hdel Badchan $gettok($2,%a,44)
        dec %a
      }
      .msg $nick Bad channels $2 have been removed.
    }
  }
}
on *:join:#:{
  var %ohchan = $chan
  .enable #ohnotice
  .whois $nick
}
#ohnotice off
raw 318:*:{
  .disable #ohnotice
  haltdef
}
raw 319:*:{
  var %a = $numtok($3-,32)
  while $hget(Badchan,$gettok($3-,%a,32)) {
    .notice $($+(%,ohnotice,$network,.,%ohchan),2) $2 is also on $gettok($3-,%a,32) with a warning message of $hget(Badchan,$gettok($3-,%a,32))
    dec %a
  }
  haltdef
}
#ohnotice end
on *:op:#:{
  set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$opnick,44)
}
on *:help:#:{
  set $+(%,ohnotice,$network,.,$chan) $addtok($($+(%,ohnotice,$network,.,$chan),2),$hnick,44)
}
on *:deop:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$opnick,1,44)
}
on *:dehelp:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$hnick,1,44)
}
on *:quit:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$nick,1,44)
}
on *:part:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$nick,1,44)
}
on *:kick:#:{
  set $+(%,ohnotice,$network,.,$chan) $remtok($($+(%,ohnotice,$network,.,$chan),2),$knick,1,44)
}
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 10/12/08 01:53 AM
ok lol now we talking my kinda talk. That works fine i think However it dont work for me on Mirc (Fresh Install) nor will it work on PNPplus. It seems to work fine on my Invision script so ill make that work untill i can figure out whats wrong...I always have problems getting scripts to work on things other than Invision. Any reason you know of for this ?
Posted By: RusselB Re: Op notice for @'s AND %'s ? - 10/12/08 03:16 AM
PNPplus has always caused me headaches when trying to implement a supplemental script. I have given up trying to get things to work with that.

However, I can't see or think of any reason why it wouldn't work in a fresh install, especially since you state that it does work with Invision.
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 10/12/08 04:25 PM
Im sorry ..this is driving me mad. I have a question. On this script.Does it require me to be in the bad channel in order for it to work ?...Because I loaded it on a fresh install of the newest Mirc and then i give the addchan command and i get this msg in the script.

[05:25] *ToRmEnTeD* !addchan #Adult_Zone Feel free to kick this Double Dipping ***!
[05:25] *AnTiSoCiaL* Bad channels #Adult_Zone have been added with the message of Feel free to kick this Double Dipping ***!

but when a user joins i get nothing even tho the person is parked in the bad channel. frown I honestly am confused as to why its not working. Yesterday i had added My own channel as a bad chan..and you know it worked..thats why i said i had it working...Thus why i am asking if i have to be in the badchan ?

Posted By: RusselB Re: Op notice for @'s AND %'s ? - 11/12/08 06:59 AM
The script definetely does NOT require you to be in the bad channel.

From what you said earlier, that would almost be defeating the point of the script.

I'll look over the code again, and if necessary do a re-write so that some of the compound variables are eliminated. I suspect that that is where your problems actually lie.
Posted By: RusselB Re: Op notice for @'s AND %'s ? - 11/12/08 07:58 AM
The format for adding/removing channels is the same.
Op/Half-op nicks are now stored in a special entry in the hash table, and all hash table items include a network reference, just in case you (or someone else) wants to use this on multiple networks.
Code:
on *:input:*:{
  if $1 == !addchan {    chan add $strip($2-)  }
  elseif $1 == !remchan {    chan rem $strip($2-)  }
}
on *:text:!*:#:{
  if $istok($hget(Badchan,$+($network,.,$chan)),$nick,44) {
    if $1 == !addchan {    chan add $strip($2-)  }
    elseif $1 == !remchan {    chan rem $strip($2-)  }
  }
}
on *:start:{
  if !$hget(badchan) { .hmake badchan 100 }
  if $exists($scriptdirbadchan.hsh) { .hload badchan $scriptdirbadchan.hsh }
  .scon -at1 checkops
}
on *:exit:{
  .hsave badchan $scriptdirbadchan.hsh
}
on *:disconnect:{
  .hsave badchan $scriptdirbadchan.hsh
}
alias -l checkops {
  var %b = $chan(0)
  while %b {
    var %c = $nick($chan(%b),0,oh), %ohnicks
    while %c {
      %ohnicks = $addtok(%ohnicks,$nick($chan(%b),%c,oh),44)
      dec %c
    }
    .hadd -m Badchan $+(oh.,$network,.,$chan(%b)) %ohnicks
    dec %b
  }
}
alias chan {
  if $1 == add {
    if !$2 {
      .msg $nick Usage !addchan #channel_1,#channel_2,#channel_3 Message
      .msg $nick Multiple channels can be specified by comma separating them.
      .msg $nick A common message regarding all specified channels can be entered by separating the message from the channels with a space.
    }
    else {
      var %a = $numtok($2,44)
      while %a {
        .hadd -m Badchan $+($network,.,$gettok($2,%a,44)) $iif($3,$3-,Bad Channel)
        dec %a
      }
      .msg $nick Bad channels $2 have been added with the message of $iif($3,$3-,Bad Channel)
    }
  }
  elseif $1 == rem {
    if !$2 {
      .msg $nick Usage !remchan #channel_1,#channel_2,#channel_3
      .msg $nick Multiple channels can be specified by comma separating them.
    }
    else {
      var %a = $numtok($2,44)
      while %a {
        .hdel Badchan $gettok($2,%a,44)
        dec %a
      }
      .msg $nick Bad channels $2 have been removed.
    }
  }
}
on *:join:#:{
  var %ohchan = $chan
  .enable #ohnotice
  .whois $nick
}
#ohnotice off
raw 318:*:{
  .disable #ohnotice
  haltdef
}
raw 319:*:{
  var %a = $numtok($3-,32)
  while $hget(Badchan,$+($network,.,$gettok($3-,%a,32))) {
    .notice $hget(Badchan,$+(oh.,$network,.,%ohchan)) $2 is also on $gettok($3-,%a,32) with a warning message of $hget(Badchan,$+($network,.,$gettok($3-,%a,32)))
    dec %a
  }
  haltdef
}
#ohnotice end
on *:op:#:{  ohnick add $chan $opnick }
on *:help:#:{  ohnick add $chan $hnick }
on *:deop:#:{  ohnick rem $chan $opnick }
on *:dehelp:#:{  ohnick rem $chan $hnick }
on *:quit:{  ohnick rem $chan $nick }
on *:part:#:{  ohnick rem $chan $nick }
on *:kick:#:{  ohnick rem $chan $knick }
alias -l ohnick {
  var %ohnicks = $hget(Badchan,$+(oh.,$network,.,$2))
  if $1 == add {    %ohnicks = $addtok(%ohnicks,$3,44)  }
  elseif $1 == rem {    %ohnicks = $remtok(%ohnicks,$3,1,44)  }
  .hadd -m Badchan $+(oh.,$network,.,$chan) %ohnicks
}


I have tested this out briefly, and everything seems to be ok.

Let me know if you have any difficulties.

P.S.: Due to the differences in how the information is stored in the hash table, please delete the old badchan.hsh file (if there is one) as the data in the old file no longer has a compatable format.
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 11/12/08 11:24 PM
Ok i am sry but i cant get this to work. It dont respond to commands from other ops but if i use the client running the script to issue the commands it says the chans was added and deleted with msg's but not a damn thing happens when they join my channel. Idk what it is...I know im prob coming off as dumb here because i know you said you tested it. I am sorry i cannot figure it out. like i said it was working before (the first script) but only when i added my own channel as a bad one. frown
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 11/12/08 11:26 PM
do the commands have to be issued in a certin channel or anything?
Posted By: RusselB Re: Op notice for @'s AND %'s ? - 12/12/08 02:34 AM
The only condition on where the commands are to be entered, is that the bot must be on/in the same channel/room.

Just noticed a problem in the code. Change
Code:
on *:text:!*:#:{
  if $istok($hget(Badchan,$+($network,.,$chan)),$nick,44) {
    if $1 == !addchan {    chan add $strip($2-)  }
    elseif $1 == !remchan {    chan rem $strip($2-)  }
  }
}
 
to
Code:
on *:text:!*:#:{
  if $istok($hget(Badchan,$+(oh.,$network,.,$chan)),$nick,44) {
    tokenize 32 $strip($1-)
    if $1 == !addchan {    chan add $strip($2-)  }
    elseif $1 == !remchan {    chan rem $strip($2-)  }
  }
}
 

I think that should resolve your issue of the commands not being recognized.
Posted By: ToRmEnTeD Re: Op notice for @'s AND %'s ? - 12/12/08 04:19 AM
lol i swear i am doing everything right....
Maybe its something to do with the room name and it having a underscore or something? It works perfect in my own channel that i am idle in...even the ops get the msg....they still cant issue commands ...but it works for #chat18+
get nothing for #Adult_Zone
© mIRC Discussion Forums