SB5 Op Level Module

By Tamaki on Aug 17, 2010

This is the oplvl module for Staff Bot 5. It supports the following commands:
!voice
!halfop
!op
!protect
!owner
!devoice
!dehalfop
!deop
!deprotect
!deowner
Use the command by itself to change your op level, or with other nicks to change their level (there are no limits the amount of nicks you can add on to the end of this command).

Voice can be changed by level 10 users.
Halfop can be changed by level 100 users.
Op can be changed by level 300 users.
Protect can be changed by level 500 users.
Owner can be changed by level 700 and 999 users.

To install, simply load in to your remotes after you have installed Staff Bot 5.

ALPHA v.1.0.0.0 - Initial Release

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;Staff Bot 5 Module;;;;;
;;;;;Op Level Commands.m;;;;;
;;;;;;;;;CAC: oplvl;;;;;;;;;;
;;;;;;;;;;v.1.0.0.0;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

on *:LOAD: {
  writeini sboti.ini oplvl title Op Level Commands
  writeini sboti.ini oplvl description Operator commands such as !op and !devoice
  writeini sboti.ini oplvl updateable yes
  writeini sboti.ini oplvl version 1.0.0.0
  If ($readini(sbot.ini,settings,install_on_load) == on) {
    install oplvl
    install_oplvl
    halt
  }
  echo -a To install this module, simply type /install oplvl
}

on *:UNLOAD: {
  oplvl uninstall
}

alias install_oplvl {
  If ($dialog(install) != install) { dialog -dmv install install }
  If ($readini(oplvl.ini,status,installed) == yes) {
    did -a install 11 Already Installed!
  }
  Else {
    oplvl install
  }
}

alias oplvl {
  If ($1 == install) {
    If ($dialog(install) != install) { dialog -dmv install install }
    did -b install 8,9
    did -a install 11 Installing...
    writeini sboti.ini oplvl title Op Level Commands
    writeini sboti.ini oplvl description Operator commands such as !op and !devoice
    writeini sboti.ini oplvl updateable yes
    writeini sboti.ini oplvl version 1.0.0.0
    writeini oplvl.ini status installed yes
    writeini sboti.ini status modules $calc($readini(sboti.ini,status,modules) + 1)
    writeini sbot.ini status modules $calc($readini(sbot.ini,status,modules) + 1)
    write modules.txt oplvl
    did -a install 11 Complete!
    did -v install 13
    halt
  }
  If ($1 == uninstall) {
    .remove oplvl.ini
    remini sboti.ini oplvl
    write -ds $+ oplvl modules.txt
    writeini sboti.ini status modules $calc($readini(sboti.ini,status,modules) - 1)
    writeini sbot.ini status modules $calc($readini(sbot.ini,status,modules) - 1)
  }
  If ($1 == voice) {
    If ($numtok($3-,32) > 1) {
      mode $2 + $+ $str(v, $numtok($3-,32)) $3-
    }
    Else {
      mode $2 +v $3-
    }
  }
  If ($1 == devoice) {
    If ($numtok($3-,32) > 1) {
      mode $2 - $+ $str(v, $numtok($3-,32)) $3-
    }
    Else {
      mode $2 -v $3-
    }
  }
  If ($1 == halfop) {
    If ($numtok($3-,32) > 1) {
      mode $2 + $+ $str(h, $numtok($3-,32)) $3-
    }
    Else {
      mode $2 +h $3-
    }
  }
  If ($1 == dehalfop) {
    If ($numtok($3-,32) > 1) {
      mode $2 - $+ $str(h, $numtok($3-,32)) $3-
    }
    Else {
      mode $2 -h $3-
    }
  }
  If ($1 == op) {
    If ($numtok($3-,32) > 1) {
      mode $2 + $+ $str(o, $numtok($3-,32)) $3-
    }
    Else {
      mode $2 +o $3-
    }
  }
  If ($1 == deop) {
    If ($numtok($3-,32) > 1) {
      mode $2 - $+ $str(o, $numtok($3-,32)) $3-
    }
    Else {
      mode $2 -o $3-
    }
  }
  If ($1 == protect) {
    If ($numtok($3-,32) > 1) {
      mode $2 + $+ $str(a, $numtok($3-,32)) $3-
    }
    Else {
      mode $2 +a $3-
    }
  }
  If ($1 == deprotect) {
    If ($numtok($3-,32) > 1) {
      mode $2 - $+ $str(a, $numtok($3-,32)) $3-
    }
    Else {
      mode $2 -a $3-
    }
  }
  If ($1 == owner) {
    If ($numtok($3-,32) > 1) {
      mode $2 + $+ $str(q, $numtok($3-,32)) $3-
    }
    Else {
      mode $2 +q $3-
    }
  }
  If ($1 == deowner) {
    If ($numtok($3-,32) > 1) {
      mode $2 - $+ $str(q, $numtok($3-,32)) $3-
    }
    Else {
      mode $2 -q $3-
    }
  }
}

