At your request in personal correspondence, several new changes and improvements were made to the script code. Please tested the script before using it.

Allow Chars v1.2 – updates:

  1.Now when you select the "Enable" or "Disable" item in the menu, a checkmark will be set on the left, indicating which item is currently selected.
  2.Now when viewing menu items, the values of the configured parameters will be displayed next to the right in square brackets.
  3.Now after each detected violation, an echo message with the name of the channel, user nick and the message for which he was banned will be displayed in the status window.
  4.Now together with the space, all invisible characters (similar to space) will also be removed from the message (for ignored) when checking for valid characters. See all: Here (There is no need to list them in the file).
  5.In the menu in the "Except" item, a new sub-item "Nicks" has been added so that you can specify a comma-separated list of nicknames for to exclude from checking. Default variable: %ach_exceptnick = Epic,krisb34213


Screenshot for demo operability of the script's:

  [Linked Image from i.ibb.co]

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 replace with this code the old code, then save it under the name "AllowChars.mrc":

Code
#####################################################################
#   Name: Allow Chars v1.2
#   Author: Epic (epicnet@mail.ru, http://epicnet.ru)
#   Description: Allows to use in channel messages only those characters that are specified in the script.
#####################################################################

alias -l allowchars_set {
  if (!%ach_work) %ach_work = yes
  if (!%ach_kick) %ach_kick = yes
  if (!%ach_ban) %ach_ban = yes
  if (!%ach_reason) %ach_reason = There are forbidden characters in your message!
  if (!%ach_btype) %ach_btype = 2,3
  if (!%ach_btime) %ach_btime = 3600
  if (!%ach_exceptpref) %ach_exceptpref = [+%@&~!]
  if (!%ach_exceptnick) %ach_exceptnick = Epic,krisb34213
  if (!%ach_charfile) %ach_charfile = scripts\AllowСhars\allowchars.txt
}
menu menubar,status,channel {
  Allow Chars
  .Work
  ..$iif(%ach_work == yes,$style(1)) Enable: %ach_work = yes | .echo -a "Allow Chars" - Script:03 enabled.
  ..$iif(%ach_work == no,$style(1)) Disable: %ach_work = no | .echo -a "Allow Chars" - Script:04 disabled.
  .Characters
  ..File $+([,$nopath(%ach_charfile),]): allowchars_set | if ($exists(%ach_charfile)) .run %ach_charfile
  ..Path $+([..\,$nopath(%ach_charfile),]): var %p $$?="Enter the full path to the file with allowed characters:" | if ($len(%p) > 0) { %ach_charfile = %p | .echo -a "Allow Chars" - The path to the file:03 %ach_charfile }
  .Kick
  ..$iif(%ach_kick == yes,$style(1)) Enable: %ach_kick = yes | .echo -a "Allow Chars" - Kick:03 enabled.
  ..$iif(%ach_kick == no,$style(1)) Disable: %ach_kick = no | .echo -a "Allow Chars" - Kick:04 disabled.
  ..-
  ..Reason: var %r $$?="Enter the reason for the kick:" | if ($len(%r) > 0) { %ach_reason = %r | .echo -a "Allow Chars" - Kick reason:03 %ach_reason }
  .Ban
  ..$iif(%ach_ban == yes,$style(1)) Enable: %ach_ban = yes | .echo -a "Allow Chars" - Ban:03 enabled.
  ..$iif(%ach_ban == no,$style(1)) Disable: %ach_ban = no | .echo -a "Allow Chars" - Ban:04 disabled.
  ..-
  ..Type $+([,%ach_btype,]): var %t $$?="Enter one or more types of bans separated by commas:" | if ($len(%t) > 0) { %ach_btype = %t | .echo -a "Allow Chars" - Ban type:03 %ach_btype }
  ..Time $+([,%ach_btime,]) sec: var %t $$?="Enter the number of seconds after which you want to remove the ban:" | if ($len(%t) > 0) { %ach_btime = %t | .echo -a "Allow Chars" - Ban time:03 %ach_btime }
  .Except
  ..Prefixes %ach_exceptpref: var %p $$?="Enter the prefixes of the channel operators to exclude:" | if ($len(%p) > 0) { %ach_exceptpref = $+([,$remove(%p,]),]) | .echo -a "Allow Chars" - Except prefixes:03 %ach_exceptpref }
  ..Nicks $+([,$numtok(%ach_exceptnick,44),]): var %n $$?="Enter all users nicks separated by commas that you want to exclude:" | if ($len(%n) > 0) { %ach_exceptnick = %n | .echo -a "Allow Chars" - Except nicks:03 %ach_exceptnick }
}
on *:TEXT:*:#: allowchars $nick $chan $1-
on *:ACTION:*:#: allowchars $nick $chan $1-
alias -l allowchars {
  allowchars_set | if (%ach_work == yes) {
    var %ach_pnick $remove($nick($2,$1).pnick,$1)
    if (%ach_pnick isin %ach_exceptpref) || ($istok(%ach_exceptnick,$1,44)) { halt }
    if ($exists(%ach_charfile)) {
      var %text $remove($3-,$chr(32),$chr(160),$chr(8194),$chr(8195),$chr(8196),$chr(8197),$chr(8198),$chr(8199),$chr(8201),$chr(8202),$chr(8203),$chr(8239),$chr(8287),$chr(12288),$chr(65279))
      var %c 1 | while (%c <= $lines(%ach_charfile)) { %chars = $+(%chars,$read(%ach_charfile,n,%c)) | inc %c }
      var %pattern $+(/[^,$replacecs(%chars,\,\\,[,\[,],\],-,\-,^,\^),]/iuS) | unset %chars
      if ($regex(%text,%pattern) > 0) { allowchars_ban $1 $2 | .echo -st "Allow Chars" Violation detected - Channel05 $2 Nick:05 $1 Message: $+("04,$3-,") }
    }
  }
}
alias -l allowchars_ban {
  if (%ach_ban == yes) {
    if (!%ach_btype) %ach_btype = 2,3 | if (%ach_btime > 0) var %ach_key $+(-u,%ach_btime)
    var %i 1 | while (%i <= $numtok(%ach_btype,44)) { .ban %ach_key $2 $1 $gettok(%ach_btype,%i,44) | inc %i }
  }
  if (%ach_kick == yes) { if ($len(%ach_reason) > 1) var %ach_kr %ach_reason | else var %ach_kr - | .kick $2 $1 %ach_kr }
}


Remember that if something went wrong, or you accidentally erased something, then you can always reinstall this script again.


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