Ban script

By berend on Jan 27, 2011

Banscript, made for my bot on onlinegamesnet

Commands:

$addban


$delban

$bans
$kb
on *:TEXT:$addban *:*: {
  if ($Nick isop $chan) { 
    writeini bans.ini $chan $2 $2
    notice $nick $2 Is banned from $chan $+ .
    mode $chan +b $2
  }
}
on *:TEXT:$bans:#: {
  if ($Nick isop $chan) { 
    notice $nick  $+ $chan Bans.
    var %c 0
    var %t $ini(bans.ini, $chan, 0)
    while (%c < %t) {
      inc %c
      notice $nick $readini(bans.ini, $chan, $ini(bans.ini, $chan, %c))
    }
    notice $nick  $+ %c bans found.
  }
  else { notice $nick You lack access to $chan $+ .
  }
}
on *:TEXT:$delban *:*: {
  if ($Nick isop $chan) { 
    remini bans.ini $chan $2
    notice $nick $2 Is unbanned from $chan $+ .
    mode $chan -b $2
  }
}
on *:TEXT:$kb *:*: {
  if ($Nick isop $chan) {  
    writeini bans.ini $chan $address($2,2) $address($2,2)
    mode $chan +b $address($2,2)
    kick $2 $chan kickbanned by $nick
  }
}
on *:JOIN:#: {
  if ($readini(bans.ini, $chan, $address($nick, 2))) { 
    mode $chan +b $address($nick, 2)
    kick $nick $chan Banned.
  }
}

Comments

Sign in to comment.
berend   -  Jan 28, 2011

And i appreciate that alot.

 Respond  
Jethro   -  Jan 27, 2011

Well, please understand I wasn't trying to bust your chops or anything. I just can't stand redundant codes when they can be made better and effective. I'm in NO way an elite msl scripter; there are still people better than I am. I was trying to show you my approach of coding in msl, as well as demonstrate how a script can be done differently to other people who browse this thread. I hope I've been helpful and informative, and that's exactly my purpose of posting here at Hawkee.

 Respond  
berend   -  Jan 27, 2011

Yeah, thanks. But maybe because i'm not that high skilled in scripting msl. And i saw a few posts of you, and i hoped you would come with something better than me. And you did.
thanks :D

 Respond  
Jethro   -  Jan 27, 2011

Lego, instead of adding and deleting bans with the type 2 address, why not make a variable for $address($2,2) so you don't have to enter the exact address but the nickname to add and delete? Your script can be consolidated as such:

on @*:join:#:{
  if $readini(bans.ini,#,$wildsite) {
    ban -k # $nick 2 banned.
  }
}
on @$*:text:/^\$(add|del)?(bans?)|(kb)\b/iS:#:{
  if !%p {
    inc -u4 %p
    if $nick isop # { 
      var %type2 $address($2,2)
      if $regml(1) = add {
        writeini bans.ini # %type2 %type2
        notice $nick $regml Is banned from # $+ .
        mode # +b %type2
      }
      elseif $regml(1) = del {
        remini bans.ini # %type2
        notice $nick $2 Is unbanned from # $+ .
        mode # -b %type2
      }
      elseif $regml(1) = bans {
        notice $nick  $+ # Bans.
        var %c 0, %t $ini(bans.ini,#,0)
        while (%c < %t) {
          inc %c
          notice $nick $readini(bans.ini,#,$ini(bans.ini,#,%c))
        }
        notice $nick  $+ %c bans found.
      }
      else {
        writeini bans.ini # %type2 %type2
        ban -k # $2 2 kickbanned by $nick
      }
    }
    else { 
      notice $nick You lack access to # $+ . 
    }
  }
}
berend  -  Jan 10, 2020

:)

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.