Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;mt
- ;taken from http://www.ladysclub.net/index.php/downloads/download/2-mirc-scripte/1-g-script.html
- ;Re-designed by westor
- dialog -l thx {
- title "THX Manager - (/mt)"
- size -1 -1 172 266
- option dbu
- box "Voice", 1, 3 3 166 21
- edit "", 2, 5 11 162 10, autohs
- box "Halfop", 3, 3 51 166 21
- edit "", 4, 5 59 162 10, autohs
- box "Op", 5, 3 99 166 21
- edit "", 6, 5 107 162 10, autohs
- box "", 7, 3 242 166 21
- check "Enable", 8, 10 250 40 10
- ;box "", 9, 1 -2 170 267
- box "Devoice", 10, 3 25 166 21
- edit "", 11, 5 33 162 10, autohs
- box "Dehalfop", 12, 3 73 166 21
- edit "", 13, 5 81 162 10, autohs
- edit "", 14, 5 128 162 10, autohs
- box "Deop", 15, 3 120 166 21
- box "Deprotect", 16, 3 167 166 21
- box "Protect", 17, 3 146 166 21
- edit "", 18, 5 154 162 10, autohs
- edit "", 19, 5 175 162 10, autohs
- box "Owner", 20, 3 193 166 21
- box "Deowner", 21, 3 214 166 21
- edit "", 22, 5 201 162 10, autohs
- edit "", 23, 5 222 162 10, autohs
- button "Exceptions", 24, 122 248 40 12, default
- }
- dialog -l thx_exceptions {
- title "THX Exceptions - (/mte)"
- size -1 -1 160 109
- option dbu
- box "Exceptions List (0)", 1, 2 3 120 105
- list 3, 4 11 116 95, size hsbar vsbar disable
- button "+", 4, 123 10 19 15
- button "-", 5, 123 26 19 15, disable
- button "Up", 2, 123 73 19 15, disable
- button "Down", 6, 123 89 19 15, disable
- }
- ; ----
- ON *:START: { thx_init }
- ON *:LOAD: { thx_init }
- ON *:EXIT: {
- if ($hget(thx)) { hsave thx $qt(settings.hsh) }
- }
- ON *:DIALOG:thx:*:*: {
- if ($devent == init) {
- if ($hget(thx,akt)) { did -c $dname 8 }
- if ($hget(thx,voice)) { did -a $dname 2 $v1 }
- if ($hget(thx,devoice)) { did -a $dname 11 $v1 }
- if ($hget(thx,help)) { did -a $dname 4 $v1 }
- if ($hget(thx,dehelp)) { did -a $dname 13 $v1 }
- if ($hget(thx,op)) { did -a $dname 6 $v1 }
- if ($hget(thx,deop)) { did -a $dname 14 $v1 }
- if ($hget(thx,admin)) { did -a $dname 18 $v1 }
- if ($hget(thx,deadmin)) { did -a $dname 19 $v1 }
- if ($hget(thx,owner)) { did -a $dname 22 $v1 }
- if ($hget(thx,deowner)) { did -a $dname 23 $v1 }
- }
- if ($devent == edit) {
- if ($did == 2) {
- if ($did($did).text) { hadd -m thx voice $v1 }
- else { hdel thx voice }
- }
- if ($did == 4) {
- if ($did($did).text) { hadd -m thx help $v1 }
- else { hdel thx help }
- }
- if ($did == 6) {
- if ($did($did).text) { hadd -m thx op $v1 }
- else { hdel thx op }
- }
- if ($did == 11) {
- if ($did($did).text) { hadd -m thx devoice $v1 }
- else { hdel thx devoice }
- }
- if ($did == 13) {
- if ($did($did).text) { hadd -m thx dehelp $v1 }
- else { hdel thx dehelp }
- }
- if ($did == 14) {
- if ($did($did).text) { hadd -m thx deop $v1 }
- else { hdel thx deop }
- }
- if ($did == 18) {
- if ($did($did).text) { hadd -m thx admin $v1 }
- else { hdel thx admin }
- }
- if ($did == 19) {
- if ($did($did).text) { hadd -m thx deadmin $v1 }
- else { hdel thx deadmin }
- }
- if ($did == 22) {
- if ($did($did).text) { hadd -m thx owner $v1 }
- else { hdel thx owner }
- }
- if ($did == 23) {
- if ($did($did).text) { hadd -m thx deowner $v1 }
- else { hdel thx deowner }
- }
- }
- if ($devent == sclick) {
- if ($did == 24) { dialog -i $dname | mte }
- if ($did == 8) { hadd -m thx akt $did($did).state }
- }
- if ($devent == close) {
- if ($hget(thx)) { hsave thx $qt(settings.hsh) }
- }
- }
- ON *:DIALOG:thx_exceptions:*:*: {
- if ($devent == init) { thx_except_list }
- if ($devent == dclick) && ($did == 3) {
- var %t = $did(3).seltext
- if (!%t) { return }
- var %n = $gettok(%t,1,166)
- var %c = $gettok(%t,2,166)
- var %p = $gettok(%t,3,166)
- noop $input(Network: %n $crlf $+ Channel: %c $crlf $+ Nickname: %p,oidu,Info)
- }
- if ($devent == sclick) {
- if ($did == 2) {
- var %sel = $did(3).seltext
- var %pos = $did(3).sel
- if (!%sel) && (!%pos) { return }
- var %items = $hget(thx,exceptions)
- var %move = $thx_movetok(%items,%sel,$calc(%pos - 1),32)
- hadd -m thx exceptions %move
- thx_except_list
- }
- if ($did == 6) {
- var %sel = $did(3).seltext
- var %pos = $did(3).sel
- if (!%sel) && (!%pos) { return }
- var %items = $hget(thx,exceptions)
- var %move = $thx_movetok(%items,%sel,$calc(%pos + 1),32)
- hadd -m thx exceptions %move
- thx_except_list
- }
- if ($did == 3) {
- if (!$did($did).seltext) { did -ft $dname 4 | return }
- did -eft $dname 5
- if ($did(3).lines > 1) { did -e $dname 2,6 }
- if ($did(3).sel == 1) { did -b $dname 2 }
- if ($did(3).sel == $did(3).lines) { did -b $dname 6 }
- }
- if ($did == 5) {
- var %t = $did(3).seltext
- if (!%t) { thx_except_list | return }
- var %items = $remtok($hget(thx,exceptions),%t,1,32)
- if (%items) { hadd -m thx exceptions %items }
- else { hdel thx exceptions }
- thx_except_list
- }
- if ($did == 4) {
- 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)
- if (%network !== $null) && ($chr(166) isin %network) { noop $input(You cannot use $qt($chr(166)) character!,houd,Error) | thx_except_list | return }
- if (%network !== $null) && ($chr(42) isin %network) { noop $input(You cannot use $qt($chr(42)) character!,houd,Error) | thx_except_list | return }
- if (%network !== $null) && ($numtok(%network,32) !== 1) { noop $input(You must use only 1 parameter!,houd,Error) | thx_except_list | return }
- 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)
- if (%channel !== $null) && ($chr(166) isin %channel) { noop $input(You cannot use $qt($chr(166)) character!,houd,Error) | thx_except_list | return }
- if (%channel !== $null) && ($chr(42) isin %channel) { noop $input(You cannot use $qt($chr(42)) character!,houd,Error) | thx_except_list | return }
- 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 }
- if (%channel !== $null) && ($numtok(%channel,32) !== 1) { noop $input(You must use only 1 parameter!,houd,Error) | thx_except_list | return }
- if (%channel !== $null) && ($chr(44) isin %channel) { noop $input(You must use only 1 channel!,houd,Error) | thx_except_list | return }
- 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)
- if (%nick !== $null) && ($numtok(%nick,32) !== 1) { noop $input(You must use only 1 parameter!,houd,Error) | thx_except_list | return }
- if (%nick !== $null) && ($chr(166) isin %nick) { noop $input(You cannot use $qt($chr(166)) character!,houd,Error) | thx_except_list | return }
- if (%network == $null) && (%channel == $null) && (%nick == $nul) { thx_except_list | return }
- var %temp_nick = $iif(%nick,$v1,*)
- var %temp_network = $iif(%network,$v1,*)
- var %temp_channel = $iif(%channel,$v1,*)
- var %hash = $hget(thx,exceptions)
- var %add = $+(%temp_network,$chr(166),%temp_channel,$chr(166),%temp_nick)
- if ($istok(%hash,%add,32)) { noop $input(This item is already exists!,houd,Error) | thx_except_list | return }
- var %items = $addtok(%hash,%add,32)
- hadd -m thx exceptions %items
- thx_except_list
- }
- }
- if ($devent == close) {
- if ($hget(thx)) { hsave thx $qt(settings.hsh) }
- if ($dialog(thx)) { dialog -e $v1 }
- }
- }
- ON !*:OWNER:#: {
- if ($onick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
- thx_set $network $chan $nick $event q
- }
- ON !*:DEOWNER:#: {
- if ($onick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
- thx_set $network $chan $nick $event q
- }
- ON !*:ADMIN:#: {
- if ($admnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
- thx_set $network $chan $nick $event a
- }
- ON !*:DEADMIN:#: {
- if ($admnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
- thx_set $network $chan $nick $event a
- }
- ON !*:OP:#: {
- if ($opnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
- thx_set $network $chan $nick $event o
- }
- ON !*:DEOP:#: {
- if ($opnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
- thx_set $network $chan $nick $event o
- }
- ON !*:HELP:#: {
- if ($hnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
- thx_set $network $chan $nick $event h
- }
- ON !*:DEHELP:#: {
- if ($hnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
- thx_set $network $chan $nick $event h
- }
- ON !*:VOICE:#: {
- if ($vnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
- thx_set $network $chan $nick $event v
- }
- ON !*:DEVOICE:#: {
- if ($vnick !== $me) || (!$hget(thx,$event)) || (!$hget(thx,akt)) { return }
- thx_set $network $chan $nick $event v
- }
- ; ----
- alias mt { $iif(!$dialog(thx),dialog -md,dialog -ve) thx thx }
- alias mte { $iif(!$dialog(thx_exceptions),dialog -md,dialog -ve) thx_exceptions thx_exceptions }
- alias -l thx_set {
- ; /thx_set <network> <#channel> <nickname> <event> <flag>
- if (!$1) && (!$2) && (!$3) && (!$4) && (!$5) { return }
- var %exception = $thx_check_exception($1,$2,$3)
- if (%exception) { return }
- var %h = THX_ $+ $1 $+ _ $+ $2
- if ($4 == owner) || ($4 == admin) || ($4 == op) || ($4 == help) || ($4 == voice) {
- var %-modes = $remtok($hget(%h,-MODES),$5,1,32)
- var %+modes = $addtok($hget(%h,+MODES),$5,32)
- }
- if ($4 == deowner) || ($4 == deadmin) || ($4 == deop) || ($4 == dehelp) || ($4 == devoice) {
- var %+modes = $remtok($hget(%h,+MODES),$5,1,32)
- var %-modes = $addtok($hget(%h,-MODES),$5,32)
- }
- if (%+modes) { hadd -mu5 %h +MODES %+modes }
- else {
- if ($hget(%h,+MODES)) { hdel %h +MODES }
- }
- if (%-modes) { hadd -mu5 %h -MODES %-modes }
- else {
- if ($hget(%h,-MODES)) { hdel %h -MODES }
- }
- .timer[THX_ $+ $1 $+ _ $+ $2 $+ ] -h 1 100 thx_check_action $1 $2 $3 $4
- }
- alias thx_check_action {
- ; /thx_check_action <network> <#channel> <nickname> <event>
- if (!$1) && (!$2) && (!$3) && (!$4) { return }
- var %h = THX_ $+ $1 $+ _ $+ $2
- var %+modes = $hget(%h,+MODES)
- var %-modes = $hget(%h,-MODES)
- var %modes = %+modes %-modes
- if ($hget(%h)) { hfree $v1 }
- if ($timer($+([,%h,_STOP]))) { return }
- if (*q* iswm %modes) {
- if (*q* iswm %+modes) { .notice $3 $evalnext($hget(thx,owner)) }
- elseif (*q* iswm %-modes) { .notice $3 $evalnext($hget(thx,deowner)) }
- goto end
- }
- if (*a* iswm %modes) {
- if (*a* iswm %+modes) { .notice $3 $evalnext($hget(thx,admin)) }
- elseif (*a* iswm %-modes) { .notice $3 $evalnext($hget(thx,deadmin)) }
- goto end
- }
- if (*o* iswm %modes) {
- if (*o* iswm %+modes) { .notice $3 $evalnext($hget(thx,op)) }
- elseif (*o* iswm %-modes) { .notice $3 $evalnext($hget(thx,deop)) }
- goto end
- }
- if (*h* iswm %modes) {
- if (*h* iswm %+modes) { .notice $3 $evalnext($hget(thx,help)) }
- elseif (*h* iswm %-modes) { .notice $3 $evalnext($hget(thx,dehelp)) }
- goto end
- }
- if (*v* iswm %modes) {
- if (*v* iswm %+modes) { .notice $3 $evalnext($hget(thx,voice)) }
- elseif (*v* iswm %-modes) { .notice $3 $evalnext($hget(thx,devoice)) }
- goto end
- }
- :end
- .timer[ $+ %h $+ _STOP] 1 60 noop
- }
- alias -l thx_check_exception {
- ; $thx_check_exception(network,#channel,nickname)
- if (!$1) && (!$2) && (!$3) { return 0 }
- var %items = $hget(thx,exceptions)
- if (!%items) { return 0 }
- var %i = 1
- while (%i <= $numtok(%items,32)) {
- var %m = $gettok(%items,%i,32)
- if (!%m) { goto next }
- var %w = $iif($gettok(%m,1,166) == *,$1,$v1)
- var %c = $iif($gettok(%m,2,166) == *,$2,$v1)
- var %n = $iif($gettok(%m,3,166) == *,$3,$v1)
- var %k = $+(%w,$chr(166),%c,$chr(166),%n)
- var %z = $+($1,$chr(166),$2,$chr(166),$3)
- if (%z == %k) { return 1 }
- :next
- inc %i
- }
- return 0
- }
- alias -l thx_except_list {
- ; /thx_except_list
- did -cr $dname 3
- did -b $dname 3,5,2,6
- var %t = $hget(thx,exceptions)
- var %i = 1
- while (%i <= $numtok(%t,32)) {
- var %m = $gettok(%t,%i,32)
- if (%m) { did -ea $dname 3 %m }
- inc %i
- }
- did -ft $dname 4
- if ($did(3).lines) { did -ra $dname 1 $iif($v1 == 1,Exception List,Exceptions List) ( $+ $v1 $+ ) }
- else { did -ra $dname 1 Exceptions List (0) }
- }
- alias -l thx_init {
- ; /thx_init
- var %h = thx
- var %f = settings.hsh
- if ($hget(%h)) { hfree $v1 }
- if (!$hget(%h)) { hmake %h 100 }
- if ($file(%f)) { hload %h $qt(%f) }
- }
- alias -l thx_movetok {
- ; $thx_movetok(text,string,N,C)
- if ($1 == $null) || ($2 == $null) || ($3 == $null) || ($4 == $null) { return }
- var %f = $findtok($1,$2,1,$4)
- if (!%f) || ($3 !isnum) || ($3 < 1) || ($4 !isnum) { return }
- if (%f > $3) { var %n = $instok($1,$2,$3,$4) | var %r = $deltok(%n,$calc(%f + 1),$4) }
- else { var %n = $instok($1,$2,$calc($3 + 1),$4) | var %r = $deltok(%n,%f,$4) }
- return %r
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement