Done!

Akick Temp Ban v2.1 – updates:

  1.Made minor additions and corrections to the code.
  2.Added new variables and parameters in alias "atb_set". You can edit the values of these variables at your discretion, observing the correct format in the examples given:

     %atb_icons – contains additional comma-separated icons (emoji) for add to the kick reason. If you don't want to use this, then set a value like this: "%atb_icons = $null".
     %atb_idformat – contains a value from characters to generate an identification number in random order: <S> = one invisible character (space), <L> = one letter, <N> = one numeral. Correct default format: <SLLNNNNN>.
     %atb_bprefix – contains an additional prefix to the message the kick. If you don't want to use this, then set a value like this: "%atb_bprefix = $null". (You can change this to any other text/prefix you like).
     %atb_bsuffix – contains an additional ending of the message the kick. If you don't want to use this, then set a value like this: "%atb_bsuffix = $null". (You can change this to any other text/suffix you like).


Demo screenshot of the script's operability:

     [Linked Image from i.ibb.co]


This code must be inserted into the scripts editor. To do this, press the key combination "ALT+R", find the old code via "View" and replace his to the new code, further save script called "AkickTempBan.mrc":


Code
#####################################################################
#   Name: Akick Temp Ban v2.1
#   Author: Epic (epicnet@mail.ru, http://epicnet.ru)
#   Description: Sets a temporary ban, which is automatically removed after a while and the intruder is entered into the database for subsequent auto-ban.
#   Commands: !bhelp
#####################################################################

