This is a SIMPLE massmode, though it works like it should. Maybe someone learns something from this little snippet.. making a massmode script is not that tricky you'd think it is.
How the script works then?
Here's a few examples:
AFK Putki[Tenesean] prem IF|SiLVeR
OFF gzt_That's it. Simple error preventing.
alias mass {
if ($left($1,1) !isin +-) || ($right($1,-1) != o) && ($right($1,-1) != v) { echo 2 -a * This massmode supports only op and voice (o & v). }
else {
if ($me !isop $chan) { echo 2 -a * Can not use this script: not opped on channel. }
else {
var %i = $nick($chan,0)
while (%i) {
if ($nick($chan,%i) != $me) {
if (!%mode) || ($gettok(%mode,0,32) < $modespl) { var %mode = $addtok(%mode,$nick($chan,%i),32) }
if ($gettok(%mode,0,32) == $modespl) { mode $chan $+($left($1,1),$str($remove($1,$left($1,1)),$gettok(%mode,0,32))) %mode | unset %mode }
}
dec %i
}
if (%mode) { mode $chan $+($left($1,1),$str($remove($1,$left($1,1)),$gettok(%mode,0,32))) %mode }
}
}
}
i went and researched this and i made this quick alias, if it helps at all:
alias xmass {
var %nick.count $snick($chan,0)
:Nick.Select
if (%nick.count > 0) {
if ($1 = Voice) {
mode $chan v $snick($2,%nick.count)
dec %nick.count
}
elseif ($1 = op) {
mode $chan o $snick($2,%nick.count)
dec %nick.count
}
elseif ($1 = halfop) {
mode $chan h $snick($2,%nick.count)
dec %nick.count
goto Nick.Select
}
elseif ($1 = dehalfop) {
mode $chan -h $snick($2,%nick.count)
dec %nick.count
goto Nick.Select
}
elseif ($1 = kick) {
kick $chan $snick($2,%nick.count)
dec %nick.count
}
goto Nick.Select
}
}
nice but you can also do it like this as well
alias mass {
if ($me !isop #) || (!$regex($1-,/^[+-][ov]$/)) { echo -a $iif($me !isop #,* Can not use this script: not opped on channel.,* This massmode supports only op and voice (o & v).) }
else {
var %a = $nick($chan,0), %o = 1
while (%o <= %a) {
if ($nick($chan,%o) != $me) var %m = $addtok(%m,$v1,32)
inc %o
}
mode $chan $left($1,1) $+ $str($right($1,1),$modespl) %m
}
}
if ($left($1,1) != +) && ($left($1,1) != -) || ($remove($1,$left($1,1)) != o) && ($remove($1,$left($1,1)) != v) { echo 2 -a * This massmode supports only op and voice (o & v). }
if ($left($1,1) != +) && ($left($1,1) != -) can be if ($left($1,1) !isin +-)
Also, $remove($1,$left($1,1)) can be simplified to $right($1,-1)