on 100:TEXT:!*voice*:#: {
  If ($readini(sbot.ini,status,installed) != yes) { halt }
  If ($readini(oplvl.ini,status,installed) != yes) { halt }
  If ($1 == !voice) {
    If ($2 == $null) {
      oplvl voice # $nick
    }
    Else {
      oplvl voice # $2-
    }
  }
  If ($1 == !devoice) {
    If ($2 == $null) {
      oplvl devoice # $nick
    }
    Else {
      oplvl devoice # $2-
    }
  }
}

on 300:TEXT:!*halfop*:#: {
  If ($readini(sbot.ini,status,installed) != yes) { halt }
  If ($readini(oplvl.ini,status,installed) != yes) { halt }
  If ($1 == !halfop) {
    If ($2 == $null) {
      oplvl halfop # $nick
    }
    Else {
      oplvl halfop # $2-
    }
  }
  If ($1 == !dehalfop) {
    If ($2 == $null) {
      oplvl dehalfop # $nick
    }
    Else {
      oplvl dehalfop # $2-
    }
  }
}

on 500:TEXT:!op*:#: {
  If ($readini(sbot.ini,status,installed) != yes) { halt }
  If ($readini(oplvl.ini,status,installed) != yes) { halt }
  If ($2 == $null) {
    oplvl op # $nick
  }
  Else {
    oplvl op # $2-
  }
}

on 500:TEXT:!deop*:#: {
  If ($readini(sbot.ini,status,installed) != yes) { halt }
  If ($readini(oplvl.ini,status,installed) != yes) { halt }
  If ($2 == $null) {
    oplvl deop # $nick
  }
  Else {
    oplvl deop # $2-
  }
}

on 700:TEXT:!*protect*:#: {
  If ($readini(sbot.ini,status,installed) != yes) { halt }
  If ($readini(oplvl.ini,status,installed) != yes) { halt }
  If ($1 == !protect) {
    If ($2 == $null) {
      oplvl protect # $nick
    }
    Else {
      oplvl protect # $2-
    }
  }
  If ($1 == !deprotect) {
    If ($2 == $null) {
      oplvl deprotect # $nick
    }
    Else {
      oplvl deprotect # $2-
    }
  }
}

on 999:TEXT:!*owner*:#: {
  If ($readini(sbot.ini,status,installed) != yes) { halt }
  If ($readini(oplvl.ini,status,installed) != yes) { halt }
  If ($1 == !owner) {
    If ($2 == $null) {
      oplvl owner # $nick
    }
    Else {
      oplvl owner # $2-
    }
  }
  If ($1 == !deowner) {
    If ($2 == $null) {
      oplvl deowner # $nick
    }
    Else {
      oplvl deowner # $2-
    }
  }
}

dialog oplvl {
  title Op Level Commands Module
  option dbu
  size -1 -1 101 32
  text "There are no options for this module.", 1, 1 1 100 20
  button "OK", 2, 1 21 100 10, ok
}

on *:UNLOAD: {
  oplvl uninstall
}

Comments

Sign in to comment.
Tamaki   -  Apr 18, 2011

btw, i figured out what you were talking about and i've fixed it in Staff Bot 6 (which can be found here: http://www.hawkee.com/scripts/11648798/ ). this module will not be updated to the most current version of AGFile.

 Respond  
Tamaki   -  Aug 18, 2010

now, i think i've seen something like this before, but it would always do something like this:

someone sets mode: +vvvvvvvvvvvv nick1 nick2 nick3 nick4 nick5 nick6 nick7 nick8 nick9 nick10 nick11 nick12
someone sets mode: +vvv nick13 nick14 nick15

 Respond  
Meta   -  Aug 17, 2010

$modespl is the maximum amount of modes that can be set on one line at a time. So in your case, if you try to set modes on 13 people, it would at most only set the mode on the first 12.

 Respond  
Tamaki   -  Aug 17, 2010

yeah, but is it anything that is actually going to make the thing stop working?

 Respond  
Tamaki   -  Aug 17, 2010

i'm not too sure what this means for me, my $modespl is 12 and i've ran a few tests and they've all worked just fine :(

 Respond  
napa182   -  Aug 17, 2010

maybe you should look into using $modespl in ur mode settings
the code it's self has a lot of redundancy in it.
also this

 oplvl deprotect # $nick
    }
    Else {
      oplvl deprotect # $2-

can be

oplvl deprotect # $iif(!$2,$nick,$2-)

and so on

 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.