Blacklist with -global support

Release your script here.
State:
- Author
- What it does
- Perhaps a little guide.
- Also, if the snippet is of any use to the community, it has a chance of getting posted on the main page, so don't hesitate to submit/ask!

Blacklist with -global support

Postby zNigel- » Tue May 12, 2009 7:18 pm

Heya.

Made this script quite a while ago.

First off, i'd like to thank Blady and Alcoholx for helping me out with this script.

To be able to use this script you have to create a txtfile named users.txt and put your host in it. The host should be equal to *!*@auth.users.quakenet.org.

Usage
!bl <add> <nick/host> ?reason? ?-global? - Add someone to the blacklist (Reason and Global are optional)
!bl del <host> ?-global? - Delete a blacklisted host (Global is optional)
!bl info - Author and Scriptversion
!bl help - Shows you the available commands
!bl list ?-global? - Shows you a list of your added blacklisted hosts (Global is optional)


Global would mean, the bot would ban the person on ALL channels the bot is on.

This script is no longer in development

Here goes
Code: Select all
on *:text:!bl*:#: {
  if ($read(users.txt,w,$address($nick,2))) {
    if (!$2) { .notice $nick Syntax: $1 <add|del|info|help|list> | halt }
    elseif ($2 == help) { .notice $nick Syntax: $1 <add|del|info|help|list> | halt }
    elseif ($2 == info) { .notice $nick %auth.ver | halt }
    elseif ($2 == add) {
      if (!$3) { .notice $nick Syntax: $1 <add> <nick/host> ?reason? ?-global? | halt }
      var %reason You are blacklisted from this channel
      var %reasong You are globally blacklisted from all known channels
      var %mask = $address($3,2)
      if (*!*@* iswm $3) { var %mask = $3 }
      if ($gettok($1-,-1,32) == -global) {
        if ($4 && $4 != -global) { var %reasong $remtok($4-,-global,32) }
        writeini bl.ini global %mask %reasong
        .notice $Nick Done: Added %mask to global blacklist with reason: %reason
        ;; kick/ban on all channel
        var %x = 1, %y = 0
        while ($comchan($me,%x)) {
          if ($me isop $v1) {
            .timer 1 %y pwnd.noob $v2 %mask %reasong
            inc %y 4
          }
          inc %x
        }

      }
      else {
        if ($4) { var %reason $4- }
        pwnd.noob $chan %mask %reason
      writeini bl.ini $chan %mask %reason | .notice $Nick Done. Added %mask to $chan blacklist with reason: %reason }
    }
    elseif ($2 == del) {
      if (!$3) { .notice $nick Syntax: $1 $2 <host> ?-global? | halt } {
        var %mask = $address($3,2)
        if (*!*@* iswm $3) { var %mask = $3 }
        if ($4 == -global) {
          if ($ini(bl.ini,global,$3)) { remini bl.ini global $3 | .notice $nick Done, removed $3 from global blacklist | removebans %mask }
          else { .notice $Nick That banmask cannot be found. }
        }
        elseif (!$4) {
          if ($ini(bl.ini,$chan,$3)) { remini bl.ini $chan $3 | .notice $nick Done, removed $3 from channel blacklist. | mode $chan -b $3 }
          else { .notice $nick That banmask cannot be found. }
        }
      }
    }
    elseif ($2 == list) {
      if ($3 == -global) var %topic = Global
      else var %topic = $chan

      notice $nick %topic banlist:
      var %x = 1, %y = 2
      while ($ini(bl.ini,%topic,%x)) {
        var %h = $v1, %r = $readini(bl.ini,%topic,%h)
        .timer 1 %y notice $nick Host: %h - Reason: %r
        inc %x
        inc %y 2
      }
    }
  }
}
;The join Event

on *:join:#: {
  if ($ini(bl.ini,global,$address($nick,2))) {
    mode $chan -o+b $nick $address($nick,2) | kick $chan $nick Global blacklist: $readini(bl.ini,global,$address($nick,2))
  }
  else {
    if ($ini(bl.ini,$chan,$address($nick,2))) {
    mode $chan -o+b $nick $address($nick,2) | kick $chan $nick Blacklisted: $readini(bl.ini,$chan,$address($nick,2)) }
  }
}

