Page 1 of 1

mIRC MuteBan with enforce.

PostPosted: Tue Jan 04, 2011 1:25 am
by Ford
This script performs a very simple but needed function. It will place a mute ban on the selected user, remove all modes (ie. qaohv) and then it will reverse any mode changes that effect the ban.
Image
Image
To use this code:
Paste to a new remote.
Save with a unique filename.
Right click a nick from the nicklist and select the level of ban from the list.
Most of the bans on the popups are timed but you can click the user and select RemoveMute to end the ban early.

Any problems or questions: I can be found in #Script-Help
Code: Select all
;MuteBanEnforce by Ford_Lawnmower irc.GeekShed.net #Script-Help
menu nicklist {
  .$iif(!$hget(MuteEnforce,$+($network,$chan,$address($$1,2))),$style(2)) RemoveMute $$1: {
    var %mask $+($network,$chan,$address($$1,2))
    hdel MuteEnforce %mask
    if ($timer(%mask).com) {
      $v1
      .notice $$1 Your ban has been lifted early! You may now speak in $+($chan,.) Please try not to repeat the same activity that caused you to be muted.
      $+(.timer,%mask) off
    }
    else mode $chan -b $+(~q:,$address($$1,2))
  }
  .Mute $$1
  ..3 Minutes:mute $$1 180 $$?="Reason for Muting $$1"
  ..5 Minutes:mute $$1 300 $$?="Reason for Muting $$1"
  ..10 Minutes:mute $$1 600 $$?="Reason for Muting $$1"
  ..30 Minutes:mute $$1 1800 $$?="Reason for Muting $$1"
  ..60 Minutes:mute $$1 3600 $$?="Reason for Muting $$1"
  ..Forever:mute $$1 $$?="Reason for Muting $$1"
}
alias mute {
  clipboard $$1
  var %nick $cb(1)
  if (%nick ison $chan) {
    ialcheck %nick
    var %usermodes $replace($remove($nick(#,%nick).pnick,%nick),~,q,&,a,!,a,@,o,%,h,+,v), %addy $iif($address(%nick,2),$v1,%nick)
    mode $chan $+(+b-,%usermodes) $+(~q:,%addy) $str($+(%nick,$chr(32)),$len(%usermodes))
    hadd -m MuteEnforce $+($network,$chan,%addy) mute
    if ($$2 isnum) {
      $+(.timer,$network,$chan,%addy) 1 $$2 removeMute $+($network,$chan,%addy) $chan $+(-b+,%usermodes) $+(~q:,%addy) $str($+(%nick,$chr(32)),$len(%usermodes))
      msg $chan $+(,%nick,) You have been Muted! Duration: $duration($2) Reason: $3-
    }
    else msg $chan %nick You have been Muted! $+(Reason:,$2-)
  }
  else echo -a %nick is not on $chan
}
alias -l ialcheck {
  if (!$ial($1)) .who $1
}
alias -l removeMute {
  if ($($+($,$0),2) !ison $2) mode $2 -b $4
  else mode $2-
  hdel MuteEnforce $1
}
alias -l parseMode {
  tokenize 32 $1
  var %start 1, %finish $len($1), %+-, %modes -1, %location $+(parseMode,$chr(3),$network,$chr(3),$chan)
  while (%start <= %finish) {
    if ($mid($1,%start,1) isin +-) { %+- = $replace($v1,+,1,-,-1) | inc %modes }
    elseif ($mid($1,%start,1) isin qaohvb) {
      var %mode $+($v1,$($+($,$calc(%start - %modes)),2))
      hadd -m %location %mode $calc($hget(%location,%mode) + %+-)
    }
    inc %start
  }
  var %hash $regsubex($regsubex($str(.,$hget(%location,0).item),/(.)/g,$+($hget(%location,\n).data,$hget(%location,\n).item,$chr(32))),/(\b0[^\s]*)/g,)
  if ($hget(%location)) hfree $v1
  var %count 1, %max $numtok(%hash,32), %return, %temp
  while (%count <= %max) {
    %temp = $gettok(%hash,%count,32)
    %return = $+(%return,$chr(32),$iif($left(%temp,1) == -,$+(-,$mid(%temp,3)),$+(+,$mid(%temp,2))))
    inc %count
  }
  return %return
}
On !*:rawmode:#: {
  checkMutes $network $chan $parsemode($1-)
}
alias -l checkMutes {
  var %network $1, %chan $2, %modes $3-
  tokenize 32 %modes
  checkMute %network %chan $*
}
alias -l checkMute {
  var %mode $left($3,2), %target $mid($3,3)
  if ((%mode isincs +v+h+o+a+q) && ($hget(MuteEnforce,$+($1,$2,$address(%target,2))))) mode $2 $replace(%mode,+,-) %target
  elseif ((%mode == -b) && ($hget(MuteEnforce,$+($1,$2,$gettok(%target,-1,58))))) mode $chan +b %target
}

Re: mIRC MuteBan with enforce.

PostPosted: Wed Jan 26, 2011 12:02 am
by Callumlord
Nice, Thanks:

Suggestion:

Have a custom secton to type own time.

Callum