mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2004
Posts: 5
I
ibiza Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Dec 2004
Posts: 5
I have found a script on this forum but im having problems with it. for the %protchans if more then one channel is in there it dont work on them channels. but if i only have one it will work example
%protchans #asianmelb #mirc #chadstone <-- will not work
%protchans #mirc <---- will work

SOMEONE PLEASE HELP

below is the code
Code:
menu channel {
  Badchan Checker
  .$iif($group(#badchans) == off,$style(2)) $iif($istok(%protchans,#,32),Remove,Add) protection for #:{
    if $istok(%protchans,#,32) {
      %protchans = $remtok(%protchans,#,1,32)
      echo -ac info * Removed # from the list of protected channels
    }
    else {
      %protchans = %protchans #
      echo -ac info * Added # to the list of protected channels
    }
  }
  .$iif($group(#badchans) == on,Disable,Enable):{
    if $group(#badchans) == on) { disable #badchans | chans_save }
    else { enable #badchans | chans_load }
  }
}

#badchans on
on *!:JOIN:%protchans: .enable #chancheck | whois $nick 
on *:START: chans_load
on *:EXIT: chans_save
#badchans end

#chancheck off
raw 318:*: haltdef | .disable #chancheck 
raw 319:*: haltdef | chans_check $2- 
raw *:*: if $istok(301 307 310 311 312 313 317 320 401,$numeric,32) { haltdef }
#chancheck end

alias chans_noprefix var %a, %b = $regsub($1-,/(?:^|\s)([^#]+)/g,$chr(32),%a) | return %a

alias chans_check {
  var %chans = $chans_noprefix($2-), %a = 1
  while $gettok(%chans,%a,32) {
    if $hget(chans,$v1) { chans_comkick $1 | return }
    inc %a
  }
}

alias chans_comkick {
  var %a = $comchan($1,0), %b
  while $comchan($1,%a) {
    %b = $v1
    if $istok(%protchans,%b,32) &amp;&amp; $me isop %b &amp;&amp; $1 !isop %b {
      ban -ku1800 %b $1 2 Banned: forbidden channel/nickname. 
    }
    dec %a
  }
}

alias chans_load {
  if !$isfile(chans.txt) {
    echo -asc info * Could not find chans.txt. Creating new file...Done.
    write chans.txt
  }
  hmake chans
  hload chans chans.txt
}

alias chans_save hsave chans chans.txt | hfree chans

alias chans_add {
  hadd chans $$1 1 
  echo -ac info * Added $1 to list of bad channels
}

alias chans_rem {
  hdel chans $$1 
  echo -ac info * Deleted $1 from list of bad channels 
}

alias chans_list {
  var %a = 1
  echo -asc info ### Listing bad channels ###
  while $hget(chans,%a).item { 
    echo -as * $v1
    inc %a
  }
}


Regards
Shaun Valentic
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Yeah it was me who made it.

I didn't spot that one, it's a valid point, the channels in %protchans have to be delimited by a comma in
order to support multiple channels. No idea why I didn't spot that. So change your %protchans so that there are comma's between each channel. From now on the script will do that itsself when you add one.

The channels to add with /chans_add support wildcards, here are some examples:

/chans_add *sex* --> match with "sex" in any position of the channel name
/chans_add *lol --> match with "lol" at the end of the channel name
/chans_add #lame* --> match any channel that starts with #lame in its name
/chans_add #xteensx -> match the channel named #xteensx
/chans_add #123? -> match the channel named #123 followed by any character
...

Script is now off, to enable it, right click in a channel.

Start -> Run -> wordpad -> paste code -> copy code to Scripts Editor, tab Remote (alt+r).

Code:
menu channel { 
  Badchan Checker 
  .$iif($group(#badchans) == off,$style(2)) $iif($istok(%protchans,#,32),Remove,Add) protection for #:{ 
    if $istok(%protchans,#,44) { 
      %protchans = $remtok(%protchans,#,1,44) 
      echo -ac info * Removed # from the list of protected channels 
    } 
    else { 
      %protchans = $addtok(%protchans,#,44)
      echo -ac info * Added # to the list of protected channels 
    } 
  } 
  .$iif($group(#badchans) == on,Disable,Enable):{ 
    if $group(#badchans) == on) { disable #badchans | chans_save } 
    else { enable #badchans | chans_load } 
  } 
} 
 [color:red]  [/color] 
#badchans off
on *!:JOIN:%protchans: .enable #chancheck | whois $nick 
on *:START: chans_load 
on *:EXIT: chans_save 
#badchans end 
 [color:red]  [/color] 
#chancheck off 
raw 318:*: haltdef | .disable #chancheck 
raw 319:*: haltdef | chans_check $2- 
raw *:*: if $istok(301 307 310 311 312 313 317 320 401,$numeric,32) { haltdef } 
#chancheck end 
 [color:red]  [/color] 
alias chans_noprefix var %a, %b = $regsub($1-,/(?:^|\s)([^#]+)/g,$chr(32),%a) | return %a 
 [color:red]  [/color] 
alias chans_check { 
  var %chans = $chans_noprefix($2-), %a = 1 
  while $gettok(%chans,%a,32) { 
    if $hfind(chans,$v1,1,W) { chans_comkick $1 | return } 
    inc %a 
  } 
} 
 [color:red]  [/color] 
alias chans_comkick { 
  var %a = $comchan($1,0), %b 
  while $comchan($1,%a) { 
    %b = $v1 
    if $istok(%protchans,%b,44) &amp;&amp; $me isop %b &amp;&amp; $1 !isop %b { 
      ban -k %b $1 2 You are on a forbidden channel. 
    } 
    dec %a 
  } 
} 
 [color:red]  [/color] 
alias chans_load { 
  if !$isfile(chans.txt) { 
    echo -asc info * Could not find chans.txt. Creating new file...Done. 
    write chans.txt 
  } 
  hmake chans 
  hload chans chans.txt 
} 
 [color:red]  [/color] 
alias chans_save hsave chans chans.txt | hfree chans 
 [color:red]  [/color] 
alias chans_add { 
  hadd chans $$1 1 
  echo -ac info * Added $1 to list of bad channels 
} 
 [color:red]  [/color] 
alias chans_rem { 
  hdel chans $$1 
  echo -ac info * Deleted $1 from list of bad channels 
} 
 [color:red]  [/color] 
alias chans_list { 
  var %a = 1 
  echo -asc info ### Listing bad channels ### 
  while $hget(chans,%a).item { 
    echo -as * $v1 
    inc %a 
  } 
} 
 

Might also be a good idea to add protection for netsplits, when a lot of people join at the same time.

Last edited by FiberOPtics; 23/12/04 01:44 PM.

Gone.
Joined: Dec 2004
Posts: 5
I
ibiza Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Dec 2004
Posts: 5
Thank you very much, its a nice script wink
Hopefuly thats the last problem cause i think i had one more but it seems to be fixed now, if i do have another i will let you know (:

thanks for your time.


Regards
Shaun Valentic
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
No problem.

You should copy the code from the msgboard (as I stated in my pm), because I made some small changes in the mean time.

Final version is the one that you will see while reading this.

Greets


Gone.
Joined: Dec 2004
Posts: 5
I
ibiza Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Dec 2004
Posts: 5
Hey, it still onlys ban for one channel, i checked the commas are there. but its only working on the one channel.


Regards
Shaun Valentic
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Read my former post, and my pm :tongue:


Gone.
Joined: Dec 2004
Posts: 5
I
ibiza Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Dec 2004
Posts: 5
Thank you, did'nt relize you updated it again, working very nice wink

You would'nt happen to have a mirc script to modify the channel limit would you?


Regards
Shaun Valentic
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
//mode $chan +l <limit>


New username: hixxy
Joined: Dec 2004
Posts: 5
I
ibiza Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Dec 2004
Posts: 5
nah, im after one that will modfier the limit when users join/part/quit


Regards
Shaun Valentic
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Make a new thread or search around in sites like www.mircscripts.org, www.mirc.net, www.hawkee.com etc.

I don't script much more these days, no time because exams are coming real close.

Perhaps tidy will help you.

Greets


Gone.
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
on *@!:join:#:{ setlimit $cid $chan }
on *@!part:#:{ setlimit $cid $chan }
on *!:quit:{
  var %i = 1
  while ($comchan($nick,%i)) {
    if ($comchan($nick,%i).op) { setlimit $cid $comchan($nick,%i) }
    inc %i
  }
}
on @*:kick:#:{
  if ($knick != $me) { setlimit $cid $chan }
}
alias setlimit {
  if (!$timer(mode $+ $1 $+ $2)) { .timermode $+ $1 $+ $2 1 6 mode $2 +l $calc($nick($2,0) + 5) }
}


This one will set the channel limit to <number of users> + 5 six seconds after someone joins, parts, quits or is kicked.


New username: hixxy
Joined: Mar 2004
Posts: 359
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Mar 2004
Posts: 359
I remember this script, Fiber wrote it for me, he's helped me a few times actually. Glad he's around here to help cool

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
My god (and I'm not even religious) I don't think I've ever been slacking so much...

There is yet another instance of space delimited %protchans in the script that I overlooked, and it's in the menu.

See this line:

.$iif($group(#badchans) == off,$style(2)) $iif($istok(%protchans,#,32),Remove,Add) protection for #:

The 32 should be changed to a 44.

Greets


Gone.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Thanks smile

Be sure to copy the final version of it, as now it's in a state that it's intended to. Also check my former post, as it's important for the adding of channels to %protchans.

Greets


Gone.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
It's at times like these that I wish the edit period never expired...then again, that could become confusing in some threads I suppose.

Anyway, in this line:

raw *:*: if $istok(301 307 310 311 312 313 317 320 401,$numeric,32) { haltdef }

should be changed to this line:

raw *:*: if $istok(301 307 310 311 312 313 317 320,$numeric,32) { haltdef }

In other words, the 401 shouldn't be there.


Gone.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I have updated the script to take care of some small things, check it out: here

Greets


Gone.

Link Copied to Clipboard