Bot Auto voice snippet

By GrimReaper on Jun 14, 2010

This is a script I decided to make as I was bored,

It's a basic VOP system as one of the network's I am on doesn't have BotServ and the way the service's are I can't grasp, so I made my own one.

All you need to do is replace YOURNICK with your nick, then you can add channels for it to work in.

Syntax for adding channels:

.avoice add #channel
.avoice del #channel
.avoice list

Syntax for the VOP list:

.vop add nick
.vop del nick
.vop list
.vop sync (Sync's the vop list for said channel)

on *:JOIN:$(%Autovoicechans. [ $+ [ $network ] ]): {
  if ($istok(%Autovoice. [ $+ [ $chan ] ],$nick,44)) {
    if ($me isop $chan) || ($me ishop $chan) {
      mode $chan +v $nick
    }
    else {
      msg $chan * Error: Insufficient access within the channel to assign modes.
    }
  }
}

on *:TEXT:.Avoice*:#: {
  if ($nick == YOURNICKHERE) {
    if (!$2) { msg $chan * Error: Correct syntax: .avoice <add/del> <channel> }
    elseif ($2 == add) {
      if (!$3) { msg $chan * Error: Correct syntax: .avoice add <channel> }
      elseif ($istok(%Autovoicechans. [ $+ [ $network ] ],$3,44)) {
        msg $chan * Error: $3 is currently on the AutoVoice channel list.
      }
      else {
        set %Autovoicechans. [ $+ [ $network ] ] $addtok(%Autovoicechans. [ $+ [ $network ] ],$3,44)
        msg $chan Added $+($chr(34),$3,$chr(34)) to the AutoVoice channel list.
      }
    }
    elseif ($2 == del) {
      if (!$3) { msg $chan * Error: Correct syntax: .avoice del <channel> }
      elseif (!$istok(%Autovoicechans. [ $+ [ $network ] ],$3,44)) {
        msg $chan * Error: $3 is not on the AutoVoice channel list.
      }
      else {
        set %Autovoicechans. [ $+ [ $network ] ] $remtok(%Autovoicechans. [ $+ [ $network ] ],$3,44)
        msg $chan Deleted $+($chr(34),$3,$chr(34)) from the AutoVoice channel list.
      }
    }
    elseif ($2 = list) {
      msg $chan $iif(%Autovoicechans. [ $+ [ $network ] ] == $null,No current channels set.,Current AutoVoice channels $+ $chr(58) $replace(%Autovoicechans. [ $+ [ $network ] ],$chr(44),$chr(44) $+ $chr(32)))
    }
  }
  else {
    msg $chan Sorry $nick $+ , You aren't allowed to add channel's to the AutoVoice list.
  }
}

on *:TEXT:.vop*:#: {
  if ($istok(%Autovoicechans. [ $+ [ $network ] ],$chan,44)) {
    if ($nick isop $chan) {
      if (!$istok(%Autovoicechans. [ $+ [ $network ] ],$chan,44)) { msg $chan Sorry $nick $+ , I am not assigned to AutoVoice in $chan $+ . }
      elseif (!$2) { msg $chan *Error: Correct syntax: !vop <add/del> <nick> }
      else {
        if ($2 == Add) {
          if (!$3) { msg $chan *Error: Correct syntax: .vop <add> <nick> }
          elseif ($istok(%Autovoice. [ $+ [ $chan ] ],$3,44)) {
            msg $chan * Error: $3 is already on the VOP list.
          }
          else {
            set %AutoSync. [ $+ [ $chan ] ] $calc(%AutoSync. [ $+ [ $chan ] ] + 1)
            set %Autovoice. [ $+ [ $chan ] ] $addtok(%Autovoice. [ $+ [ $chan ] ],$3,44)
            msg $chan Added $+($chr(34),$3,$chr(34)) to the AutoVoice list for $chan $+ .
            mode $chan +v $3
          }
        }
        elseif ($2 == Del) {
          if (!$3) { msg $chan *Error: Correct syntax: .vop <del> <nick> }
          elseif (!$istok(%Autovoice. [ $+ [ $chan ] ],$3,44)) {
            msg $chan * Error: $3 is not on the VOP list.
          }
          else {
            set %AutoSync. [ $+ [ $chan ] ] $calc(%AutoSync. [ $+ [ $chan ] ] - 1)
            set %Autovoice. [ $+ [ $chan ] ] $remtok(%Autovoice. [ $+ [ $chan ] ],$3,44)
            msg $chan Deleted $+($chr(34),$3,$chr(34)) from the AutoVoice list for $chan $+ .
            mode $chan -v $3
          }
        }
        elseif ($2 == List) {
          notice $nick $iif(%Autovoice. [ $+ [ $chan ] ] == $null,No one on the VOP list.,Autovoice List $+ $chr(58) $replace(%Autovoice. [ $+ [ $chan ] ],$chr(44),$chr(44) $+ $chr(32)) Total: %AutoSync. [ $+ [ $chan ] ])
        }
        elseif ($2 == Sync) {
          var %AutoSync = 1
          while (%AutoSync <= %AutoSync. [ $+ [ $chan ] ]) {
            if ($gettok(%Autovoice. [ $+ [ $chan ] ],%AutoSync,44) !ison $chan) { inc %AutoSync }
            else {
              mode $chan +v $gettok(%Autovoice. [ $+ [ $chan ] ],%AutoSync,44)
              inc %AutoSync
            }
          }
        }
      }
    }
    else {
      msg $chan Sorry $nick $+ , You haven't got enough channel access to issue this command.
    }
  }
  else {
    msg $chan Sorry $nick $+ , This channel is not assigned for AutoVoice.
  }
}

Comments

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.