Try this and tell me if it works
Click to reveal..
Code:
on *:text:*:#: { if (($strip($1) == .silence) && ($2)) silence $2 }
on *:text:*:?: { if (($strip($1) == .silence) && ($left($3,1) == $chr(35))) silence $2 $3 }
alias silence { 
  var %chan $iif($2,$2,#)
  var %dest $iif($2,$2,$nick)
  var %user $1
  if ($ulevel < 500) msg %dest Access denied.
  else {
    if ($me !isop %chan) msg %dest I'm not @ on %chan
    elseif (%user !ison %chan) msg %dest Can't find %user on %chan
    else { 
      .ban %chan %user 
      .mode %chan -v %user
      .mode %chan -o %user 
    }
  }
}
Note that in private messages you're forced to enter a channelname like .silence peter #mychannel
There's no other way to tell which channel it's supposed to use other than looping through channels you have in common with the $nick and then cross-reference with if the user is on the same channel.
Ignore the code in the spoiler. Try using this instead:
Code:
on *:text:*:#: { if (($strip($1) == .silence) && ($2)) noop $silence($2).chan }
on *:text:*:?: { if (($strip($1) == .silence) && ($2)) noop $silence($2).priv }
alias silence { 
  var %chans $comchan($nick,0)
  var %dest $iif($prop == chan,#,$nick)
  var %user $1
  if ($ulevel < 500) msg %dest Access denied
  while (%chans) { 
    var %chan $comchan($nick,%chans) 
    if (%user ison %chan) { 
      if ($me !isop %chan) msg %dest Not @ on %chan
      else { 
        .ban %chan %user 
        .mode %chan -v %user
        .mode %chan -o %user 
      }
    }
    dec %chans
  }
}
Note however that this will ban anyone on all channels (you have in common with the one who wrote it) by the name "Steve" if you type .silence Steve

Last edited by Nillen; 15/11/14 05:18 PM. Reason: Made a loop through all chans

Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net