Here is a idiot proof Op / Voice script.
Set the %1 and %2 just for opening and closeing the text.
I use the following:
%1 = -[
%2 = ]-
It has the following commands:
!op/!deop
!op/!deop .... ect
!op/!deop all
!voice/!devoice
!voice/!devoice ... ect
!voice/!devoice all
!aop/!remaop
!aop/!remaop
!avoice/!remav
!avoice/!remav
Pritty much does anything, I was too lazy to add 'Multiple' nicks to the auto options :p
Enjoy.
on 1:TEXT:!*:#:{
if ($nick isop $chan) {
if ($me !isop $chan) { .notice $nick %1 I am not an operator in this channel. %2 }
else {
if ($1 == !op) {
if (!$2) { .notice $nick %1 You must provide someone to Op. %2 }
elseif ($2 == all) {
.var %a 1
while (%a <= $nick($chan,0)) {
if ($nick($chan,%a) == $me) { .inc %a 1 }
elseif ($nick($chan,%a) isop $chan) { .inc %a 1 }
else {
.set %mass $addtok(%mass,$nick($chan,%a),32)
.inc %a 1
}
}
.mode $chan + $+ $str(o,$numtok(%mass,32)) %mass
.unset %mass
}
elseif ($3) {
.var %y 2
while (%y <= $0) {
if ($ [ $+ [ %y ] ] !ison $chan) { .set %no $addtok(%no,$ [ $+ [ %y ] ],44) }
else { .set %yes $addtok(%yes,$ [ $+ [ %y ] ],32) }
.inc %y
}
if (%yes) {
.mode $chan + $+ $str(o,$numtok(%yes,32)) %yes
.unset %yes
}
if (%no) {
.msg $chan %1 %no is not on this channel %2
.unset %no
}
}
elseif ($2 !ison $chan) { .notice $nick %1 $2 currently isnt on this channel. %2 }
else { .mode $chan +o $2 }
}
elseif ($1 == !deop) || ($1 == !dop) {
if (!$2) { .notice $nick %1 You must provide someone to De-Op. %2 }
elseif ($2 == all) {
.var %a 1
while (%a <= $nick($chan,0)) {
if ($nick($chan,%a) == $me) { .inc %a 1 }
elseif ($nick($chan,%a) !isop $chan) { .inc %a 1 }
else {
.set %mass $addtok(%mass,$nick($chan,%a),32)
.inc %a 1
}
}
.mode $chan - $+ $str(o,$numtok(%mass,32)) %mass
.unset %mass
}
elseif ($3) {
.var %y 2
while (%y <= $0) {
if ($ [ $+ [ %y ] ] !ison $chan) { .set %no $addtok(%no,$ [ $+ [ %y ] ],44) }
else { .set %yes $addtok(%yes,$ [ $+ [ %y ] ],32) }
.inc %y
}
if (%yes) {
.mode $chan - $+ $str(o,$numtok(%yes,32)) %yes
.unset %yes
}
if (%no) {
.msg $chan %1 %no is not on this channel %2
.unset %no
}
}
elseif ($2 !ison $chan) { .notice $nick %1 $2 currently isnt on this channel. %2 }
else { .mode $chan -o $2 }
}
elseif ($1 == !voice) || ($1 == !v) {
if (!$2) { .notice $nick %1 You must provide someone to Voice. %2 }
elseif ($2 == all) {
.var %a 1
while (%a <= $nick($chan,0)) {
if ($nick($chan,%a) == $me) { .inc %a 1 }
elseif ($nick($chan,%a) isvoice $chan) { .inc %a 1 }
else {
.set %mass $addtok(%mass,$nick($chan,%a),32)
.inc %a 1
}
}
.mode $chan + $+ $str(v,$numtok(%mass,32)) %mass
.unset %mass
}
elseif ($3) {
.var %y 2
while (%y <= $0) {
if ($ [ $+ [ %y ] ] !ison $chan) { .set %no $addtok(%no,$ [ $+ [ %y ] ],44) }
else { .set %yes $addtok(%yes,$ [ $+ [ %y ] ],32) }
.inc %y
}
if (%yes) {
.mode $chan + $+ $str(v,$numtok(%yes,32)) %yes
.unset %yes
}
if (%no) {
.msg $chan %1 %no is not on this channel %2
.unset %no
}
}
elseif ($2 !ison $chan) { .notice $nick %1 $2 currently isnt on this channel. %2 }
else { .mode $chan +v $2 }
}
elseif ($1 == !devoice) || ($1 == !dev) || ($1 == !dv) {
if (!$2) { .notice $nick %1 You must provide someone to De-Voice. %2 }
elseif ($2 == all) {
.var %a 1
while (%a <= $nick($chan,0)) {
if ($nick($chan,%a) == $me) { .inc %a 1 }
elseif ($nick($chan,%a) !isvoice $chan) { .inc %a 1 }
else {
.set %mass $addtok(%mass,$nick($chan,%a),32)
.inc %a 1
}
}
.mode $chan - $+ $str(v,$numtok(%mass,32)) %mass
.unset %mass
}
elseif ($3) {
.var %y 2
while (%y <= $0) {
if ($ [ $+ [ %y ] ] !ison $chan) { .set %no $addtok(%no,$ [ $+ [ %y ] ],44) }
else { .set %yes $addtok(%yes,$ [ $+ [ %y ] ],32) }
.inc %y
}
if (%yes) {
.mode $chan - $+ $str(v,$numtok(%yes,32)) %yes
.unset %yes
}
if (%no) {
.msg $chan %1 %no is not on this channel %2
.unset %no
}
}
elseif ($2 !ison $chan) { .notice $nick %1 $2 currently isnt on this channel. %2 }
else { .mode $chan -v $2 }
}
elseif ($1 == !aop) {
if (!$2) { .notice $nick %1 You must provide someone to Auto-Op... Or !aop all %2 }
elseif ($2 == all) {
.writeini chanstats.ini aop all Yes
.msg $chan %1 Everyone Will Now Get Auto-Op When They Join %2
}
elseif ($chr(64) isin $2) {
.writeini chanstats.ini aop $mask($2,2) yes
.msg $chan %1 ( $+ $mask($2,2) $+ ) has been added to the Auto-Op list. %2
}
elseif ($2 !ison $chan) { .notice $nick %1 $2 currently isnt on this channel. %2 }
elseif ($2 == $me) { .notice $nick %1 I cannot Auto-Op myself %2 }
elseif ($readini(chanstats.ini, aop, $address($2,2))) { .msg $chan %1 $2 Already Gets Auto-Op From Me. %2 }
else {
.writeini chanstats.ini aop $address($2,2) Yes
.mode $chan +o $2
.msg $chan %1 $2 $+ ( $+ $address($2,2) $+ ) has been ADDED to the Auto-Op list. %2
}
}
elseif ($1 == !remaop) {
if (!$2) { .notice $nick %1 You must provide someone to Remove Auto-Op from... Or !remaop all %2 }
elseif ($2 == all) {
.remini chanstats.ini aop all
.msg $chan %1 Only people added previously will now get Auto-Op. %2
}
elseif ($chr(64) isin $2) {
if (!$readini(chanstats.ini, aop, $mask($2,2))) { .notice $nick %1 Cannot match ( $+ $2 $+ ) with anyone on the Auto-Op list. %2 }
else {
.remini chanstats.ini aop $mask($2,2)
.msg $chan %1 ( $+ $mask($2,2) $+ ) has been removed from the Auto-Op list. %2
}
}
elseif ($2 !ison $chan) { .notice $nick %1 $2 currently isnt on this channel. Try using !remaop nick!khaled@mirc.com %2 }
elseif ($2 == $me) { .notice $nick %1 Im not on the Auto-Op list %2 }
elseif (!$readini(chanstats.ini, aop, $address($2,2))) { .msg $chan %1 Cannot find $2 on the Auto-Op list. %2 }
else {
.remini chanstats.ini aop $address($2,2)
.mode $chan -o $2
.msg $chan %1 $2 $+ ( $+ $address($2,2) $+ ) has been REMOVED from the Auto-Op List. %2
}
}
elseif ($1 == !avoice) || ($1 == !av) {
if (!$2) { .notice $nick %1 You must provide someone to Auto-Voice... Or !avoice all %2 }
elseif ($2 == all) {
.writeini chanstats.ini avoice all Yes
.msg $chan %1 Everyone Will Now Get Auto-Voice When They Join %2
}
elseif ($chr(64) isin $2) {
.writeini chanstats.ini avoice $mask($2,2) yes
.msg $chan %1 ( $+ $mask($2,2) $+ ) has been added to the Auto-Voice list. %2
}
elseif ($2 !ison $chan) { .notice $nick %1 $2 currently isnt on this channel. %2 }
elseif ($2 == $me) { .notice $nick %1 I cannot Auto-Voice myself %2 }
elseif ($readini(chanstats.ini, avoice, $address($2,2))) { .msg $chan %1 $2 Already Gets Auto-Voice From Me. %2 }
else {
.writeini chanstats.ini avoice $address($2,2) Yes
.mode $chan +v $2
.msg $chan %1 $2 $+ ( $+ $address($2,2) $+ ) has been ADDED to the Auto-Voice list. %2
}
}
elseif ($1 == !remavoice) || ($1 == !remav) {
if (!$2) { .notice $nick %1 You must provide someone to Remove Auto-Voice from... Or !remavoice all %2 }
elseif ($2 == all) {
.remini chanstats.ini avoice all
.msg $chan %1 Only people added previously will now get Auto-Voice. %2
}
elseif ($chr(64) isin $2) {
if (!$readini(chanstats.ini, avoice, $mask($2,2))) { .notice $nick %1 Cannot match ( $+ $2 $+ ) with anyone on the Auto-Voice list. %2 }
else {
.remini chanstats.ini avoice $mask($2,2)
.msg $chan %1 ( $+ $mask($2,2) $+ ) has been removed from the Auto-voice list. %2
}
}
elseif ($2 !ison $chan) { .notice $nick %1 $2 currently isnt on this channel. Try using !remavoice nick!khaled@mirc.com %2 }
elseif ($2 == $me) { .notice $nick %1 Im not on the Auto-Voice list %2 }
elseif (!$readini(chanstats.ini, avoice, $address($2,2))) { .msg $chan %1 Cannot find $2 on the Auto-Voice list. %2 }
else {
.remini chanstats.ini avoice $address($2,2)
.mode $chan -v $2
.msg $chan %1 $2 $+ ( $+ $address($2,2) $+ ) has been REMOVED from the Auto-Voice List. %2
}
}
}
}
}
on 1:JOIN:#: {
if ($nick != $me) $$ ($me isop $chan) {
if ($readini(chanstats.ini, aop, all)) && ($readini(chanstats.ini, avoice, all)) { .mode $chan +vo $nick $nick }
elseif ($readini(chanstats.ini, aop, all)) && ($readini(chanstats.ini, avoice, $address($nick,2))) { .mode $chan +vo $nick $nick }
elseif ($readini(chanstats.ini, aop, all)) { .mode $chan +o $nick }
elseif ($readini(chanstats.ini, avoice, all)) && ($readini(chanstats.ini, aop, $address($nick,2))) { .mode $chan +vo $nick $nick }
elseif ($readini(chanstats.ini, avoice, all)) { .mode $chan +v $nick }
elseif ($readini(chanstats.ini, aop, $address($nick,2))) && ($readini(chanstats.ini, avoice, $address($nick,2))) { .mode $chan +vo $nick $nick }
elseif ($readini(chanstats.ini, aop, $address($nick,2))) { .mode $chan +o $nick }
elseif ($readini(chanstats.ini, avoice, $address($nick,2))) { .mode $chan +v $nick }
}
}
The only problem that I can see in regards to this not functioning, is if the number of nicks being processed, using the all option for $2, is greater than the allowed number of mode changes as specified using $modespl.
It is extensive, and might be able to be shortened, but that would only affect the running time, not the running ability.