mIRC Homepage

Help with mute script

Posted By: raycomp

Help with mute script - 15/03/21 09:22 AM

I use this script in mIRC 7.55 to mute disruptive users in our channels by selecting the nick in nick list and execute from the popup list.
Script works fine as long it is left to run time down and then unmute the user. allowing him to talk in the channel again.

I have added lines at the bottom to unmute the user before the timer is run-down but is does not remove the ban. Any help will be appreciated

Feel free to use the script if you have a need for this.


menu nicklist {
..Day mute $1 $+ :{
set %Mute.Nick $1
set %Mute.Channel $chan
set %MuteMSG $$?"Reason?"
msg $chan 4.:[10 $+ %Mute.Nick $+ 4]:. .:[You are muted]:. .:[Reason is:10 %MUTEMSG $+ 4]:. Lodge complaint email to xxxx@gmail.com with reason, date and time..
mode $chan -vqaoh+b %Mute.Nick %Mute.Nick %Mute.Nick %Mute.Nick %Mute.Nick m: $+ $address(%Mute.Nick,2)
..Timed mute $1 $+ :{
set %Mute.Nick $1
set %Mute.Channel $chan
set %Mute.Time $$?"Minutes to mute %Mute.Nick ?"
if (%Mute.Time isnum) {
set %MuteMSG $$?"Reason is?"
msg $chan 4.:[10 $+ %Mute.Nick $+ 4]:. .:you are muted for 10 %Mute.Time 4minute ]:. .:[Reason is:10 %MUTEMSG $+ 4]:. Lodge complaint email to xxxx@gmail.com with reason, date and time..
.timermute1 1 $calc(%Mute.Time * 60) mode $chan -b $+ $iif(%Mute.Nick isavoice #,+v) m: $+ $address(%Mute.Nick,2) %Mute.Nick
mode $chan -vqaoh+b %Mute.Nick %Mute.Nick %Mute.Nick %Mute.Nick %Mute.Nick m: $+ $address(%Mute.Nick,2)
.timermute2 1 $calc(%Mute.Time * 60) msg $chan 10 %Mute.Nick 4.:[2You are free to talk again. In future please listen to Ops4]:. .:[2The reason was :10 %MuteMSG $+ 4]:.
.timermute3 1 $calc(%Mute.Time * 60) mode $chan -b %Mute.Nick m: $+ $address(%Mute.Nick,2)
.timermute3 1 $calc(%Mute.Time * 60) mode $chan -b %Mute.Nick m: $+ $address(%Mute.Nick,2)
.timermute5 1 $calc(%Mute.Time * 60) unset %Mute*
else { echo -a 4.:[Error:1 Please supply time in minutes!4]:. }

I need this portion to unmute the user before the specified time but the ban stays in the channel ban list as: -b m:*!*@zairc-7ss.hhv.102.212.IP and must be removed manually

..Remove mute $1 $+
if ($1 == %Mute.Nick) {
mode $chan -b %Mute.Nick m: $+ $address(%Mute.Nick,2)
msg $chan 10 %Mute.Nick $+ , 2 You were unmuted earlier. Please behave from now on. 4If you want to lodge a complaint email to xxxx@gmail.com with the reason, date and time..
unset %Mute*
timermute1 off
timermute2 off
timermute3 off
timermute4 off
timermute5 off
else { echo -a 4.:[Error:1 User was not muted!4]:. }

Thank in advance for any help/
Posted By: maroon

Re: Help with mute script - 16/03/21 03:08 PM

For 1 thing, your menu is bad. The line that looks like this:

..Remove mute $1 $+
if ($1 == %Mute.Nick) {

... is missing the :{ at the end of that 1st line. If that's not the cause of your problem, please clarify whether the script fails because %Mute.Nick does not match the user being muted. From your description, it look like you're saying that the -b shows as part of the banmask in the "channel central" you see by double-clicking in the channel.

Also an observation that this script as written only works for 1 nick at a time. If you mute someone while someone else is already muted, all the variables change to nick#2 and it doesn't work against nick#1 anymore.

While you can create global variables, that would require using compound syntax, which can be hard for you to do correctly. It's probably easier to do it from a hashtable. Assuming your table is named "mute", you could create the compound itemname without using $eval or square braces. To keep it simple, you can create an alias that creates a string like network.channel.nick from the $nick input:

alias netchannick { return $+($network,.,$chan,.,$1) }

And then you can create the hashtable variable like:

hadd -m mute $netchannick($1) $1

and then test for the value like:

if ($hget(mute,$netchannick($1)) == $1)

You'd also want to create your timers with a unique name per nick, and delete the hashtable item like:

timer5 $+ $netchannick($1) 1 $calc(%Mute.Time * 60) hdel -s mute $netchannick($1)

Some of your global variables can work just fine as local variables, which don't need to be unset. I find %mute.channel created twice but never used.
I find %MUTEMSG used only within the same instance where it was set, so you can create it using /var instead of /set and it should work the same.

You can get additional info on commands and identifiers at https://en.wikichip.org/wiki/mirc/commands
Posted By: raycomp

Re: Help with mute script - 17/03/21 02:35 PM

Thank you Maroon for the advice got it working
© 2021 mIRC Discussion Forums