Advertisement
westor

Channel Mode Thanker for Koragg v3.0

Feb 7th, 2021 (edited)
2,122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 13.65 KB | None | 0 0
  1. ;mt
  2. ;taken from http://www.ladysclub.net/index.php/downloads/download/2-mirc-scripte/1-g-script.html
  3. ;Re-designed by westor
  4.  
  5. dialog -l thx {
  6.   title "THX Manager - (/mt)"
  7.   size -1 -1 172 266
  8.   option dbu
  9.   box "Voice", 1, 3 3 166 21
  10.   edit "", 2, 5 11 162 10, autohs
  11.   box "Halfop", 3, 3 51 166 21
  12.   edit "", 4, 5 59 162 10, autohs
  13.   box "Op", 5, 3 99 166 21
  14.   edit "", 6, 5 107 162 10, autohs
  15.   box "", 7, 3 242 166 21
  16.   check "Enable", 8, 10 250 40 10
  17.   ;box "", 9, 1 -2 170 267
  18.   box "Devoice", 10, 3 25 166 21
  19.   edit "", 11, 5 33 162 10, autohs
  20.   box "Dehalfop", 12, 3 73 166 21
  21.   edit "", 13, 5 81 162 10, autohs
  22.   edit "", 14, 5 128 162 10, autohs
  23.   box "Deop", 15, 3 120 166 21
  24.   box "Deprotect", 16, 3 167 166 21
  25.   box "Protect", 17, 3 146 166 21
  26.   edit "", 18, 5 154 162 10, autohs
  27.   edit "", 19, 5 175 162 10, autohs
  28.   box "Owner", 20, 3 193 166 21
  29.   box "Deowner", 21, 3 214 166 21
  30.   edit "", 22, 5 201 162 10, autohs
  31.   edit "", 23, 5 222 162 10, autohs
  32.   button "Exceptions", 24, 122 248 40 12, default
  33. }
  34.  
  35. dialog -l thx_exceptions {
  36.   title "THX Exceptions - (/mte)"
  37.   size -1 -1 160 109
  38.   option dbu
  39.   box "Exceptions List (0)", 1, 2 3 120 105
  40.   list 3, 4 11 116 95, size hsbar vsbar disable
  41.   button "+", 4, 123 10 19 15
  42.   button "-", 5, 123 26 19 15, disable
  43.   button "Up", 2, 123 73 19 15, disable
  44.   button "Down", 6, 123 89 19 15, disable
  45. }
  46.  
  47. ; ----
  48.  
  49. ON *:START: { thx_init }
  50. ON *:LOAD: { thx_init }
  51.  
  52. ON *:EXIT: {
  53.   if ($hget(thx)) { hsave thx $qt(settings.hsh) }
  54. }
  55.  
  56. ON *:DIALOG:thx:*:*: {
  57.   if ($devent == init) {
  58.     if ($hget(thx,akt)) { did -c $dname 8 }
  59.     if ($hget(thx,voice)) { did -a $dname 2 $v1 }
  60.     if ($hget(thx,devoice)) { did -a $dname 11 $v1 }
  61.     if ($hget(thx,help)) { did -a $dname 4 $v1 }
  62.     if ($hget(thx,dehelp)) { did -a $dname 13 $v1 }
  63.     if ($hget(thx,op)) { did -a $dname 6 $v1 }
  64.     if ($hget(thx,deop)) { did -a $dname 14 $v1 }
  65.     if ($hget(thx,admin)) { did -a $dname 18 $v1 }
  66.     if ($hget(thx,deadmin)) { did -a $dname 19 $v1 }
  67.     if ($hget(thx,owner)) { did -a $dname 22 $v1 }
  68.     if ($hget(thx,deowner)) { did -a $dname 23 $v1 }
  69.   }
  70.  
  71.   if ($devent == edit) {
  72.     if ($did == 2) {
  73.       if ($did($did).text) { hadd -m thx voice $v1 }
  74.       else { hdel thx voice }
  75.     }
  76.  
  77.     if ($did == 4) {
  78.       if ($did($did).text) { hadd -m thx help $v1 }
  79.       else { hdel thx help }
  80.     }
  81.  
  82.     if ($did == 6) {
  83.       if ($did($did).text) { hadd -m thx op $v1 }
  84.       else { hdel thx op }
  85.     }
  86.  
  87.     if ($did == 11) {
  88.       if ($did($did).text) { hadd -m thx devoice $v1 }
  89.       else { hdel thx devoice }
  90.     }
  91.  
  92.     if ($did == 13) {
  93.       if ($did($did).text) { hadd -m thx dehelp $v1 }
  94.       else { hdel thx dehelp }
  95.     }
  96.  
  97.     if ($did == 14) {
  98.       if ($did($did).text) { hadd -m thx deop $v1 }
  99.       else { hdel thx deop }
  100.     }
  101.  
  102.     if ($did == 18) {
  103.       if ($did($did).text) { hadd -m thx admin $v1 }
  104.       else { hdel thx admin }
  105.     }
  106.  
  107.     if ($did == 19) {
  108.       if ($did($did).text) { hadd -m thx deadmin $v1 }
  109.       else { hdel thx deadmin }
  110.     }
  111.  
  112.     if ($did == 22) {
  113.       if ($did($did).text) { hadd -m thx owner $v1 }
  114.       else { hdel thx owner }
  115.     }
  116.  
  117.     if ($did == 23) {
  118.       if ($did($did).text) { hadd -m thx deowner $v1 }
  119.       else { hdel thx deowner }
  120.     }
  121.   }
  122.  
  123.   if ($devent == sclick) {
  124.     if ($did == 24) { dialog -i $dname | mte }
  125.     if ($did == 8) { hadd -m thx akt $did($did).state }
  126.   }
  127.  
  128.   if ($devent == close) {
  129.     if ($hget(thx)) { hsave thx $qt(settings.hsh) }
  130.   }
  131. }
  132.  
  133. ON *:DIALOG:thx_exceptions:*:*: {
  134.   if ($devent == init) { thx_except_list }
  135.  
  136.   if ($devent == dclick) && ($did == 3) {
  137.     var %t = $did(3).seltext
  138.  
  139.     if (!%t) { return }
  140.  
  141.     var %n = $gettok(%t,1,166)
  142.     var %c = $gettok(%t,2,166)
  143.     var %p = $gettok(%t,3,166)
  144.  
  145.     noop $input(Network: %n $crlf $+ Channel: %c $crlf $+ Nickname: %p,oidu,Info)
  146.   }
  147.  
  148.   if ($devent == sclick) {
  149.     if ($did == 2) {
  150.       var %sel = $did(3).seltext
  151.       var %pos = $did(3).sel
  152.  
  153.       if (!%sel) && (!%pos) { return }
  154.  
  155.       var %items = $hget(thx,exceptions)
  156.       var %move = $thx_movetok(%items,%sel,$calc(%pos - 1),32)
  157.  
  158.       hadd -m thx exceptions %move
  159.  
  160.       thx_except_list
  161.     }
  162.  
  163.     if ($did == 6) {
  164.       var %sel = $did(3).seltext
  165.       var %pos = $did(3).sel
  166.  
  167.       if (!%sel) && (!%pos) { return }
  168.  
  169.       var %items = $hget(thx,exceptions)
  170.       var %move = $thx_movetok(%items,%sel,$calc(%pos + 1),32)
  171.  
  172.       hadd -m thx exceptions %move
  173.  
  174.       thx_except_list
  175.     }
  176.  
  177.     if ($did == 3) {
  178.       if (!$did($did).seltext) { did -ft $dname 4 | return }
  179.  
  180.       did -eft $dname 5
  181.  
  182.       if ($did(3).lines > 1) { did -e $dname 2,6 }
  183.  
  184.       if ($did(3).sel == 1) { did -b $dname 2 }
  185.       if ($did(3).sel == $did(3).lines) { did -b $dname 6 }
  186.     }
  187.  
  188.     if ($did == 5) {
  189.       var %t = $did(3).seltext
  190.  
  191.       if (!%t) { thx_except_list | return }
  192.  
  193.       var %items = $remtok($hget(thx,exceptions),%t,1,32)
  194.  
  195.       if (%items) { hadd -m thx exceptions %items }
  196.       else { hdel thx exceptions }
  197.  
  198.       thx_except_list
  199.     }
  200.  
  201.     if ($did == 4) {
  202.       var %network = $input(Enter here the NETWORK you wanna add. $crlf $crlf $+ $+ (Leave it empty and press "OK" to ignore this) $crlf $crlf $+ $+ NOTE: If this field is empty that means its effecting all your $str($chr(2),7) connected networks.,eoidu,Enter)
  203.  
  204.       if (%network !== $null) && ($chr(166) isin %network) { noop $input(You cannot use $qt($chr(166)) character!,houd,Error) | thx_except_list | return }
  205.       if (%network !== $null) && ($chr(42) isin %network) { noop $input(You cannot use $qt($chr(42)) character!,houd,Error) | thx_except_list | return }
  206.       if (%network !== $null) && ($numtok(%network,32) !== 1) { noop $input(You must use only 1 parameter!,houd,Error) | thx_except_list | return }
  207.  
  208.       var %channel = $input(Enter here the #CHANNEL you wanna add. $crlf $crlf $+ $+ (Leave it empty and press "OK" to ignore this) $crlf $crlf $+ $+ NOTE: If this field is empty that means its effecting all your $str($chr(2),7) joined channels.,eoidu,Enter)
  209.  
  210.       if (%channel !== $null) && ($chr(166) isin %channel) { noop $input(You cannot use $qt($chr(166)) character!,houd,Error) | thx_except_list | return }
  211.       if (%channel !== $null) && ($chr(42) isin %channel) { noop $input(You cannot use $qt($chr(42)) character!,houd,Error) | thx_except_list | return }
  212.       if (%channel !== $null) && ($left(%channel,1) !== $chr(35)) { noop $input(You must use $qt($chr(35)) character in front of the channel name!,houd,Error) | thx_except_list | return }
  213.       if (%channel !== $null) && ($numtok(%channel,32) !== 1) { noop $input(You must use only 1 parameter!,houd,Error) | thx_except_list | return }
  214.       if (%channel !== $null) && ($chr(44) isin %channel) { noop $input(You must use only 1 channel!,houd,Error) | thx_except_list | return }
  215.  
  216.       var %nick = $input(Enter here the NICKNAME you wanna add. $crlf $crlf $+ $+ (Leave it empty and press "OK" to ignore this) $crlf $crlf $+ $+ NOTE: If this field is empty that means its effecting everyone.,eoidu,Enter)
  217.  
  218.       if (%nick !== $null) && ($numtok(%nick,32) !== 1) { noop $input(You must use only 1 parameter!,houd,Error) | thx_except_list | return }
  219.       if (%nick !== $null) && ($chr(166) isin %nick) { noop $input(You cannot use $qt($chr(166)) character!,houd,Error) | thx_except_list | return }
  220.  
  221.       if (%network == $null) && (%channel == $null) && (%nick == $nul) { thx_except_list | return }
  222.  
  223.       var %temp_nick = $iif(%nick,$v1,*)
  224.       var %temp_network = $iif(%network,$v1,*)
  225.       var %temp_channel = $iif(%channel,$v1,*)
  226.  
  227.       var %hash = $hget(thx,exceptions)
  228.       var %add = $+(%temp_network,$chr(166),%temp_channel,$chr(166),%temp_nick)
  229.  
  230.       if ($istok(%hash,%add,32)) { noop $input(This item is already exists!,houd,Error) | thx_except_list | return }
  231.  
  232.       var %items = $addtok(%hash,%add,32)
  233.  
  234.       hadd -m thx exceptions %items
  235.  
  236.       thx_except_list
  237.     }
  238.  
  239.   }
  240.  
  241.   if ($devent == close) {
  242.     if ($hget(thx)) { hsave thx $qt(settings.hsh) }
  243.     if ($dialog(thx)) { dialog -e $v1 }
  244.   }
  245. }
  246.  
  247. ON !*:OWNER:#: {
  248.   if ($onick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
  249.  
  250.   thx_set $network $chan $nick $event q
  251. }
  252.  
  253. ON !*:DEOWNER:#: {
  254.   if ($onick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
  255.  
  256.   thx_set $network $chan $nick $event q
  257. }
  258.  
  259. ON !*:ADMIN:#: {
  260.   if ($admnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
  261.  
  262.   thx_set $network $chan $nick $event a
  263. }
  264.  
  265. ON !*:DEADMIN:#: {
  266.   if ($admnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
  267.  
  268.   thx_set $network $chan $nick $event a
  269. }
  270.  
  271. ON !*:OP:#: {
  272.   if ($opnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
  273.  
  274.   thx_set $network $chan $nick $event o
  275. }
  276.  
  277. ON !*:DEOP:#: {
  278.   if ($opnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
  279.  
  280.   thx_set $network $chan $nick $event o
  281. }
  282.  
  283. ON !*:HELP:#: {
  284.   if ($hnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
  285.  
  286.   thx_set $network $chan $nick $event h
  287. }
  288.  
  289. ON !*:DEHELP:#: {
  290.   if ($hnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
  291.  
  292.   thx_set $network $chan $nick $event h
  293. }
  294.  
  295. ON !*:VOICE:#: {
  296.   if ($vnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
  297.  
  298.   thx_set $network $chan $nick $event v
  299. }
  300.  
  301. ON !*:DEVOICE:#: {
  302.   if ($vnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
  303.  
  304.   thx_set $network $chan $nick $event v
  305. }
  306.  
  307. ; ----
  308.  
  309. alias mt { $iif(!$dialog(thx),dialog -md,dialog -ve) thx thx }
  310. alias mte { $iif(!$dialog(thx_exceptions),dialog -md,dialog -ve) thx_exceptions thx_exceptions }
  311.  
  312. alias -l thx_set {
  313.   ; /thx_set <network> <#channel> <nickname> <event> <flag>
  314.  
  315.   if (!$1) && (!$2) && (!$3) && (!$4) && (!$5) { return }
  316.  
  317.   var %exception = $thx_check_exception($1,$2,$3)
  318.  
  319.   if (%exception) { return }
  320.  
  321.   var %h = THX_ $+ $1 $+ _ $+ $2
  322.  
  323.   if ($4 == owner) || ($4 == admin) || ($4 == op) || ($4 == help) || ($4 == voice) {
  324.     var %-modes = $remtok($hget(%h,-MODES),$5,1,32)
  325.     var %+modes = $addtok($hget(%h,+MODES),$5,32)
  326.   }
  327.  
  328.   if ($4 == deowner) || ($4 == deadmin) || ($4 == deop) || ($4 == dehelp) || ($4 == devoice) {
  329.     var %+modes = $remtok($hget(%h,+MODES),$5,1,32)
  330.     var %-modes = $addtok($hget(%h,-MODES),$5,32)
  331.   }
  332.  
  333.   if (%+modes) { hadd -mu5 %h +MODES %+modes }
  334.   else {
  335.     if ($hget(%h,+MODES)) { hdel %h +MODES }
  336.   }
  337.  
  338.   if (%-modes) { hadd -mu5 %h -MODES %-modes }
  339.   else {
  340.     if ($hget(%h,-MODES)) { hdel %h -MODES }
  341.   }
  342.  
  343.   .timer[THX_ $+ $1 $+ _ $+ $2 $+ ] -h 1 100 thx_check_action $1 $2 $3 $4
  344. }
  345.  
  346. alias thx_check_action {
  347.   ; /thx_check_action <network> <#channel> <nickname> <event>
  348.  
  349.   if (!$1) && (!$2) && (!$3) && (!$4) { return }
  350.  
  351.   var %h = THX_ $+ $1 $+ _ $+ $2
  352.   var %+modes = $hget(%h,+MODES)
  353.   var %-modes = $hget(%h,-MODES)
  354.   var %modes = %+modes %-modes
  355.  
  356.   if ($hget(%h)) { hfree $v1 }
  357.  
  358.   if ($timer($+([,%h,_STOP]))) { return }
  359.  
  360.   if (*q* iswm %modes) {
  361.     if (*q* iswm %+modes) { .notice $3 $evalnext($hget(thx,owner)) }
  362.     elseif (*q* iswm %-modes) { .notice $3 $evalnext($hget(thx,deowner)) }
  363.  
  364.     goto end
  365.   }
  366.  
  367.   if (*a* iswm %modes) {
  368.     if (*a* iswm %+modes) { .notice $3 $evalnext($hget(thx,admin)) }
  369.     elseif (*a* iswm %-modes) { .notice $3 $evalnext($hget(thx,deadmin)) }
  370.  
  371.     goto end
  372.   }
  373.  
  374.   if (*o* iswm %modes) {
  375.     if (*o* iswm %+modes) { .notice $3 $evalnext($hget(thx,op)) }
  376.     elseif (*o* iswm %-modes) { .notice $3 $evalnext($hget(thx,deop)) }
  377.  
  378.     goto end
  379.   }
  380.  
  381.   if (*h* iswm %modes) {
  382.     if (*h* iswm %+modes) { .notice $3 $evalnext($hget(thx,help)) }
  383.     elseif (*h* iswm %-modes) { .notice $3 $evalnext($hget(thx,dehelp)) }
  384.  
  385.     goto end
  386.   }
  387.  
  388.   if (*v* iswm %modes) {
  389.     if (*v* iswm %+modes) { .notice $3 $evalnext($hget(thx,voice)) }
  390.     elseif (*v* iswm %-modes) { .notice $3 $evalnext($hget(thx,devoice)) }
  391.  
  392.     goto end
  393.   }
  394.  
  395.   :end
  396.  
  397.   .timer[ $+ %h $+ _STOP] 1 60 noop
  398. }
  399.  
  400. alias -l thx_check_exception {
  401.   ; $thx_check_exception(network,#channel,nickname)
  402.  
  403.   if (!$1) && (!$2) && (!$3) { return 0 }
  404.  
  405.   var %items = $hget(thx,exceptions)
  406.  
  407.   if (!%items) { return 0 }
  408.  
  409.   var %i = 1
  410.   while (%i <= $numtok(%items,32)) {
  411.     var %m = $gettok(%items,%i,32)
  412.  
  413.     if (!%m) { goto next }
  414.  
  415.     var %w = $iif($gettok(%m,1,166) == *,$1,$v1)
  416.     var %c = $iif($gettok(%m,2,166) == *,$2,$v1)
  417.     var %n = $iif($gettok(%m,3,166) == *,$3,$v1)
  418.  
  419.     var %k = $+(%w,$chr(166),%c,$chr(166),%n)
  420.     var %z = $+($1,$chr(166),$2,$chr(166),$3)
  421.  
  422.     if (%z == %k) { return 1 }
  423.  
  424.     :next
  425.     inc %i
  426.   }
  427.  
  428.   return 0
  429. }
  430.  
  431. alias -l thx_except_list {
  432.   ; /thx_except_list
  433.  
  434.   did -cr $dname 3
  435.   did -b $dname 3,5,2,6
  436.  
  437.   var %t = $hget(thx,exceptions)
  438.   var %i = 1
  439.  
  440.   while (%i <= $numtok(%t,32)) {
  441.     var %m = $gettok(%t,%i,32)
  442.  
  443.     if (%m) { did -ea $dname 3 %m }
  444.  
  445.     inc %i
  446.   }
  447.  
  448.   did -ft $dname 4
  449.  
  450.   if ($did(3).lines) { did -ra $dname 1 $iif($v1 == 1,Exception List,Exceptions List) ( $+ $v1 $+ ) }
  451.   else { did -ra $dname 1 Exceptions List (0) }
  452. }
  453.  
  454. alias -l thx_init {
  455.   ; /thx_init
  456.  
  457.   var %h = thx
  458.   var %f = settings.hsh
  459.  
  460.   if ($hget(%h)) { hfree $v1 }
  461.   if (!$hget(%h)) { hmake %h 100 }
  462.   if ($file(%f)) { hload %h $qt(%f) }
  463. }
  464.  
  465. alias -l thx_movetok {
  466.   ; $thx_movetok(text,string,N,C)
  467.  
  468.   if ($1 == $null) || ($2 == $null) || ($3 == $null) || ($4 == $null) { return }
  469.  
  470.   var %f = $findtok($1,$2,1,$4)
  471.  
  472.   if (!%f) || ($3 !isnum) || ($3 < 1) || ($4 !isnum) { return }
  473.  
  474.   if (%f > $3) { var %n = $instok($1,$2,$3,$4) | var %r = $deltok(%n,$calc(%f + 1),$4) }
  475.   else { var %n = $instok($1,$2,$calc($3 + 1),$4) | var %r = $deltok(%n,%f,$4) }
  476.  
  477.   return %r
  478. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement