mIRC Home    About    Download    Register    News    Help

Print Thread
Color text ban script? #269293 19/08/21 09:49 PM
Joined: Aug 2021
Posts: 2
K
Kamakzie Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: Aug 2021
Posts: 2
I was wondering if anyone has an updated kick script so when people use color It will ban them. I had a flooder come in the channel earlier and make a mess. So I want to be able to ban them automatically. Any ideas? Thanks

Re: Color text ban script? [Re: Kamakzie] #269296 21/08/21 03:06 PM
Joined: Feb 2011
Posts: 388
K
KindOne Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 388
Code
on *:text:*:#channel:{
  if ($me isop $chan) {
    if ($chr(3) isin $1-) { ban -k $chan $nick 2 Colour is not allowed. } 
  }
}


Replace #channel with your channel name.

The "2" makes the script ban *!*@host If you want something different, take a look at $mask


/help ban
/help $mask

or

https://en.wikichip.org/wiki/mirc/commands/ban
https://en.wikichip.org/wiki/mirc/identifiers/$mask


irc.swiftirc.net #msl (mIRC Scripting Language)
Re: Color text ban script? [Re: KindOne] #269299 21/08/21 07:31 PM
Joined: Aug 2021
Posts: 2
K
Kamakzie Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: Aug 2021
Posts: 2
Thank you very much. Worked like a champ!

Re: Color text ban script? [Re: Kamakzie] #269304 23/08/21 11:27 AM
Joined: Jan 2012
Posts: 178
Epic Offline
Vogon poet
Offline
Vogon poet
Joined: Jan 2012
Posts: 178
But what if it's will not a flooder, but an ordinary positive user who just loves to decorate and beautifully design their messages, or if he structures his messages in such a way as to highlight certain parts of the text in order to draw attention to them? It seems to me that it would be wrong to immediately ban someone who has added a little color to their message.

To avoid erroneous decisions and not ban everyone in a row (which can lead to resentment and termination of visiting your channel), I offer a more options for solving this issue.

You can use the built-in IRCd commands to set channel modes, which will help protect your channel from unnecessary rich text in user messages without having to set a "Ban":

  Command: "/mode #channel +c" - will set the "c" mode, which will block all user messages that contain codes "color, bold, underline" etc.
  Command: "/mode #channel +S" - will set the "S" mode, which will cut out all possible text formatting codes from user messages written on the channel.

Some IRCd may have different names of modes and how they are set, so just in case, check the documentation and help for your server: "/helpop". There are likely to be other ways of protecting channel.

⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻

As an alternative protection solution, I can suggest using the following script on your bot, which I specially created for this purpose.

Anti Code v1.0 – description:

  1.This script will help protect your channel from user messages that use text formatting codes: "Color/Bold/Underline/Italic".
  2.In the alias "anticode_set" you can remake all the settings for this script by changing the values of the variables:

      %ac_color – configures whether to enable or disable tracking of "Color" codes in text. The options are: <yes|no>.
      %ac_bold – configures whether to enable or disable tracking of "Bold" codes in text. The options are: <yes|no>.
      %ac_underline – configures whether to enable or disable tracking of "Underline" codes in text. The options are: <yes|no>.
      %ac_italic – configures whether to enable or disable tracking of "Italic" codes in text. The options are: <yes|no>.
      %ac_limit_color – configures the maximum number of "Color" codes allowed in one message. For a complete prohibition, specify a value: <0>.
      %ac_limit_bold – configures the maximum number of "Bold" codes allowed in one message. For a complete prohibition, specify a value: <0>.
      %ac_limit_underline – configures the maximum number of "Underline" codes allowed in one message. For a complete prohibition, specify a value: <0>.
      %ac_limit_italic – configures the maximum number of "Italic" codes allowed in one message. For a complete prohibition, specify a value: <0>.
      %ac_logo – configures the logo of the script name, which will be indicated in the kick message. (You can change this to your text).
      %ac_reason – configures the reason for the ban, which will be indicated in the kick message. (You can change this to your text).
      %ac_except_nicks – contains nicknames separated by commas for exclusion, to which the script will not react. (You can change this to your nicknames).
      %ac_except_status – contains symbol prefixes with channel statuses for exclusion, to which the script will not react. Default: <[!,~,&,@,%,+]>. (You can change this to your symbol prefixes).
      %ac_btype – configures the type (format) of the ban for the offender. More details about the types of bans are described here: $mask. Default: <2>.
      %ac_btime – contains the time (in seconds) for which a temporary ban will be set, and after which it will be automatically canceled on the channel. If you do not want to remove the ban, then set: <0>.
      %ac_kick – configures whether to enable or disable execution "Kick" for the offender. The options are: <yes|no>.

Demo screenshot of the script's operability:

      [Linked Image from i.ibb.co]

The script was tested on InspIRCD v3 + mIRC v7.66.

Click on the button to reveal the spoiler. This code must be inserted into the scripts editor. To do this, press the key combination "ALT+R" and save this code as new "File/New" script called "AntiCode.mrc":

Code
#####################################################################
#   Name: Anti Code v1.0
#   Author: Epic (epicnet@mail.ru, http://epicnet.ru)
#   Description: Protection of the channel from user messages that use text formatting codes: Color/Bold/Underline/Italic.
#####################################################################

alias -l anticode_set {
  %ac_color = yes
  %ac_bold = yes
  %ac_underline = yes
  %ac_italic = yes
  %ac_limit_color = 0
  %ac_limit_bold = 1
  %ac_limit_underline = 1
  %ac_limit_italic = 1
  %ac_logo = Anti-Code:
  %ac_reason = the use of such codes on the channel is prohibited!
  %ac_except_nicks = Epic,Kamakzie,Win
  %ac_except_status = [!,~,&,@,%,+]
  %ac_btype = 2
  %ac_btime = 300
  %ac_kick = yes
}
on *:TEXT:*:#:{
  anticode_set | var %ac_prefix $mid($nick($chan,test2).pnick,1,1) | var %ac_es $eval($remove(%ac_except_status,[,]),0)
  if ($istok(%ac_es,%ac_prefix,44)) || ($istok(%ac_except_nicks,$nick,44)) { halt }
  if (%ac_color == yes && $textcode($1-).color) { anticode_ban color $chan $nick }
  if (%ac_bold == yes && $textcode($1-).bold) { anticode_ban bold $chan $nick }
  if (%ac_underline == yes && $textcode($1-).underline) { anticode_ban underline $chan $nick }
  if (%ac_italic == yes && $textcode($1-).italic) { anticode_ban italic $chan $nick }
}
alias -l textcode {
  if (color == $prop) { if ($count($1-,$chr(3)) > %ac_limit_color) { return $v1 } }
  if (bold == $prop) { if ($count($1-,$chr(2)) > %ac_limit_bold) { return $v1 } }
  if (underline == $prop) { if ($count($1-,$chr(31)) > %ac_limit_underline) { return $v1 } }
  if (italic == $prop) { if ($count($1-,$chr(29)) > %ac_limit_italic) { return $v1 } }
}
alias -l anticode_ban {
  if ($me !isop $2) { .echo $chan 05I do not have operator status on this channel. | halt }
  if (%ac_kick == yes) %ac_key = %ac_key k
  if (%ac_btime > 0) %ac_key = $+(%ac_key,u,%ac_btime)
  if (%ac_key) %ac_key = $+(-,%ac_key)
  .ban %ac_key $2 $3 %ac_btype %ac_logo $+(",$1,") - %ac_reason
  unset %ac_key
}


Remember that if something went wrong, or you accidentally erased something, then you can always reinstall this script again.
If you find any errors in the code and in its work, or maybe you have new ideas or if you think that this script needs to be improved, then be sure to write to me here about it, and we are together think about what we can do.



🅸🆁🅲 - 𝔦'𝔱𝔰 𝔸 𝕂𝖎ɴ𝙙 ᴏ𝙛 𝕄𝙖𝖌𝙞𝙘