alias atb_set {
  %atb_work = yes
  %atb_kick = yes
  %atb_akick = yes
  %atb_notice = yes
  %atb_private = no
  %atb_chans = all
  %atb_comm = !b
  %atb_commhelp = !bhelp
  %atb_commadd = !badd
  %atb_commdel = !bdel
  %atb_commfind = !bfind
  %atb_commlist = !blist
  %atb_pathreason = $scriptdir $+ atb_reason.txt
  %atb_pathdb = $scriptdir $+ atb_database.txt
  %atb_icons = 🔨,✞,☠,🔥,⚡,🌠,🏁,🚩,😈
  %atb_idprefix = id:
  %atb_idformat = SLLNNNNN
  %atb_btype = 2
  %atb_btime = 10m
  %atb_stopcomm = 3s
  %atb_admins = Epic,Robert
  %atb_prefix = [!,~,&,@,%]
  ;-------------------------
  %atb_logo = AkickTempBan
  %atb_bprefix = [Banned] (reason:
  %atb_bsuffix = 12- (for more information regarding your ban please contact nickname "Admin-Nick" for removal))
  %atb_msg_rd = Bye! You are banned
  %atb_msg_cs = Correct syntax:
  %atb_msg_stopcomm = %atb_logo - Stop! Don't write commands so fast. It remains to wait:
  ;-------------------------
  %atb_msg_syntax_comm = %atb_comm <nick> [reason]
  %atb_msg_syntax_commadd = %atb_commadd <nick> <host> [id] [reason]
  %atb_msg_syntax_commdel = %atb_commdel <nick|host|id>
  %atb_msg_syntax_commfind = %atb_commfind <nick|mask|id>
  %atb_msg_syntax_commlist = %atb_commlist [N[-N]]
  ;-------------------------
  %atb_head_help = %atb_logo - Help for commands:
  %atb_msg_help1 = Set a temporary ban on the channel: %atb_msg_syntax_comm
  %atb_msg_help2 = Add user to database: %atb_msg_syntax_commadd
  %atb_msg_help3 = Delete user from database: %atb_msg_syntax_commdel
  %atb_msg_help4 = Find a user in the database: %atb_msg_syntax_commfind
  %atb_msg_help5 = List of users in the database: %atb_msg_syntax_commlist
  ;-------------------------
  %atb_head_add = %atb_logo - Adding a write to the database:
  %atb_false_add = %atb_logo - Such an entry already exists in the database:
  %atb_head_del1 = %atb_logo - Deleting channel from a line:
  %atb_head_del2 = %atb_logo - Line deleted from database:
  %atb_msg_del = Your channel has been removed from the list:
  %atb_false_del1 = %atb_logo - For this user there is no longer a ban for your channel:
  %atb_false_del2 = %atb_logo - Nothing found... Try changing search data.
  %atb_head_find = %atb_logo - According to your request, the database found:
  %atb_false_find = %atb_logo - Nothing found... Try changing search data.
  %atb_head_list = %atb_logo -  List of users in the database - Total:
  %atb_msg_check1 = %atb_logo - You don't have enough rights. Mandatory status prefix on the channel:
  %atb_msg_check2 = %atb_logo - I have no rights on this channel. I need a status prefix: ~,&,@,%
  %atb_msg_check3 = %atb_logo - I do not see on the channels a nickname:
}
=====================================================
on *:TEXT:*:#:{
  atb_set | if (%atb_work == yes) {
    if (%atb_chans == all) || ($istok(%atb_chans,$chan,44)) {
      var %atb_tokens $strip($1) $chan $nick $strip($2-) | tokenize 32 %atb_tokens
      if ($1 == %atb_comm) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_bankick_comm $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
      if ($1 == %atb_commhelp) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_help $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
      if ($1 == %atb_commadd) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_add $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
      if ($1 == %atb_commdel) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_del $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
      if ($1 == %atb_commfind) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_find $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
      if ($1 == %atb_commlist) { if (!$stopcomm($2,$3)) { atb_check $1- | atb_list $2- | stopcomm $2-3 } | else .notice $3 $stopcomm($2,$3) }
    }
  }
}
on *:JOIN:#:{ atb_set | if (%atb_work == yes) { if (%atb_chans == all) || ($istok(%atb_chans,$chan,44)) { var %atb_jnick $nick | var %atb_jhost $address($nick,%atb_btype) | if ($istok($findb(%atb_jnick).chan,$chan,44)) { atb_bankick_jn $chan !nomsg! %atb_jnick $findb(%atb_jnick).id $findb(%atb_jnick).reason | halt } | if ($istok($findb(%atb_jhost).chan,$chan,44)) { atb_bankick_jn $chan !nomsg! %atb_jnick $findb(%atb_jhost).id $findb(%atb_jhost).reason } } } }
on *:NICK:{ atb_set | if (%atb_work == yes) { var %atb_nn $newnick | if ($findc(%atb_nn)) { var %atb_fcs $v1 | var %y 1 | while (%y <= $numtok(%atb_fcs,44)) { var %atb_fc $gettok(%atb_fcs,%y,44) | var %atb_nnick %atb_nn | var %atb_nhost $address(%atb_nn,%atb_btype) | if ($istok($findb(%atb_nnick).chan,%atb_fc,44)) { atb_bankick_jn %atb_fc !nomsg! %atb_nnick $findb(%atb_nnick).id $findb(%atb_nnick).reason | goto next1 } | if ($istok($findb(%atb_nhost).chan,%atb_fc,44)) { atb_bankick_jn %atb_fc !nomsg! %atb_nnick $findb(%atb_nhost).id $findb(%atb_nhost).reason } | :next1 | inc %y } } } }
-----------------------------------------------------
alias -l atb_check {
  var %atb_up $remove($nick($2,$3).pnick,$3)
  if (!$istok(%atb_admins,$3,44) && $sprefix(%atb_up,%atb_prefix,44) == $false) { .notice $3 %atb_msg_check1 $remove(%atb_prefix,[,]) | halt }
  if ($1 == %atb_comm) { if (!$count($nick($2,$me).pnick,~,&,@,%)) { .notice $3 %atb_msg_check2 | halt } | if (!$4) { .notice $3 %atb_msg_cs %atb_msg_syntax_comm | halt } | if (!$comchan($4,0)) { .notice $3 %atb_msg_check3 $4 | halt } }
  if ($1 == %atb_commadd) { if (!$4) || (!$5) { .notice $3 %atb_msg_cs %atb_msg_syntax_commadd | halt } }
  if ($1 == %atb_commdel) { if (!$4) { .notice $3 %atb_msg_cs %atb_msg_syntax_commdel | halt } }
  if ($1 == %atb_commfind) { if (!$4) { .notice $3 %atb_msg_cs %atb_msg_syntax_commfind | halt } }
  if ($1 == %atb_commlist) { if ($4 && $4 !isnum && - !isin $4) || ($4 && - isin $4 && !$count($gettok($4,1,45),0,1,2,3,4,5,6,7,8,9)) || ($4 && - isin $4 && !$count($gettok($4,2,45),0,1,2,3,4,5,6,7,8,9)) { .notice $3 %atb_msg_cs %atb_msg_syntax_commlist | halt } }
}
-----------------------------------------------------
alias -l atb_bankick_comm { if ($findb($3)) { var %atb_banid $findb($3).id | var %atb_reason $findb($3).reason } | else { var %atb_banid $+([,%atb_idprefix,$idform(%atb_idformat),]) | if (%atb_icons != $null) var %atb_icon $gettok(%atb_icons,$rand(1,$numtok(%atb_icons,44)),44) | if ($4) var %atb_reason %atb_icon $4- | else { if ($exists(%atb_pathreason) == $true) var %atb_reason %atb_icon $read(%atb_pathreason) | else var %atb_reason %atb_icon %atb_msg_rd } } | atb_bankick_act $1 $2 $3 %atb_banid %atb_reason }
alias -l atb_bankick_jn { if ($findb($3)) { var %atb_banid $findb($3).id | var %atb_reason $findb($3).reason } | else { if (%atb_icons != $null) var %atb_icon $gettok(%atb_icons,$rand(1,$numtok(%atb_icons,44)),44) | if (!$4) { var %atb_banid $+([,%atb_idprefix,$idform(%atb_idformat),]) } | else { var %atb_banid $4 } | if (!$5) { if ($exists(%atb_pathreason) == $true) var %atb_reason %atb_icon $read(%atb_pathreason) | else var %atb_reason %atb_icon %atb_msg_rd } | else { var %atb_reason $5- } } | atb_bankick_act $1 $2 $3 %atb_banid %atb_reason }
alias -l atb_bankick_act {
  if (%atb_akick == yes) { var %atb_aknick $3 | var %atb_akhost $address($3,%atb_btype) | if ($findb(%atb_aknick) && $2 != !nomsg!) { if (!$istok($findb(%atb_aknick).chan,$1,44)) { var %atb_l $findb(%atb_aknick).line | var %atb_s $findb(%atb_aknick).string | var %atb_t $+($gettok(%atb_s,4,59),$chr(44),$1) | var %atb_ns $puttok(%atb_s,%atb_t,4,59) | .write -l $+ %atb_l $qt(%atb_pathdb) %atb_ns } } | if ($findb(%atb_akhost) && $2 != !nomsg!) { if (!$istok($findb(%atb_akhost).chan,$1,44)) { var %atb_l $findb(%atb_akhost).line | var %atb_s $findb(%atb_akhost).string | var %atb_t $+($gettok(%atb_s,4,59),$chr(44),$1) | var %atb_ns $puttok(%atb_s,%atb_t,4,59) | .write -l $+ %atb_l $qt(%atb_pathdb) %atb_ns } } | if (!$findb(%atb_aknick) && !$findb(%atb_akhost)) { .write -il1 $qt(%atb_pathdb) $+($4,$chr(59),$3,$chr(59),$address($3,%atb_btype),$chr(59),$1,$chr(59),$5-) } }
  .ban $+(-u,$convertsec(%atb_btime)) $1 $3 %atb_btype | if (%atb_kick == yes && $3 ison $1) { .kick $1 $3 %atb_bprefix $5- $4 %atb_bsuffix } | if (%atb_notice == yes && $2 != !nomsg!) { .notice $2 %atb_logo - $3 $+($chr(40),%atb_btime,$chr(41)) $4 $findb($3).chan - $5- } | if (%atb_private == yes && $2 != !nomsg!) { .msg $2 %atb_logo - $3 $+($chr(40),%atb_btime,$chr(41)) $4 $findb($3).chan - $5- }
}
-----------------------------------------------------
alias -l atb_help { .notice $2 %atb_head_help | .notice $2 %atb_msg_help1 | .notice $2 %atb_msg_help2 | .notice $2 %atb_msg_help3 | .notice $2 %atb_msg_help4 | .notice $2 %atb_msg_help5 }
alias -l atb_add {
  if (!$findb($3)) { var %atb_ah $+(*!*@,$remove($4,*,!,@)) | if (%atb_icons != $null) var %atb_icon $gettok(%atb_icons,$rand(1,$numtok(%atb_icons,44)),44) | var %atb_banchans $1 | if ($5) { var %atb_space $idforms($count(%atb_idformat,S)) | var %atb_banid $+([,%atb_idprefix,%atb_space,$remove($5,id,:,[,]),]) } | else { var %atb_banid $+([,%atb_idprefix,$idform(%atb_idformat),]) } | if ($6) { var %atb_reason %atb_icon $6- } | else { if ($exists(%atb_pathreason) == $true) var %atb_reason %atb_icon $read(%atb_pathreason) | else var %atb_reason %atb_icon %atb_msg_rd } | .write -il1 $qt(%atb_pathdb) $+(%atb_banid,$chr(59),$3,$chr(59),%atb_ah,$chr(59),%atb_banchans,$chr(59),%atb_reason) | .notice $2 %atb_head_add | .notice $2 $+(+,$chr(32),,1,.,) %atb_banid $3 %atb_ah %atb_banchans - %atb_reason | return }
  else { if (!$istok($findb($3).chan,$1,44)) { var %atb_l $findb($3).line | var %atb_s $findb($3).string | var %atb_t $+($gettok(%atb_s,4,59),$chr(44),$1) | var %atb_ns $puttok(%atb_s,%atb_t,4,59) | .write -l $+ %atb_l $qt(%atb_pathdb) %atb_ns | var %atb_an $2 | tokenize 59 $findb($3).string | .notice %atb_an %atb_head_add | .notice %atb_an $+(,%atb_l,.,) $1-4 - $5- | return } } | var %atb_an $2 | tokenize 59 $findb($3).string | .notice %atb_an %atb_false_add $2 = line $+($chr(40),,$findb($3).line,,$chr(41)) | .notice %atb_an $+(,$findb($3).line,.,) $1-4 - $5-
}
alias -l atb_del { if ($3 && $findb($3)) { var %atb_dcc $1 | var %atb_dn $2 | var %atb_dl $findb($3).line | var %atb_ds $findb($3).string | var %atb_dc $findb($3).chan | if ($istok(%atb_dc,$1,44)) { var %atb_dc $remextcom($remove(%atb_dc,%atb_dcc)) | if (%atb_dc != $null) { var %atb_dst $puttok(%atb_ds,%atb_dc,4,59) | .write -l $+ %atb_dl $qt(%atb_pathdb) %atb_dst | tokenize 59 $findb($3).string | .notice %atb_dn %atb_head_del1 | .notice %atb_dn $+(,%atb_dl,.,) $1-4 - $5- | .notice %atb_dn %atb_msg_del %atb_dcc } | else { tokenize 59 %atb_ds | .write -dl $+ %atb_dl $qt(%atb_pathdb) | .notice %atb_dn %atb_head_del2 | .notice %atb_dn $+(-,$chr(32),,%atb_dl,.,) $1-4 - $5- } } | else { tokenize 59 %atb_ds | .notice %atb_dn %atb_false_del1 %atb_dcc | .notice %atb_dn $+(,%atb_dl,.,) $1-4 - $5- } } | else { .notice $2 %atb_false_del2 } }
alias -l atb_find { if ($3 && $findb($3)) { .notice $2 %atb_head_find | var %atb_fn $2 | var %atb_fl $findb($3).line | var %atb_fs $findb($3).string | tokenize 59 %atb_fs | .notice %atb_fn $+(,%atb_fl,.,) $1-4 - $5- } | else { .notice $2 %atb_false_find } }
alias -l atb_list { var %atb_ln $2 | var %atb_lnum $3 | var %atb_ll $lines(%atb_pathdb) | .notice %atb_ln %atb_head_list $+($chr(40),,%atb_ll,,$chr(41)) | var %w 1 | while (%w <= %atb_ll) { tokenize 59 $read(%atb_pathdb,%w) | if (!%atb_lnum) .notice %atb_ln $+(,%w,.,) $1-4 - $5- | if (%atb_lnum && - !isin %atb_lnum) { if (%w <= %atb_lnum) { .notice %atb_ln $+(,%w,.,) $1-4 - $5- } | else { .break } } | if (%atb_lnum && - isin %atb_lnum) { if (%w >= $gettok(%atb_lnum,1,45)) { .notice %atb_ln $+(,%w,.,) $1-4 - $5- } | if (%w >= $gettok(%atb_lnum,2,45)) { .break } } | inc %w } }
alias atb_remove_vars { unset %atb_* | .echo -st All script variables "AkickTempBan" have been deleted successfully. }
-----------------------------------------------------
alias -l findb { :next3 | if (!%sbd_line) var %sbd_line 1 | if ($read(%atb_pathdb, -w, $+(*,$1,*), %sbd_line)) { var %sdb_r $readn | var %sdb_s $read(%atb_pathdb,%sdb_r) | var %sbf_s1 $remove($1,%atb_idprefix,$chr(160),$chr(32),[,],:) | var %sbd_s1 $remove($gettok(%sdb_s,1,59),%atb_idprefix,$chr(160),$chr(32),[,],:) | var %sbd_s2 $gettok(%sdb_s,2,59) | var %sbd_s3 $gettok(%sdb_s,3,59) | if (%sbf_s1 == %sbd_s1) || ($1 == %sbd_s2) || ($+(*,$1,*) iswm %sbd_s3) { if (line == $prop) return %sdb_r | if (string == $prop) return %sdb_s | if (id == $prop) return $replace($gettok(%sdb_s,1,59),$chr(32),$chr(160)) | if (nick == $prop) return $gettok(%sdb_s,2,59) | if (host == $prop) return $gettok(%sdb_s,3,59) | if (chan == $prop) return $gettok(%sdb_s,4,59) | if (reason == $prop) return $gettok(%sdb_s,5-,59) | return $true } | else { inc %sbd_line | if (%sbd_line <= $lines(%atb_pathdb)) goto next3 } } }
alias -l findc { var %n 1 | while (%n <= $comchan($1,0)) { var %coc $comchan($1,%n) | if (%atb_chans == all) || ($istok(%atb_chans,%coc,44)) { if (!%clc) var %clc %coc | else var %clc $+(%clc,$chr(44),%coc) } | inc %n } | return %clc }
alias -l sprefix { var %sp_sp $remove($2,[,]) | var %sp_sn $numtok(%sp_sp,$3) | var %q 1 | while (%q <= %sp_sn) { if ($gettok(%sp_sp,%q,$3) isin $1) return $true | inc %q } | return $false }
alias -l stopcomm { if ($hget($+(stopcomm,$2),$1)) return %atb_msg_stopcomm $+($chr(40),,$v1,,$chr(41),$chr(32),sec.) | if (!$hget($+(stopcomm,$2),$1)) .hadd -mz $+(stopcomm,$2) $1 $convertsec(%atb_stopcomm) }
alias -l convertsec { var %cst $right($1,1) | var %csn $remove($1,%cst) | if ($count(%cst,s,m,h,d)) { if (%cst == s) return %csn | if (%cst == m) return $calc(%csn * 60) | if (%cst == h) return $calc(%csn * 3600) | if (%cst == d) return $calc(%csn * 86400) } | else { .echo -st %atb_logo - Error: Invalid time format - Correct format: 1s,1m,1h,1d | return 60 } }
alias -l idform { if ($countcs($1,S,L,N)) { unset %atb_cif | var %i 1 | while (%i <= $len($1)) { if ($mid($1,%i,1) == S) var %atb_cif $+(%atb_cif,$chr(160)) | if ($mid($1,%i,1) == L) var %atb_cif $+(%atb_cif,$rand(A,Z)) | if ($mid($1,%i,1) == N) var %atb_cif $+(%atb_cif,$rand(0,9)) | inc %i } | return %atb_cif } | else { .echo -st %atb_logo - Error: Invalid ID format - Correct format: SLLNNNNN - S = invisible character (space), L = random letter, N = random number. | return $+($rand(A,Z),$rand(A,Z),$rand(10000,99999)) } }
alias -l idforms { var %i 1 | while (%i <= $1) { var %atb_cis $+(%atb_cis,$chr(160)) | inc %i } | return %atb_cis }
alias -l remextcom { var %rc_s $1 | :next4 | var %rc_s $replace(%rc_s,$+($chr(44),$chr(44)),$chr(44)) | if ($left(%rc_s,1) == $chr(44)) var %rc_s $mid(%rc_s,2) | if ($right(%rc_s,1) == $chr(44)) { var %rc_s $mid(%rc_s,1,$calc($len(%rc_s) -1)) | goto next4 } | return %rc_s }
=====================================================



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 or in its work, then be sure to write to me here about it, and we are together think about what we can do.




🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples