;MuteBanEnforce by Ford_Lawnmower irc.GeekShed.net #Script-Help
menu nicklist {
-
.Mute
..$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"
...Set Time: {
var %length $$?="Length of ban in minutes"
mute $$1 $calc(%length * 60) $$?="Reason for Muting $$1"
}
}
alias -l mute {
var %nick $$1
if (%nick ison $chan) && ($regex($nick(#,$me).pnick,/[~&!@%]/)) {
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: $iif($3-,$3-,Intolerable Behavior!)
}
else msg $chan %nick You have been Muted! $+(Reason:,$iif($2-,$2-,Intolerable Behavior!))
}
else echo -a Error: Either %nick is not on $chan or you do not have the correct privileges to use the mute command.
}
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
}
;Syntax /m Nick TimeinMinutes Reason
alias m mute $$1 $iif($2 isnum,$calc($2 * 60),180 $2) $3-
Also, 6.14 doesn't recognize the identifier $v1, so you have to change it to $ifmatch everywhere in the script. There may be other needed adjustments to be made if you can't upgrade for any reason. You're better off to do what ford suggested if you don't have enough know-how to modify the code to meet the compatibility.
6.14 is over 7 years old Alco`. If you want to load new scripts then you will need to use a newer version of mirc.exe.
I would suggest trying 6.35. 7.x may have some conflicts with your "god" scripts.
You can find other versions of mIRC here: http://www.oldapps.com/mirc.php
To use this code you will need at least 6.21.
Keep in mind, that only mIRC.exe needs to be replaced in your current mirc directory but you will have to run the mirc setup to get the file.
@CrazyShady As with all scripts that use a users hostmask to set a ban, this script uses your ial to get the address.
In case your ial contains no data for a user you are trying to ban, this script will do a /who username to refresh your ial.
If your ial still doesn't return any data for the user in question, the script WILL, as a fail safe, use the nickname instead of the hostmask.
This is probably what happened. It's not a flaw in the script but rather a problem with your ial not staying up to date. This could happen if you have extreme lag causing your ial to be updated on a delayed basis.
If you are having problems with this that are unrelated to lag, please let me know. A small piece of code can fix this problem and make sure your ial stays up to date.
That's not really parsing it if you have to parse it first.
Jethro_ Said:
You merely need to specify one +b or -b to have all the strings prefixed with a channel mode.
Half of the goal of my parsemode alias is to pair the mode up with the nick or address it is being applied to.
I'm sure there are a lot of other ways to parse the rawmodes but your alias doesn't get it done.
The idea is to parse the rawmodes , just as they are returned from the event..
From your example:
//echo -a $parsemode(+b this that theother)
This should have been::
//echo -a $parsemode(+bbb this that theother)
With your code this would return::
+bbbthis +bbbthat +bbbtheother
I don't think that output would serve any purpose here.
Thanks for the comment. It just reminds me of what a headache it is to parse rawmodes properly.
Ford, I believe you can do it as such:
alias parsemode {
noop $regex($1,/(?!\54)([+-][ $+ $chanmodes $+ ])/)
return $gettok($regsubex($1,/(\S+)/g,$+($regml(1),\1)),2-,32)
}
You merely need to specify one +b or -b to have all the strings prefixed with a channel mode.> //echo -a $parsemode(+b this that theother)will return > +bthis +bthat +btheother
Thanks Dean :)
Thanks Jethro_ :)
A large section of this script is the alias parsemode, which is used to determine which modes are actually changed.
If you remove the -l from this alias you can see what it does and why it's needed.
//echo -a $parsemode(+bbb this that theother)
Will return::
+bthat +btheother +bthis
While
//echo -a $parsemode(+b-b+b this this this)
Will only return The mode that actually changed::
+bthis
//echo -a $parsemode(+b-b+b-b this this this this)
Will return nothing, since nothing actually changed.
Boring , I know. But it's needed to prevent someone from tricking you into removing your own ban. It also helps prevent you from being flooded off the server for reversing modes that were never actually changed.
By the way. This version of parsemode, only parses qaohvb, as these were the only ones required by this script.
Thanks for the comments :)