alias -l chl.dlg { dialog -m chlimit chlimit }
alias -l chl.dlg2 { dialog -m chadd chadd }
alias -l chl.del {
var %c = $hget(chltbl,$did(2).sel).item
if (%chl.emode == on) { var %m = on | set %chl.emode off }
if ($me isop %c) { mode %c -l }
hdel chltbl %c
if (%m == on) { set %chl.emode on }
chl.load
}
alias -l chl.load {
var %x = 1
did -r chlimit 2
while ($hget(chltbl,%x).item != $null) {
var %y = $hget(chltbl,%x).item
did -a chlimit 2 %y
inc %x
}
}
dialog chlimit {
title "Limit zaščita by Master^MC"
size -1 -1 177 98
option dbu
list 2, 3 11 130 59, size vsbar
button "Ok", 6, 74 85 35 11, ok
check "Uporabi silo, ko nastavijo -l?", 3, 3 71 86 10
button "Dodaj", 4, 139 11 35 11
button "Uredi", 5, 139 28 35 11
button "Odstrani", 7, 139 45 35 11
text "Kanali", 1, 3 2 25 8
}
on *:dialog:chlimit:sclick:*:{
if ($did == 3) {
if ($did(3).state == 0) { set %chl.emode off }
if ($did(3).state == 1) { set %chl.emode on }
}
if ($did == 4) { chl.dlg2 }
if ($did == 5) {
chl.dlg2
did -a chadd 8 $hget(chltbl,$did(2).sel).item
did -a chadd 10 $hget(chltbl,$did(2).sel)
}
if ($did == 7) { chl.del }
}
on *:dialog:chlimit:init:*:{
if (%chl.emode == on) { did -c $dname 3 }
chl.load
}
dialog chadd {
title "Kanalni limit"
size -1 -1 137 46
option dbu
text "Kanal:", 7, 3 5 25 8
edit "", 8, 29 4 105 10
text "Limit (kolikšna razlika):", 9, 3 18 92 8
edit "", 10, 96 17 38 10
button "Dodaj", 3, 55 33 35 11
button "Button", 1, 95 33 37 12, hide ok
}
on *:dialog:chadd:sclick:3:{
if ($did(8) != $null) && ($did(10) != $null) {
if ($left($did(8),1) != $chr(35)) {
var %x = $chr(35) $+ $did(8),%y = $did(10)
hadd chltbl %x $did(10)
}
if ($left($did(8),1) == $chr(35)) {
var %x = $did(8),%y = $did(10)
hadd chltbl %x $did(10)
}
if ($me isop %x) {
var %a = $nick(%x,0)
mode %x +l $calc(%a + %y)
}
dialog -x chadd chadd
chl.load
}
}
menu menubar,channel {
Limit
.Nastavitve:{ chl.dlg }
.Pomoč:{ run $+(",$scriptdirchanlimit-help.txt,") }
}
on @*:join:#:{
var %x = 0
while ($hget(chltbl,%x).item != $null) {
var %a = $hget(chltbl,%x).item
if ($chan == %a) {
var %y = $nick(#,0),%z = $hget(chltbl,$chan)
.timer 1 9 mode $chan +l $calc(%y + %z)
halt
}
inc %x
}
}
on @!*:part:#:{
var %x = 0
while ($hget(chltbl,%x).item != $null) {
var %a = $hget(chltbl,%x).item
if ($chan == %a) {
var %y = $nick(#,0),%z = $hget(chltbl,$chan)
.timer 1 9 mode $chan +l $calc((%y + %z)-1)
halt
}
inc %x
}
}
on @*:kick:#:{
if ($knick == $me) { halt }
var %x = 0
while ($hget(chltbl,%x).item != $null) {
var %a = $hget(chltbl,%x).item
if ($chan == %a) {
var %y = $nick(#,0),%z = $hget(chltbl,$chan)
.timer 1 9 mode $chan +l $calc((%y + %z)-1)
halt
}
inc %x
}
}
on @*:quit:{
var %x = 1
while ($comchan($nick,%x) != $null) {
var %a = $hget(chltbl,%x).item,%b = $comchan($nick,%x)
if (%b == %a) {
var %y = $nick(%a,0),%z = $hget(chltbl,%a)
.timer 1 9 mode %a +l $calc((%y + %z)-1)
halt
}
inc %x
}
}
on @*:mode:#:{
if (%chl.emode == on) {
if ($1- == -l) {
var %x = 0
while ($hget(chltbl,%x).item != $null) {
var %a = $hget(chltbl,%x).item
if ($chan == %a) {
var %y = $nick(#,0),%z = $hget(chltbl,$chan)
.timer 1 1 mode $chan +l $calc(%y + %z)
halt
}
inc %x
}
}
}
}
on *:load:{
if ($version >= 6.15) {
set %chl.emode off
chl.dlg
}
else { echo -a 2Sorry, this addon requires mIRC 6.15. Please download the latest version from www.mirc.com
.unload -rs $+(",$script,")
}
}
on *:unload:{
unset %chl.emode
if ($hget(chltbl) != $null) { hfree chltbl }
echo -a 4Channel Limiter successfully unloaded.
}
on *:exit:{ hsave -o chltbl $+(",$scriptdirchanlimit.dat,") }
on *:start:{ hmake chltbl 50
if ($isfile($+(",$scriptdirchanlimit.dat,"))) { hload chltbl $+(",$scriptdirchanlimit.dat,") }
}