westor

OP/MUTE List based realname for Dune2K v2.0

Sep 27th, 2020 (edited)
1,944
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 8.90 KB | None | 0 0
  1. alias channels { return #two,#SWGhost,#SWGhost-Game }
  2.  
  3. ON *:JOIN:$($channels): {
  4.   if ($nick == $me) {
  5.     .ialfill -f $chan
  6.  
  7.     mode $chan b
  8.     mode $chan e
  9.     mode $chan I
  10.  
  11.     .timer[CHECK_ $+ $chan $+ _OPLIST] 1 5 chk_all_op_realname $chan
  12.     .timer[REMOVE_ $+ $chan $+ _MY_BANS] 1 6 remove_my_bans $chan
  13.     .timer[CHECK_ $+ $chan $+ _MUTELIST] 1 8 chk_all_mute_realname $chan
  14.  
  15.     return
  16.   }
  17.  
  18.   chk_all_op_realname $chan
  19.   chk_all_mute_realname $chan
  20. }
  21.  
  22. ON *:TEXT:*:?: {
  23.   tokenize 32 $strip($1-)
  24.  
  25.   if ($1 == !op) {
  26.     if (!$2) { msg $nick ( $+ $nick $+ ): Error, Insert a realname! | return }
  27.     if (!$3) { msg $nick ( $+ $nick $+ ): Error, Insert the channel! | return }
  28.     if ($2 == $me) { msg $nick ( $+ $nick $+ ): Error, You cannot use that on the bot! | return }
  29.     if ($me !ison $3) { msg $nick ( $+ $nick $+ ): Error, I am not on $3 channel! | return }
  30.     if (!$istok($channels,$3,44)) { msg $nick ( $+ $nick $+ ): I don't support the channel you enter! | return }
  31.     if (!$chk_access($nick,$3)) { msg $nick ( $+ $nick $+ ): Error, Access denied! | return }
  32.  
  33.     var %f = ops_ $+ $3 $+ .db
  34.     var %r = $read(%f,nw,$2)
  35.  
  36.     if (%r) { msg $nick ( $+ $nick $+ ): Error, This realname is already exists on $3 channel OP list! | return }
  37.  
  38.     write $qt(%f) $2
  39.  
  40.     chk_all_op_realname $3
  41.  
  42.     msg $nick ( $+ $nick $+ ): Realname $qt($2) has been added on $qt($3) channel OP list.
  43.   }
  44.  
  45.   if ($1 == !deop) {
  46.     if (!$2) { msg $nick ( $+ $nick $+ ): Error, Insert a realname! | return }
  47.     if (!$3) { msg $nick ( $+ $nick $+ ): Error, Insert the channel! | return }
  48.     if ($2 == $me) { msg $nick ( $+ $nick $+ ): Error, You cannot use that on the bot! | return }
  49.     if ($me !ison $3) { msg $nick ( $+ $nick $+ ): Error, I am not on $3 channel! | return }
  50.     if (!$istok($channels,$3,44)) { msg $nick ( $+ $nick $+ ): I don't support the channel you enter! | return }
  51.     if (!$chk_access($nick,$3)) { msg $nick ( $+ $nick $+ ): Error, Access denied! | return }
  52.  
  53.     var %f = ops_ $+ $3 $+ .db
  54.     var %r = $read(%f,nw,$2)
  55.     var %rn = $readn
  56.  
  57.     if (!%r) { msg $nick ( $+ $nick $+ ): Error, This realname does not exists on $3 channel OP list! | return }
  58.  
  59.     write -dl $+ %rn $qt(%f)
  60.  
  61.     chk_all_op_realname $3
  62.  
  63.     msg $nick ( $+ $nick $+ ): Realname $qt($2) has been removed from $qt($3) channel OP list.
  64.   }
  65.  
  66.   if ($1 == !oplist) {
  67.     if (!$2) { msg $nick ( $+ $nick $+ ): Error, Insert the channel! | return }
  68.     if (!$istok($channels,$2,44)) { msg $nick ( $+ $nick $+ ): I don't support the channel you enter! | return }
  69.     if (!$chk_access($nick,$2)) { msg $nick ( $+ $nick $+ ): Error, Access denied! | return }
  70.  
  71.     var %f = ops_ $+ $2 $+ .db
  72.     var %t = $lines(%f)
  73.  
  74.     if (!$file(%f)) { msg $nick ( $+ $nick $+ ): The OP list for $2 channel is empty! | return }
  75.  
  76.     var %i = 1
  77.     while (%i <= %t) {
  78.       var %r = $read(%f,n,%i)
  79.  
  80.       if (%r) { msg $nick $+([,%i,]:) %r }
  81.  
  82.       inc %i
  83.     }
  84.  
  85.     msg $nick ( $+ $nick $+ ): End of $2 channel OP list. - (Total: %t $+ )
  86.   }
  87.  
  88.   if ($1 == !opclear) {
  89.     if (!$2) { msg $nick ( $+ $nick $+ ): Error, Insert the channel! | return }
  90.     if (!$istok($channels,$2,44)) { msg $nick ( $+ $nick $+ ): I don't support the channel you enter! | return }
  91.     if ($me !ison $2) { msg $nick ( $+ $nick $+ ): Error, I am not on $3 channel! | return }
  92.     if (!$chk_access($nick,$2)) { msg $nick ( $+ $nick $+ ): Error, Access denied! | return }
  93.  
  94.     var %f = ops_ $+ $2 $+ .db
  95.     var %t = $lines(%f)
  96.  
  97.     if (!$file(%f)) { msg $nick ( $+ $nick $+ ): The OP list for $2 channel is empty! | return }
  98.  
  99.     .remove $qt(%f)
  100.  
  101.     chk_all_op_realname $2
  102.  
  103.     msg $nick ( $+ $nick $+ ): OP list for $2 channel is now cleared. - (Total: %t $+ )
  104.   }
  105.  
  106.   ; ------------
  107.  
  108.   if ($1 == !mute) {
  109.     if (!$2) { msg $nick ( $+ $nick $+ ): Error, Insert the channel! | return }
  110.     if ($me !ison $2) { msg $nick ( $+ $nick $+ ): Error, I am not on $3 channel! | return }
  111.     if (!$istok($channels,$2,44)) { msg $nick ( $+ $nick $+ ): I don't support the channel you enter! | return }
  112.     if (!$chk_access($nick,$2)) { msg $nick ( $+ $nick $+ ): Error, Access denied! | return }
  113.     if (!$3) { msg $nick ( $+ $nick $+ ): Error, Insert a realname! | return }
  114.     if ($ial($me).gecos == $3) { msg $nick ( $+ $nick $+ ): Error, You cannot add bot realname! | return }
  115.     if ($ial($nick).gecos == $3) { msg $nick ( $+ $nick $+ ): Error, You cannot add your realname! | return }
  116.  
  117.     if ($4) && ($4 isnum) { var %duration = $4 }
  118.     else { var %duration = 0 }
  119.  
  120.     var %f = mutes_ $+ $2 $+ .db
  121.     var %r = $read(%f,nw,$3)
  122.  
  123.     if (%r) { msg $nick ( $+ $nick $+ ): Error, This realname is already exists on $2 channel MUTE list! | return }
  124.  
  125.     write $qt(%f) $3 %duration
  126.  
  127.     chk_all_mute_realname $2
  128.  
  129.     msg $nick ( $+ $nick $+ ): Realname $qt($3) has been added on $qt($2) channel MUTE list. - Duration: $iif(%duration,$v1 minutes,Never)
  130.   }
  131.  
  132.   if ($1 == !unmute) {
  133.     if (!$2) { msg $nick ( $+ $nick $+ ): Error, Insert the channel! | return }
  134.     if ($me !ison $2) { msg $nick ( $+ $nick $+ ): Error, I am not on $3 channel! | return }
  135.     if (!$istok($channels,$2,44)) { msg $nick ( $+ $nick $+ ): I don't support the channel you enter! | return }
  136.     if (!$chk_access($nick,$2)) { msg $nick ( $+ $nick $+ ): Error, Access denied! | return }
  137.     if (!$3) { msg $nick ( $+ $nick $+ ): Error, Insert a realname! | return }
  138.     if ($ial($me).gecos == $3) { msg $nick ( $+ $nick $+ ): Error, You cannot add bot realname! | return }
  139.     if ($ial($nick).gecos == $3) { msg $nick ( $+ $nick $+ ): Error, You cannot add your realname! | return }
  140.  
  141.     var %f = mutes_ $+ $2 $+ .db
  142.     var %r = $read(%f,nw,$3 *)
  143.     var %rn = $readn
  144.     var %duration = $gettok(%r,2,32)
  145.  
  146.     if (!%r) { msg $nick ( $+ $nick $+ ): Error, This realname does not exists on $2 channel MUTE list! | return }
  147.  
  148.     write -dl $+ %rn $qt(%f)
  149.  
  150.     msg $nick ( $+ $nick $+ ): Realname $qt($3) has been removed from $qt($2) channel MUTE list.
  151.   }
  152.  
  153.   if ($1 == !mutelist) {
  154.     if (!$2) { msg $nick ( $+ $nick $+ ): Error, Insert the channel! | return }
  155.     if (!$istok($channels,$2,44)) { msg $nick ( $+ $nick $+ ): I don't support the channel you enter! | return }
  156.     if (!$chk_access($nick,$2)) { msg $nick ( $+ $nick $+ ): Error, Access denied! | return }
  157.  
  158.     var %f = mutes_ $+ $2 $+ .db
  159.     var %t = $lines(%f)
  160.  
  161.     if (!$file(%f)) { msg $nick ( $+ $nick $+ ): The MUTE list for $2 channel is empty! | return }
  162.  
  163.     var %i = 1
  164.     while (%i <= %t) {
  165.       var %r = $read(%f,n,%i)
  166.       var %n = $gettok(%r,1,32)
  167.       var %d = $gettok(%r,2,32)
  168.  
  169.       if (%r) { msg $nick $+([,%i,]:) %n - Duration: $iif(%d,$v1 minutes,Never) }
  170.  
  171.       inc %i
  172.     }
  173.  
  174.     msg $nick ( $+ $nick $+ ): End of $2 channel MUTE list. - (Total: %t $+ )
  175.   }
  176.  
  177. }
  178.  
  179. alias chk_access {
  180.   ; $chk_access(nick,#chan)
  181.  
  182.   if (!$1) || (!$2) || ($encode($network,m) !== Q2hhdEhVQg==) { return }
  183.  
  184.   var %f = $nick($2,$1).pnick
  185.  
  186.   if (*~* iswm %f) || (*&* iswm %f) { return 1 }
  187.  
  188.   return 0
  189. }
  190.  
  191. alias chk_all_op_realname {
  192.   ; /chk_all_op_realname #chan
  193.  
  194.   if (!$1) || ($me !ison $1) || ($me !isop $1) || ($encode($network,m) !== Q2hhdEhVQg==) { return }
  195.  
  196.   var %f = ops_ $+ $1 $+ .db
  197.   var %t = $nick($1,0)
  198.  
  199.   var %i = 1
  200.   while (%i <= %t) {
  201.     var %n = $nick($1,%i)
  202.     var %p = $remove($nick($1,%i).pnick,%n)
  203.     var %a = $gettok($ial(%n).gecos,1,32)
  204.     var %r = $read(%f,nw,%a)
  205.  
  206.     if (%n == $me) { goto next }
  207.  
  208.     if (%r) && (%n !isop $1) { mode $1 +o %n }
  209.     if (!%r) && (%n isop $1) { mode $1 -o %n }
  210.  
  211.     :next
  212.     inc %i
  213.   }
  214. }
  215.  
  216. alias chk_all_mute_realname {
  217.   ; /chk_all_mute_realname #chan
  218.  
  219.   if (!$1) || ($me !ison $1) || ($me !isop $1) || ($encode($network,m) !== Q2hhdEhVQg==) { return }
  220.  
  221.   var %f = mutes_ $+ $1 $+ .db
  222.   var %t = $nick($1,0)
  223.  
  224.   var %i = 1
  225.   while (%i <= %t) {
  226.     var %nick = $nick($1,%i)
  227.     var %host = $ial(%nick).host
  228.     var %gecos = $gettok($ial(%nick).gecos,1,32)
  229.     var %search = $read(%f,nw,%gecos *)
  230.     var %search_line = $readn
  231.     var %duration = $gettok(%search,2,32)
  232.  
  233.     if (%nick == $me) || (!%gecos) || (!%nick) || (!%host) || (!%search) { goto next }
  234.  
  235.     if (!%duration) { mode $1 +b ~q:*!*@ $+ %host }
  236.     elseif (%duration) { mode $1 +b ~t: $+ %duration $+ :~q:*!*@ $+ %host }
  237.  
  238.     :next
  239.     inc %i
  240.   }
  241. }
  242.  
  243. alias -l remove_my_bans {
  244.   ; /remove_my_bans <#channel>
  245.  
  246.   if (!$1) || ($me !ison $1) || ($me !isop $1) || ($encode($network,m) !== Q2hhdEhVQg==) { return }
  247.  
  248.   var %t = $ibl($1,0)
  249.  
  250.   if (!%t) { return }
  251.  
  252.   var %i = 1
  253.   while (%i <= %t) {
  254.     var %a = $ibl($1,%i)
  255.     var %b = $gettok($ibl($1,%i).by,1,33)
  256.  
  257.     if (%a) && (%b) && (%b == $me) { mode $1 -b %a }
  258.  
  259.     inc %i
  260.   }
  261.  
  262. }
  263.  
  264. raw 352:*: { haltdef }
  265. raw 315:*: { haltdef }
  266. raw 346:*: { haltdef }
  267. raw 347:*: { haltdef }
  268. raw 348:*: { haltdef }
  269. raw 349:*: { haltdef }
  270. raw 367:*: { haltdef }
  271. raw 368:*: { haltdef }
  272. raw 974:*: { haltdef }
  273.  
Add Comment
Please, Sign In to add comment