Advertisement
debiangr

Untitled

Apr 12th, 2023
635
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.91 KB | None | 0 0
  1. #bcn_prot on
  2. #bcn_prot end
  3.  
  4. alias -l channel { return #shoqeria } ; Place channels (use comma to add more)
  5. alias -l kb_reason { return 14Ndrysho Nick dhe rifutu serish04... } ; Ban reason
  6. alias -l kb_bantime { return 3600 } ; Ban seconds
  7. alias -l kb_bantype { return 2 } ; Ban type (/help $mask)
  8.  
  9. ON !*:JOIN:$($channel): {
  10.   if ($group(#bcn_prot).status !== on) { return }
  11.  
  12.   bad_common_nick_check $nick
  13. }
  14.  
  15. ON !*:NICK: {
  16.   if ($group(#bcn_prot).status !== on) { return }
  17.  
  18.   var %t = $comchan($newnick,0)
  19.  
  20.   if (!%t) { return }
  21.  
  22.   var %i = 1
  23.   while (%i <= %t) {
  24.     var %c = $comchan($newnick,%i)
  25.  
  26.     if (%c) && ($istok($channel,%c,44)) { bad_common_nick_check $newnick }
  27.  
  28.     inc %i
  29.   }
  30.  
  31. }
  32.  
  33. alias bcn_prot {
  34.   if (!$1) { echo 4 -at [BCN]: Error, Use an option ON or OFF and try again! | return }
  35.   if (!$istok(on off,$1,32)) { echo 4 -at [BCN]: Error, use ON or OFF options! | return }
  36.  
  37.   var %s = $group(#bcn_prot).status
  38.  
  39.   if ($1 == ON) {
  40.     if (%s == on) { echo 4 -at [BCN]: Error, Already enabled! }
  41.     else { .enable #bcn_prot | echo -at [BCN]: Bad Common Nicknames protection enabled! - Channels: $channel }
  42.   }
  43.  
  44.   if ($1 == OFF) {
  45.     if (%s == off) { echo 4 -at [BCN]: Error, Already disabled! }
  46.     else { .disable #bcn_prot | echo -at [BCN]: Bad Common Nicknames protection disabled! }
  47.   }
  48.  
  49. }
  50.  
  51. alias -l bad_common_nick_check {
  52.   ; /bad_common_nick_check <nick>
  53.  
  54.   if (!$1) { return }
  55.  
  56.   var %h = GOODNICK
  57.   var %t = $hget(%h,0).item
  58.  
  59.   if (!%t) { return }
  60.  
  61.   var %i = 1
  62.   while (%i <= %t) {
  63.     var %e = $hget(%h,%i).item
  64.     var %d = $hget(%h,%e)
  65.  
  66.     if (%e) && (%d) && (%d !== $1) {
  67.       var %n = $bad_common_nick_check_match(%d,$1)
  68.  
  69.       if (%n) { bad_common_nick_kb $1 %d | break }
  70.     }
  71.  
  72.     inc %i
  73.   }
  74.  
  75. }
  76.  
  77. alias -l bad_common_nick_kb {
  78.   ; /bad_common_nick_kb <nick> <match-nick>
  79.  
  80.   if (!$1) && (!$2) { return }
  81.  
  82.   var %t = $comchan($1,0)
  83.  
  84.   if (!%t) { return }
  85.  
  86.   var %i = 1
  87.   while (%i <= %t) {
  88.     var %c = $comchan($1,%i)
  89.  
  90.     if (%c) && ($istok($channel,%c,44)) && ($me isop %c) && ($1 ison %c) && ($1 isreg %c) {
  91.       var %h = $ial($1).host
  92.       var %m = $2
  93.  
  94.       echo -t %c [BCN]: $1 matches $2 in the list.
  95.  
  96.       if (*.IP iswm %h) { ban $+(-u,$kb_bantime) %c *!*@*. $+ $gettok(%h,3-,46) | kick %c $1 $kb_reason }
  97.       else { ban $+(-ku,$kb_bantime) %c $1 $kb_bantype $kb_reason }
  98.     }
  99.  
  100.     inc %i
  101.   }
  102.  
  103. }
  104.  
  105. alias -l bad_common_nick_check_match {
  106.   ; $bad_common_nick_check_match(main-nick,check-nick)
  107.  
  108.   var %s = [-_`|{}^\[\]\d]*
  109.   var %p = /^(?! $+ \Q $+ $replacecs($1,\E,\E\\E\Q) $+ \E$) $+ .*? $+ $bad_common_nick_check_match_temp($1,%s) $+ .*$ $+ /iu
  110.   var %r = $regex($2,%p)
  111.  
  112.   return $iif(%r,1,0)
  113. }
  114.  
  115. alias -l bad_common_nick_check_match_temp {
  116.   var %name = $2
  117.  
  118.   return $regsubex($replace($1,o,[0o],e,[e3],i,[i1|],a,[a4]),/(\[[^\]]+\]|.)/g,$iif(\1 !isalnum && $len(\1) == 1,\) $+ \1+ $+ $iif(\n != \0,%name))
  119. }
  120.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement