mIRC Homepage
Posted By: JaNaB On @*BAN event - 27/10/20 09:30 AM
Dear Friends

Hello everyone , I need some info about ON @*BAN event .... i want to kick Nicks with script those are banned by others (Bots Aops,Sops etc)

i am using this loop but it does not kick if $banmask is banned . it only Kick if $nick is banned , please assist me with correct loop for kicks in this case

on @*:BAN:#: { kick # $bnick Banned by 34★彡 $nick 彡★ }

For example someone sets mode +b *!*@200.159.209.12 ....if this is only Ban not kicked my script should kick this user


Any assistance with this , Appreciated alot !
Posted By: Epic Re: On @*BAN event - 27/10/20 01:50 PM

If I understood you correctly, then you need something like this:
Code
on *:BAN:#:{
  .echo $chan BAN by: $nick >>> $bnick $banmask
  .kick $chan $bnick Banned by 10★彡09 $nick 10彡★, Kicked by 10★彡09 $me 10彡★
}

The @ prefix in an event handler indicates that you must have (OP) operator status on the channel. You can remove this.
You can also use echo to check if the event handler is work and to see what nicknames are in use.

For more information on this handler, see the mIRC client reference help document.
Posted By: JaNaB Re: On @*BAN event - 28/10/20 02:08 PM
thanks for your given loops Idea for echo is really help full to recognize , but it does not kick user whos IP is banned ...It Say No such user/channel even if they are in channel ,

is there any type of On Ban which recognize IP address *!*@192.167.1.14 is banned and then kick the nick who's IP is banned ?????

I wan to simply kick those who's IP is suddenly ban by other OP/BOT

Thanks for you help
Posted By: Epic Re: On @*BAN event - 28/10/20 03:12 PM
To track the full mask with the banned nickname's IP address, you can use this line:
Code
.echo 5 $chan BAN by: $nick >>> $banmask >>> $bnick $+($chr(40),$address($bnick,5),$chr(41))

Regarding the impossibility of performing a kick on a channel, are you sure that you have a sufficient level of rights for this on channel?
It may also be related to the established restrictions through the channel modes. For example, in InspIRCD when "+Q" channel mode is enabled, it is forbidden to kick, except for a certain group of users.
Please make sure that there are no restrictions for you to perform kicks on these channels.

This is probably a better solution for you with the /WHO check command. I tested this piece of code on my server and it works great:
Code
on *:BAN:#:{
  if ($gettok($banmask,2,64) == $chr(42)) {
    .echo 5 $chan BAN by: $nick >>> $banmask >>> $bnick $+($chr(40),$address($bnick,5),$chr(41))
    .kick $chan $bnick Banned by 10★彡09 $nick 10彡★, Kicked by 10★彡09 $me 10彡★
  }
  else {
    .hadd -m cban-nick $chan $nick
    .hadd -m cban-chan $chan $chan
    .hadd -m cban-ip $chan $gettok($banmask,2,64)
    .who $chan
  }
}
raw 352:*:{
  if ($hget(cban-chan,$2)) {
    if ($4 == $hget(cban-ip,$2) && $6 ison $2) {
      .echo 5 $2 BAN by: $hget(cban-nick,$2) >>> $6 $+($chr(40),$3,$chr(64),$hget(cban-ip,$2),$chr(41))
      .kick $2 $6 Banned by 10★彡09 $hget(cban-nick,$2) 10彡★, Kicked by 10★彡09 $me 10彡★
    }
    halt
  }
}
raw 315:*: if ($hget(cban-chan,$2)) { .hdel -sw cban-nick $2 | .hdel -sw cban-chan $2 | .hdel -sw cban-ip $2 | halt }

    [Linked Image from i.ibb.co]

Posted By: maroon Re: On @*BAN event - 28/10/20 04:22 PM
If you're getting a banmask, then as long as the address is in your IAL, you can find it like:

$ialchan($banmask,$chan,1).nick = 1st matching nick
$ialchan($banmask,$chan,0) = total count of matching nicks

Note that by default the IAL contains only nicks that have done something, such as join or msg the channel, or if you have whois'ed them. So this can exclude all the nicks who are already in the channel when you join it.

If $ialchan($banmask,$chan,0) is not the same number as $nick($chan,0) then you can "/who $chan" to have the server send you all the addresses in the channel. You can also do this as you join the channel, but this risks you being disconnected for flooding if you do this in several huge channels at the same time. You can spread out these commands using a timer with varying delay, like

on me:*:join:#: { timer 1 $calc( ($chan(0) -1) * 10) who $chan }

All the usual warnings apply, you probably want to exclude ops and/or yourself, and you may not want to take action if it matches everyone or most.

If you checkbox options/irc/flood/op-commands it will queue your mode/kick commands to keep you from being flooded due to sending too many too fast.
Posted By: JaNaB Re: On @*BAN event - 29/10/20 10:51 AM
thanks for your reply

i would definitely give it a try ...Seems it would work for sure ...Yes i have access to kick and there is no such mode that stops kicks ..

thank you and appreciated

Do you know any simple loop for join/part flood which can ban and kick at the same time ?????
Posted By: Epic Re: On @*BAN event - 29/10/20 07:58 PM
Quote
Do you know any simple loop for join/part flood which can ban and kick at the same time ?????


If you need the simplest protection against join flooding, then I wrote such a script code for you. All settings via "jflood" alias:
Code
alias jflood {
  .hadd -m jf join-max 3
  .hadd -m jf time-max 5
  .hadd -m jf kick-text Stop Join Flood!
}
on *:JOIN:#:{
  jflood | var %jf_chan $+(jfchan-,$chan) | var %jf_ip $gettok($address($nick,5),2,64)
  if ($hget(%jf_chan,%jf_ip)) .hinc -m %jf_chan %jf_ip 1
  if (!$hget(%jf_chan,%jf_ip)) .hadd -mu $+ $hget(jf,time-max) %jf_chan %jf_ip 1
  .echo $chan 04JFLOOD: >>> %jf_ip = $+(04,$hget(%jf_chan,%jf_ip))
  if ($hget(%jf_chan,%jf_ip) >= $hget(jf,join-max)) {
    .mode $chan +b $+(*!*@,%jf_ip)
    .kick $chan $nick $hget(jf,kick-text)
    .hdel -sw %jf_chan %jf_ip
  }
}

join-max 3 - this is the maximum number of possible joins per channel of one user before it is baned.
time-max 5 - this is the maximum time in seconds during which the user can get banned if he violates the limit on the number of joins.

You can change these values ​​to suit you.
Posted By: JaNaB Re: On @*BAN event - 29/10/20 09:35 PM
thanks Epic , Should i simply past this into alias section ????
Posted By: Epic Re: On @*BAN event - 29/10/20 09:47 PM
Yes, only Remote. Just press the key combination "ALT+R", open the script editor, select "File/New" and copy this script there.
Then select the place where you want to save the script and under what name "File/Save As...", name it for example: "AntiFloodJoin.mrc". Then click OK.
Posted By: JaNaB Re: On @*BAN event - 29/10/20 10:13 PM
well thanks and it worked but can we make it more strict because you can see below...it bans after 3 join parts in ..it is possible to make it as 2 join parts in as well as i want to ban big range of IPS like *!*@192.168.+b.+b ,

thanks again


* ChalNikaLorC (~chalnikal@131.196.9.124) has joined #
JFLOOD: >>> 131.196.9.124 = 1
* ChalNikaLorC (~chalnikal@131.196.9.124) has left #
* ChalNikaLorC (~chalnikal@131.196.9.124) has joined #
JFLOOD: >>> 131.196.9.124 = 2
* ChalNikaLorC (~chalnikal@131.196.9.124) has left #
* ChalNikaLorC (~chalnikal@131.196.9.124) has joined #
JFLOOD: >>> 131.196.9.124 = 3
* ChalNikaLorC (~chalnikal@131.196.9.124) has left #
* JaNaB sets mode: +b *!*@131.196.9.124
Posted By: Epic Re: On @*BAN event - 29/10/20 10:31 PM
Then try this version of the script. You can uncomment or comment out the desired line with the ";" symbol, - the line in which the ban is placed using the channel mode.

.mode $chan +b $+(*!*@,%jf_ip)
or
.mode $chan +b $+(*!*@,$gettok(%jf_ip,1-2,46),.*)

Turn on one of the lines depending on your preference to set an easy or harder ban.

Code
alias jflood {
  .hadd -m jf join-max 2
  .hadd -m jf time-max 4
  .hadd -m jf kick-text Stop Join Flood!
}
on *:JOIN:#:{
  jflood | var %jf_chan $+(jfchan-,$chan) | var %jf_ip $gettok($address($nick,5),2,64)
  if ($hget(%jf_chan,%jf_ip)) .hinc -m %jf_chan %jf_ip 1
  if (!$hget(%jf_chan,%jf_ip)) .hadd -mu $+ $hget(jf,time-max) %jf_chan %jf_ip 1
  .echo $chan 04JFLOOD: >>> %jf_ip = $+(04,$hget(%jf_chan,%jf_ip))
  if ($hget(%jf_chan,%jf_ip) >= $hget(jf,join-max)) {
    ;------------------------------
    ;# ban only one ip
    ;.mode $chan +b $+(*!*@,%jf_ip)
    ;# ban subnet ip
    .mode $chan +b $+(*!*@,$gettok(%jf_ip,1-2,46),.*)
    ;------------------------------
    .kick $chan $nick $hget(jf,kick-text)
    .hdel -sw %jf_chan %jf_ip
  }
}

Posted By: JaNaB Re: On @*BAN event - 29/10/20 10:50 PM
I will try this out for sure because it works good .... if still i have more queries will get in touch ...

thanks
Posted By: JaNaB Re: On @*BAN event - 30/10/20 09:56 AM
this works good for Join flood ...Is there in loop which is also effective for join/part restriction with $address ... Like the previous loop you told 3 join in 5 seconds

in join/part is it possible to join/part one $address 1 time in 2 or 3 or 4 seconds whatever we set otherwise kicked/banned
Posted By: Epic Re: On @*BAN event - 30/10/20 10:25 AM
I did not quite understand the question due to the complexity of the translation or incorrect formulation wording of the question. The script records each user separately, according to his ip address, and if he exceeds the limit on the frequency of joins for the specified time in seconds, he will receive a kick + ban.

If you want to be able to select custom address masks for ban by type "nick!ident@host" to be set, then the following script is suitable for you:
Code
alias jflood {
  .hadd -m jf join-max 2
  .hadd -m jf time-max 3
  .hadd -m jf kick-text Stop Join Flood!
  ;---------------------
  ;# Type 1 = nick!ident@host
  ;# Type 2 = nick!*@host
  ;# Type 3 = *!ident@host
  ;# Type 4 = nick!*@*
  ;# Type 5 = *!ident@*
  ;# Type 6 = *!*@host
  ;# Type 7 = *!*@subnet*
  ;---------------------
  .hadd -m jf type-ban 7
}
on *:JOIN:#:{
  jflood | var %jf_chan $+(jfchan-,$chan) | var %jf_nick $+(jfnick-,$chan) | var %jf_ip $gettok($address($nick,5),2,64)
  if ($hget(%jf_chan,%jf_ip)) { .hinc -m %jf_chan %jf_ip 1 }
  if (!$hget(%jf_chan,%jf_ip)) { .hadd -mu $+ $hget(jf,time-max) %jf_chan %jf_ip 1 | .hadd -m %jf_nick %jf_ip $nick }
  .echo $chan 04JFLOOD: >>> $hget(%jf_nick,%jf_ip) $+($chr(40),%jf_ip,$chr(41)) = $+(04,$hget(%jf_chan,%jf_ip))
  if ($hget(%jf_chan,%jf_ip) >= $hget(jf,join-max)) {
    ;---------------------
    if ($hget(jf,type-ban) == 1) .mode $chan +b $address($hget(%jf_nick,%jf_ip),5)
    if ($hget(jf,type-ban) == 2) .mode $chan +b $address($hget(%jf_nick,%jf_ip),7)
    if ($hget(jf,type-ban) == 3) .mode $chan +b $address($hget(%jf_nick,%jf_ip),0)
    if ($hget(jf,type-ban) == 4) .mode $chan +b $+($hget(%jf_nick,%jf_ip),!*@*)
    if ($hget(jf,type-ban) == 5) .mode $chan +b $+($gettok($address($hget(%jf_nick,%jf_ip),1),1,64),@*)
    if ($hget(jf,type-ban) == 6) .mode $chan +b $address($hget(%jf_nick,%jf_ip),2)
    if ($hget(jf,type-ban) == 7) .mode $chan +b $+(*!*@,$gettok(%jf_ip,1-2,46),.*)
    ;---------------------
    .kick $chan $hget(%jf_nick,%jf_ip) $hget(jf,kick-text)
    .hdel -sw %jf_chan %jf_ip
  }
}

If necessary, you can change these data values ​​according to your preference in the "jflood" alias, as this should work for you:

join-max 2 - this is the maximum number of possible joins per channel of one user before it is baned.
time-max 3 - this is the maximum time in seconds during which the user can get banned if he violates the limit on the number of joins.
type-ban 7 - this is number the type for the mask ban, which will be set when the joins limit is exceeded.

With these settings, the script will ban the user who will execute the 2 joins or more times within 3 seconds.

Posted By: JaNaB Re: On @*BAN event - 30/10/20 02:13 PM
I get your point and i will set it as per my requirement , thanks for your assistance so far
Posted By: JaNaB Re: On @*BAN event - 04/11/20 01:04 PM
how can we highlight text on MIRC .... can anyone assist ????

for example --> H C S F A U I ... highlight in red colour and font colour should be any lets suppose white

Posted By: Epic Re: On @*BAN event - 04/11/20 01:28 PM
If I understand your question correctly, then you need a background color for your text.

To do this, before the typed text, press the key combination "CTRL+K", choose a suitable color number for the text and then set the comma "," and choose a color number for the background.

For example, in your case it will be like this:
Code
//echo -a 00,04check background for text

Remember to always close the color code at the end of the place where it should stop coloring the text.
Posted By: maroon Re: On @*BAN event - 04/11/20 01:29 PM
As I understand you, 'highlight' means changing the background color. The Ctrl+K dialog shows the available colors. You can use 1 number, in which case it's just the foreground text color. If you follow it with a comma and a 2nd number which is the color for the background. If the final number is followed by text which itself begins with a number, you need to make sure that final number has 2 digits, in order to prevent the 1st numeric character of your text being used as part of the color number without being displayed.

The Ctrl+K character actually puts the $chr(3) character into the string, so you can use $chr(3) $+ 4,00text. The Ctrl+K character used by-itself is also the way to revert the text back to the default colors.

Note that when switching background colors, it's often easier to read if you have your text folllowed by at least 1 space having the same background color as the text itself, even if that means creating the visual appearance of having your text padded by a trailing space.
© mIRC Discussion Forums