;; /pwnd.noob <#chan> <host> [reason]
alias pwnd.noob {
  if ($left($1,1) != $chr(35)) halt
  if (*!*@* !iswm $2) halt
  var %x = 1
  while ($ialchan($2,$1,%x).nick) {
    mode $1 +b $2
    kick $1 $v1 $iif($3,$3-,Matching host $2)
    inc %x
  }
}

;;usage: removebans %mask
alias removebans {
  if (*!*@* !iswm $1) { halt }
  var %x = 1, %y = 1
  while ($comchan($me,0) >= %x) {
    :loop
    if ($me isop $comchan($me,%x)) {
      while ($ibl($comchan($me,%x),0) >= %y) {
        if ($1 iswm $ibl($comchan($me,%x),%y)) { mode $comchan($me,%x) -b $1 | inc %x | goto loop }
        else { inc %y }
      }
    }
    inc %x
  }
}


on *:load: {
  set %author zNigel-
  set %version 2.57
  set %auth.ver Blacklist v $+ %version $+  by  $+ %author $+  $+ .

  echo -a Blacklist v $+ %version by %author loaded.
}
Last edited by zNigel- on Thu Jan 14, 2010 3:17 pm, edited 5 times in total.
zNigel-
 

Re: Blacklist with -global support

Postby Zodac0de » Tue May 12, 2009 7:52 pm

Really nice script ;)

Keep up the good work!
Zodac0de
 

Re: Blacklist with -global support

Postby Blady » Tue May 12, 2009 7:56 pm

Code: Select all
if ($gettok($1-,-1,32) == -global) {


You could change it with
Code: Select all
if ($findtok($1-,-global,1,32)) {

to be more 'flexible' ^^

Code: Select all
      else {
        if ($4) { var %reason $4- }
        pwnd.noob $chan %mask %reason
      writeini bl.ini $chan %mask %reason | .notice $Nick Done. Added %mask to $chan blacklist with reason: %reason }


You could also change this a bit, for example, if someone doesn't provide a reason, it set a default one.

Maybe add also a check if the host is already added, for example, if the host is added 'localy', and user try to add it globaly, it removes it from the 'local' file, and if he tries to add a local ban and the ban is already in the global file => halt



EDIT:

Code: Select all
    elseif ($2 == list) { halt

    }


WTF? :P




Else, gj.
Blady
 

Re: Blacklist with -global support

Postby zNigel- » Tue May 12, 2009 8:07 pm

Code: Select all
    elseif ($2 == list) { halt

    }


WTF? :P



Aye that's my current work :P To show a list of all the added :)
zNigel-
 

Re: Blacklist with -global support

Postby Blady » Tue May 12, 2009 8:14 pm

zNigel wrote:
Code: Select all
    elseif ($2 == list) { halt

    }


WTF? :P



Aye that's my current work :P To show a list of all the added :)



Code: Select all
    elseif ($2 == list) {
      if ($3 == -global) var %topic = Global
      else var %topic = $chan

      notice $nick %topic banlist:
      var %x = 1, %y = 2
      while ($ini(bl.ini,%topic,%x)) {
        var %h = $v1, %r = $readini(bl.ini,%topic,%h)
        .timer 1 %y notice $nick Host: %h - Reason: %r
        inc %x
        inc %y 2
    }


Here you go :D
Blady
 

Re: Blacklist with -global support

Postby zNigel- » Tue May 12, 2009 9:30 pm

Updated to Blady's shizzle ;) :P
zNigel-
 

Re: Blacklist with -global support

Postby StareX » Tue Jun 02, 2009 6:07 am

Thanks!

Nice script..... will help few people ^^
StareX
 

Re: Blacklist with -global support

Postby StareX » Sun Oct 18, 2009 3:57 pm

Sorry for the double post but,
What it does?
I mean when i do !bl Nick -global
it will blacklist in all of my bot channels?
or?
there is !bl Nick -global reason ?
Little description will help here? :\
StareX
 

Re: Blacklist with -global support

Postby zNigel- » Sun Oct 25, 2009 11:24 pm

StareX wrote:Sorry for the double post but,
What it does?
I mean when i do !bl Nick -global
it will blacklist in all of my bot channels?
or?
there is !bl Nick -global reason ?
Little description will help here? :\



If you read up, you'll see it all.
zNigel-
 


Return to Mirc Scripting Release

Who is online

Users browsing this forum: No registered users and 1 guest

cron