Page 1 of 1

Blacklist ;P)

PostPosted: Tue Apr 22, 2008 7:27 pm
by AndRew
Code: Select all
on *:text:$gban*:#:{ 
  if ($readini(userl.ini,global,$address($nick,2)) == owner) {
    if ($3 == $null) { /.notice $nick 0,1« 9:0:9:0,1 »0 Usage: $1 <nick/hostname> <reason> 0,1« 9:0:9:0,1 »0 | halt }
    if ($2 == $me) || ($2 == Q) || ($2 == S) { /.notice $nick 0,1« 9:0:9:0,1 »0 I can't ban Qnet Service or $2 is me! 0,1« 9:0:9:0,1 »0 | halt }
    var %host = $address($2,2)
if (*!*@* iswm $2) { var %host = $2 }
    if (%host != $null) {
      /writeini blacklistik.ini %host reason $3-
inc %blid
      /mode $chan +b %host
who $chan
timer 1 3 checkformatch $chan %host $3-
      /kick $chan $2 $replace(%kickmsg,:reason:,Global Banned - $3-,:id:,%blid)
      /.notice $nick 0,1« 9:0:9:0,1 »0 Done 0,1« 9:0:9:0,1 »0
      //halt
    }
  }
}
 alias checkformatch {
; CHECKFORMATCH for checking matching nicks. Author: Teppuli
var %i = 0
while (%i <= $nick($1,0)) {
if ($2 iswm $address($nick($1,%i),5)) {
inc %blid
kick $1 $nick($1,%i) $replace(%kickmsg,:reason:,$3-,:id:,%blid)
}
inc %i
}
}
on *:text:$gbversion:#:{
  if ($readini(userl.ini,global,$address($nick,2)) == owner) {
    /msg $chan 0,1« 9:0:9:0,1 »0 Global Blacklist version v2.5 by AndRew - 2008 © 0,1« 9:0:9:0,1 »0
  }
}
 
on *:join:#:{
  var %i = 1
  while (%i <= $ini(blacklistik.ini,0)) {
    if ($ini(blacklistik.ini,%i) iswm $address($nick,5)) {
      var %reason = $readini(blacklistik.ini,$ini(blacklistik.ini,%i),reason)
      inc %blid
      /ban -k $chan $nick $replace(%kickmsg,:reason:,%reason,:id:,%blid)
    }
    inc %i
  }
}
 
on *:text:$gunban*:#:{
  if ($readini(userl.ini,global,$address($nick,2)) == owner) {
    if ($2 == $null) { /.notice $nick 0,1« 9:0:9:0,1 »0 Usage: $1 <hostname> 0,1« 9:0:9:0,1 »0 | halt }
    var %host = $address($2,2)
    if (*!*@* iswm $2) { /var %host = $2 }
    /remini blacklistik.ini %host
mode $chan +b
mode $chan -b %host
timer 1 5 chanunbanmatch $chan $2
/notice $nick 0,1« 9:0:9:0,1 »0 Done 0,1« 9:0:9:0,1 »0
    /halt
  }
}
alias -l chanunbanmatch {
; CHANUNBANMATCH unbans all maching bans. Author: Teppuli
var %i = 1
while (%i <= $ibl($1,0)) {
if ($2 iswm $ibl($1,%i)) { mode $1 -b $ibl($1,%i) }
inc %i
}
}
on *:text:$glist:#:{
  if ($readini(userl.ini,global,$address($nick,2)) == owner) {
    .notice $nick 0,1« 9:0:9:0,1 »0 Blacklist type: Global - Entries: $ini(blacklistik.ini,0) 0,1« 9:0:9:0,1 »0
    var %i = 1
     while (%i <= $ini(blacklistik.ini,0)) {
      var %x = $ini(blacklistik.ini,%i)
var %reason = $readini(blacklistik.ini,$ini(blacklistik.ini,%i),reason)
      .notice $nick 0,1« 9:0:9:0,1 »0 Hostname: %x $+ . 0,1« 9:0:9:0,1 »0 Reason: %reason 0,1« 9:0:9:0,1 »0
      inc %i
    }
    .notice $nick 0,1« 9:0:9:0,1 »0 End of Global Blacklist. 0,1« 9:0:9:0,1 »0
  }
}


Have Fun with my script :mrgreen:

:!: Lukemob: Put all the codes into a [ code ]

Re: Blacklist ;P)

PostPosted: Sat May 24, 2008 10:41 am
by Lukemob
Hello. I'd have a few advices

1. What's that " / .notice " (Should be just .notice)
2. Better would look, and also would allow multiple codes:
Code: Select all
on *:text:*:#:{
if ($1 == $!gban) {  }
elseif ($1 == $!gbanversion) {  }
}
etc...

3. While you're coding, you dont need to use /notice, /msg, /kick, /writenini, /mode ... just leave the / and use just notice, msg, etc.
4. Put all the scripts in [ code ] [ /code ] (without spaces in the brackets) - looks more synoptic

Anyway, easy and nice for beginners to learn.

Hf & gl