Modlist

By FRISH on Oct 05, 2007

This is a modlist that owners (must be ~) of a channel can add and/or delete mods to the modlist. If that name in the modlist is registered by the person that joins your channel they will be give the level they are given in the modlist.

Usage: Put In your remotes (Alt+R) (preferably a new script page) for a bot (i personally dont use bots so count yaself lucky i did this especially).
Commands:
!modlist (ops can use this command)
!amod
example: !amod FRISH qaohv
This gives them +qaohv when FRISH joins.
!dmod
example: !dmod FRISH
This removes that name from the modlist

When you load the script it will ask you the channel(s) you want for the modlist to work in (separate these channels by a commer eg/ #chan1,#chan2). And then you will be notified if you want to undo the rawmodes set by non owners, this means if its on if anyone except an owner (~) changes any mode eg/ ops someone or bans or even change the channel mode to +m etc, this will be reversed (not perfect yet but good so far).

Updates:
Fixed bracket mismatch :$
When someone joins, if they aren't identifyed with nickserv it will only msg in that channel not the other modlist channels
Multi channel support
Added access denied notices
Fixed a problem where anyone could add a mod :$ (and fixed this in rawmode)
Improved reverse rawmodes

Notes:
If you want to change the modlist channel or turn the reverse rawmodes on or off just right click on a channel with the bot, goto "modlist" then click on either "change modlist channel" or "reverse rawmodes on/off"
If you got a bot that changes channel modes and want to use reverse rawmodes but the bot isnt owner, you might need to add to the code or give the bot owner otherwise it will spam the channel.

on *:Load: {
  set %modchan $?="State your channel(s) for the modlist: (eg: #chan1,#chan2)"
  echo -a Modlist now applys to %modchan
  if ($?!="Turn reverse rawmodes for modlist on?") { 
    set %reverseraw 1
    echo -a reverse rawmodes on
  }
  else {
    unset %reverseraw
    echo -a reverse rawmodes off
  }
}

on *:Unload: {
  unset %modchan
  unset %reverseraw
}

menu status,channel {
  -
  Modlist
  .Change modlist channel {
    set %modchan $?="State your channel(s) for the modlist: (eg: #chan1,#chan2)"
    echo -a Modlist now applys to %modchan
  }
  .Reverse rawmodes on/off {
    if ($?!="Turn reverse rawmodes for modlist on?") { 
      set %reverseraw 1
      echo -a reverse rawmodes on
    }
    else {
      unset %reverseraw
      echo -a reverse rawmodes off
    }
  }
  -
}

on *:TEXT:*:%modchan: {
  if ($1 == !amod) && ($3) && ($left($nick(#,$me).pnick,1) == ~) {
    writeini modlist.ini modlist $2 $3 
    msg # 12 $2 is added to the modlist as: + $+ $3
  }
  if ($1 == !dmod) && ($2) && ($left($nick(#,$me).pnick,1) == ~) {
    remini modlist.ini modlist $2
    msg # 4 $2 has been removed from the modlist
  }
  elseif ($1 == !amod || $1 == !dmod) && ($left($nick(#,$me).pnick,1) != ~) {
    .notice $nick you dont have access to use this command
  }
  if ($1 == !modlist) && ($nick !isop #) { .notice $nick you dont have access to use this command }
  elseif ($1 == !modlist) && ($nick isop #) {
    var %line 2
    while ($read(modlist.ini, %line)) {
      if (q isin $gettok($read(modlist.ini, %line),2,61)) && ($gettok($read(modlist.ini, %line),1,61) !isin %qnicks) {
        var %qnicks $addtok(%qnicks,$chr(32) $gettok($read(modlist.ini, %line),1,61),44)
      }
      inc %line
    }
    var %line 2
    while ($read(modlist.ini, %line)) {
      if (a isin $gettok($read(modlist.ini, %line),2,61)) && ($gettok($read(modlist.ini, %line),1,61) !isin %qnicks %anicks) {
        var %anicks $addtok(%anicks,$chr(32) $gettok($read(modlist.ini, %line),1,61),44)
      }
      inc %line
    }
    var %line 2
    while ($read(modlist.ini, %line)) {
      if (o isin $gettok($read(modlist.ini, %line),2,61)) && ($gettok($read(modlist.ini, %line),1,61) !isin %qnicks %anicks %onicks) {
        var %onicks $addtok(%onicks,$chr(32) $gettok($read(modlist.ini, %line),1,61),44)
      }
      inc %line
    }
    var %line 2
    while ($read(modlist.ini, %line)) {
      if (h isin $gettok($read(modlist.ini, %line),2,61)) && ($gettok($read(modlist.ini, %line),1,61) !isin %qnicks %anicks %onicks %hnicks) {
        var %hnicks $addtok(%hnicks,$chr(32) $gettok($read(modlist.ini, %line),1,61),44)
      }
      inc %line
    }
    var %line 2
    while ($read(modlist.ini, %line)) {
      if (v isin $gettok($read(modlist.ini, %line),2,61)) && ($gettok($read(modlist.ini, %line),1,61) !isin %qnicks %anicksn %onicks %hnicks %vnicks) {
        var %vnicks $addtok(%vnicks,$chr(32) $gettok($read(modlist.ini, %line),1,61),44)
      }
      inc %line
    }
    msg # 4~Owners: %qnicks
    msg # 7&Admins: %anicks
    msg # 8@Ops: %onicks
    msg # 9 $+ $chr(37) $+ Half-ops: %hnicks
    msg # 13+Voice: %vnicks
  }
}

on *:JOIN:%modchan:{
  if ($readini(modlist.ini,n,modlist,$nick)) {
    set -e %checkmod 1
    set -e %actmodchan #
    who $nick
  }
}

raw 352:*:{
  if (%checkmod) {
    if (r !isincs $7) msg %actmodchan $6 $+ $chr(44) register with nickserv and hop to get your + $+ $readini(modlist.ini,n,modlist,$6)
    else {
      var %modtcn 1
      while ($gettok(%modchan,%modtcn,44)) {
        mode $gettok(%modchan,%modtcn,44) + $+ $readini(modlist.ini,n,modlist,$6) $str($chr(32) $6,$len($readini(modlist.ini,n,modlist,$6))))
        inc %modtcn
      }
    }
      unset %checkmod
      unset %actmodchan
    }
  }

on !*:RAWMODE:%modchan:{
  if ($left($nick(#,$nick).pnick,1) != ~) && ($nick != Chanserv) && (%reverseraw) {
    var %rawl 1
    var %rawlen $len($1)
    while ($mid($1,%rawl,1)) && (%rawlen > 0) {
      if ($mid($1,%rawl,1) == +) || ($mid($1,%rawl,1) == -) { var %rawmodesdone $addtok(%rawmodesdone,$replacex($mid($1,%rawl,1),+,-,-,+),0) }

      while ($mid($1,%rawl,1)) && ($mid($1,%rawl,1) != +) && ($mid($1,%rawl,1) != -) {
        if ($calc($count($1,$mid($1,%rawl,1))/2) != $round($count($1,$mid($1,- $+ %rawl,1))/2),0)) && ($mid($1,%rawl,1) !isin %rawmodesdone) {
          var %rawmodesdone $addtok(%rawmodesdone,$mid($1,%rawl,1),0)
          inc %rawl
          dec %rawlen
        }
      }
      inc %rawl
      dec %rawlen
    }
    if %rawmodesdone { mode # %rawmodesdone $2- }
  }
}

Comments

Sign in to comment.
FRISH   -  Oct 06, 2007

No, because my way will be less abusive ;).
Reason:

  • someone sets mode: +b-b FRISH
  • FRISH sets mode: +b FRISH
    coz it will replace +b-b too -b+b and we dont want that

thanks for your input ;)

 Respond  
Olliegod   -  Oct 06, 2007

For reversing the raw modes, couldn\'t you just take $1 and replace the - with a + and the + with a -. Seems like it would be a whole lot simpler.

 Respond  
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.