Advertisement
westor

Bad Channels Protection for HelpMe v1.0

May 19th, 2023
2,460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 3.34 KB | None | 0 0
  1. ; ----------- Settings --------------
  2.  
  3. alias -l channel { return #sex } ; The channel that code to work (NO MULTI CHANNELS SUPPORTED)
  4. alias -l bad_file { return badchans.txt } ; The bad channels location file
  5. alias -l ban_kick { return 1 } ; 1 = kick him yes, 0 = no kick just ban
  6. alias -l ban_time { return 300 } ; 0 = permanent, (use seconds only)
  7. alias -l ban_type { return 2 } ; use /help $mask for ban type
  8. alias -l random_delay { return $rands(300,900) } ; From 300 seconds up to 900 in random
  9.  
  10. ; ----------- Settings --------------
  11.  
  12. ON *:JOIN:$($channel): {
  13.   if ($nick == $me) {
  14.     var %t = $nick($chan,0,r)
  15.     var %i = 1
  16.  
  17.     while (%i <= %t) {
  18.       var %n = $nick($chan,%i,r)
  19.  
  20.       if (%n) && (%n !== $me) { .timer[BCS_ $+ %n $+ _AUTOCHECK] 0 $random_delay recheck_badchan %n }
  21.  
  22.       inc %i
  23.     }
  24.  
  25.     return
  26.   }
  27.  
  28.   if ($me !isop $chan) { return }
  29.  
  30.   recheck_badchan $nick
  31. }
  32.  
  33. ON *:PART:$($channel): {
  34.   if ($nick == $me) { .timer[BCS_*_AUTOCHECK] off }
  35.   else { .timer[BCS_ $+ $nick $+ _AUTOCHECK] off }
  36. }
  37.  
  38. ON *:KICK:$($channel): {
  39.   if ($knick == $me) { .timer[BCS_*_AUTOCHECK] off }
  40.   else { .timer[BCS_ $+ $nick $+ _AUTOCHECK] off }
  41. }
  42.  
  43. RAW *:*: {
  44.   if (!$hget(BCS,0).item) || ($status !== connected) { return }
  45.  
  46.   haltdef
  47.  
  48.   var %h = $hget(BCS,$2)
  49.  
  50.   if ($numeric == 318) && (%h) { hdel BCS $2 }
  51.  
  52.   if ($numeric == 319) && (%h) {
  53.     var %r = $check_badchans($3-)
  54.     var %t = $comchan($2,0)
  55.  
  56.     if (!%r) || (!%t) { return }
  57.  
  58.     var %i = 1
  59.     while (%i <= %t) {
  60.       var %c = $comchan($2,%i)
  61.  
  62.       if ($me ison %c) && ($me isop %c) && ($2 ison %c) {
  63.         inc %knum 1
  64.  
  65.         var %f = -
  66.  
  67.         if ($ban_kick) { var %f = %f $+ k }
  68.         if ($ban_time) { var %f = %f $+ u $+ $ban_time }
  69.  
  70.         ban %f %c $2 $ban_type 4[Banned] (reason: You have been found in ( $+ $numtok(%r,32) $+ ) blacklisted channels ( $+ %r $+ ) -- for more infomation reagarding your ban please contact Kendy for removal -52- [Kick id: $chr(35) $+ %knum $+ ] (Expires in: $duration($ban_time) $+ )
  71.       }
  72.  
  73.       inc %i
  74.     }
  75.  
  76.   }
  77. }
  78.  
  79. alias recheck_badchan {
  80.   ; /recheck_badchan <nickname>
  81.  
  82.   if (!$1) || ($status !== connected) { return }
  83.  
  84.   hadd -mu10 BCS $1 1
  85.  
  86.   whois $1
  87. }
  88.  
  89. alias -l check_badchans {
  90.   ; $check_badchans(#channel1 #channel2 ...)
  91.  
  92.   if (!$1) || (!$file($bad_file)) { return }
  93.  
  94.   var %chans = $fix_badchans($1-)
  95.   var %win = $+(@BCS_,$crc($1-,0))
  96.  
  97.   if ($window(%win)) { window -c $v1 }
  98.  
  99.   window -hj10000000000000 %win
  100.   loadbuf %win $qt($bad_file)
  101.  
  102.   var %t = $line(%win,0)
  103.   var %i = 1
  104.  
  105.   while (%i <= %t) {
  106.     var %r = $line(%win,%i)
  107.  
  108.     if (!%r) { goto next }
  109.  
  110.     if ($istok(%chans,%r,32)) { var %tot = $addtok(%tot,%r,32) | goto next }
  111.  
  112.     var %z = 1
  113.     while (%z <= $numtok(%chans,32)) {
  114.       var %n = $gettok(%chans,%z,32)
  115.  
  116.       if (%n) && (%r iswm %n) { var %tot = $addtok(%tot,%n,32) }
  117.  
  118.       inc %z
  119.     }
  120.  
  121.     :next
  122.     inc %i
  123.   }
  124.  
  125.   window -c %win
  126.  
  127.   return $iif(%tot,$v1,0)
  128. }
  129.  
  130. alias -l fix_badchans {
  131.   ; $fix_badchans(@#channel1 ~#channel2 ...)
  132.  
  133.   if (!$1) { return 0 }
  134.  
  135.   var %t = $numtok($1-,32)
  136.   var %i = 1
  137.  
  138.   while (%i <= %t) {
  139.     var %o = $gettok($1-,%i,32)
  140.  
  141.     if (%o) { var %c = $+($chr(35),$right(%o,- $+ $pos(%o,$chr(35),1))) }
  142.     if (%c) { var %tot = $addtok(%tot,%c,32) }
  143.  
  144.     inc %i
  145.   }
  146.  
  147.   return $iif(%tot,$v1,0)
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement