Nicklist Mute Script

By Phil_FW on Mar 08, 2011

This is a muter script that is used by right clicking on the nickname you wish to mute. the rest is obvious. It is similar to MichaelA's mute script by the way, but i did make it myself, along with help from Dean.

menu nicklist {
  [-[-Mute/Unmute-]-]
  ..[-[-MUTE $1 $+ -]-]:{
    set %Muter $1 $address($1,2) $chan
    set %Mute.Time $$?"How many minutes do you want to mute %Mute.Nick for?"
    if (%Mute.Time isnum) {
      tokenize 32 %Muter
      var %y = $calc(%Mute.time * 60)
      set %MuteMSG $$?"What do you want the mute message to be?"
      msg $chan 4,1.:[9,1 $+ $1 $+ 4,1]:. .:[4,1Your tongue has been cut off for11,1 %Mute.Time 11minutes4,1]:. .:[9,1Reason:7,1 %MUTEMSG $+ 4]: 1,8Take this as a warning8,1:
      mode $chan -vqaoh+b $1 $1 $1 $1 $1 ~q: $+ $2
      .timermute2 1 %y msg $chan 9,1 $1 .:[9,1You have been unmuted. 15,1In the future, 11,1please follow 7,1ALL 11,1the rules, 12,1and you will not be muted again4,1]:. .:[11,1The reason you were muted for is:9,1 %MuteMSG $+ 4,1]:.
      .timermute3 1 %y mode $chan +v-b $1 ~q: $+ $1
      .timermute4 1 %y notice $1 4,1If you have a higher access please type 9,1/hop4,1 or 9,1/ns update
      .timermute5 1 %y unset %Mute*
    }
    else { echo -a 4,1.:[9,1Error:11,1 You must specify a time in numbers!4,1]:. }
  }
  ..[-[-UNMUTE $1 $+ -]-]:{
    if ($me isop #) && ($1 == $gettok(%Muter,1,32)) {
      mode $chan +v-b $1 ~q: $+ $1
      msg $chan 9,1 $1 $+ , 9,1you are now unmuted. 7,1Next time be good please.
      notice $1 4,1If you have a higher access please type 9,1/hop4,1 or 9,1/ns update
      unset %Mute*
      .timermute* off
    }
    else { echo -a 4,1.:[9,1Error:11,1 There is no muted nick!4,1]:. }
  }
}

ON !*:NICK:{ 
  if ($nick == $gettok(%Muter,1,32)) {
    set %Muter $newnick $address($newnick,2) $chan 
  } 
}
ON !@*:JOIN:#:{ 
  if ($+(*,$gettok(%muter,2,32),*) iswm $wildsite) && (# == $gettok(%Muter,3,32)) {
    set %Muter $nick $address($nick,2) $chan 
    .timerdeop 1 1 check_nickop
    msg $chan 9,1 $nick $+ , 11,1Do not try that, it will not work.
  }
}

on !@*:RAWMODE:#:{
  if ($regex($1,/(a|v|o|h|q)/iS)) && ($2 == $gettok(%Muter,1,32)) && (# == $gettok(%Muter,3,32)) {
    mode $chan - $+ $regml(1) $2-
  }
}

alias check_nickop { 
  tokenize 32 %Muter
  mode $gettok(%Muter,3,32) -qaohv $1 $1 $1 $1 $1
}

Comments

Sign in to comment.
_Dean_   -  Mar 08, 2011

yes, now i understood what you mean dude

 Respond  
FordLawnmower   -  Mar 08, 2011

Of course it works if you +v or +vh
But it doesn't work if you +h, +o, +a,+q, etc, etc etc.
Example::
mode #channel +vo mutenick mutenick
The script will respond with:
mode #channel -vhoaq mutenick mutenick
Which translates to:
mode #channel -vh mutenick mutenick
Leaving mutenick with +o

 Respond  
_Dean_   -  Mar 08, 2011

its strange
i tested here and works fine

[00:59:14] Dean sets mode: +v Jack|Sparrow
[00:59:15]
Botname sets mode: -v Jack|Sparrow
[00:59:22] Dean sets mode: +vh Jack|Sparrow Jack|Sparrow
[00:59:22]
Botname sets mode: -vh Jack|Sparrow Jack|Sparrow
[01:00:11] Dean sets mode: +vhaoq Jack|Sparrow Jack|Sparrow Jack|Sparrow Jack|Sparrow Jack|Sparrow
[01:00:11]
Botname sets mode: -vhoaq Jack|Sparrow Jack|Sparrow Jack|Sparrow Jack|Sparrow Jack|Sparrow

the $regsubex loop and the while loop, will return nicks as "-vhoaq mutenick mutenick mutenick mutenick mutenick"
as you saw will create a temporary var with the nicks
so it will remove all modes

From my experience, -vhoaq mutenick only attempts to remove +v.

 Respond  
FordLawnmower   -  Mar 08, 2011

Both of those will fail on +h mutenick, +o mutenick, +a mutenick, +q mutenick and about 20 other combinations.
From my experience, -vhoaq mutenick only attempts to remove +v.
As you mentioned, $str() would work, but this is still relying on the server to sort modes for you. Same way I used to do it, btw :)

 Respond  
_Dean_   -  Mar 08, 2011

a fast solution for the rawmode its use a while loop to remove all modes

on !@*:rawmode:#:{
  if $regex($1,/(v|h|o|a|q)/) && (# == $gettok(%Muter,3,32)) {
    var %x = 1, %y 
    while ($mode(%x)) { 
      if ($gettok(%Muter,1,32) == $mode(%x)) { %y = %y $+ $chr(32) $mode(%x) }
      inc %x
    }
    mode # -vhoaq %y
  }
}

the demode needs to be in this order "-vhoaq" cause if you dont have sufficient status and it starts on the -q, the while condition will stop on it

Phil in one of your edits, i said that you can use the $str

 mode $chan -vqaoh+b $str($1,5)

the $regsubex version for the while loop is

on !@*:rawmode:#:{
  if $regex($1,/(v|h|o|a|q)/) && (# == $gettok(%Muter,3,32)) {
    mode # -vhoaq $regsubex($str($chr(32),$mode(0)),//g,$iif($mode(\n) == $gettok(%Muter,1,32), $mode(\n)))
  }
}
 Respond  
FordLawnmower   -  Mar 08, 2011

You should work on the rawmode portion. It only works for the first match. If someone does +hv nick nick, It will only remove the h and leave the v. It will also return the entire param list. ie. mode #channel -h nick nick. The server will correct this for you, but it is a waste of server resources.

You could improve this more by adding an On unban event and editing it so you can mute multiple people at once.

You also don't need the On nick event at all since it only does one nick at a time.
You can just use :

$ialchan($gettok(%Muter,2,32),$gettok(%Muter,3,32),1).nick

To get the nickname.
If they have a clone in the channel they will be having fun with your script anyway.
Working code though :)

 Respond  
napa182   -  Mar 08, 2011

you could also use +b ~n: to keep the person from changing nicks instead of the on nick event. if the server allows it.

 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.