coSAM Protection System — File Browser
coSAMProtectionSystemv1.5 / coSAMProtectionSystemv1.5 / coSAMProtectionSystem.mrc
coSAMProtectionSystem.mrc — 21.07 KB — Download this file
;coSAM Protection System 1.5
;(c) 2003 by Nutmeg3D
;http://www.cosam.de/ for updates
;Webmaster@cosam.de for bugs/ideas/questions
;Or Contact us at #cosam @ QuakeNet
;Don't rip or edit without permission
;Load and Start
on *:load:{
if ($version >= 5.7) {
if ($active != Status Window) { echo -a 1,2(12) 0coSAM Protection System 1(12)2 by Nutmeg3D Successfully installed }
echo -s 1,2(12) 0coSAM Protection System 1(12)2 by Nutmeg3D Successfully installed
.ial on
.dialog -mo InfoBox InfoBox
.dialog -m protsys protsys
}
if ($version < 5.7) {
if ($active != Status Window) { echo -a 1,2(12) 0coSAM Protection System 1(12)2 by Nutmeg3D Not installed - This addon works on mIRC version 5.7 or higher. Your version is $version $+ . Go to 12http://www.cosam.de/14 or 12http://www.mirc.co.uk/get.html14 to get the latest version. }
echo -s 1,2(12) 0coSAM Protection System 1(12)2 by Nutmeg3D Not installed - This addon works on mIRC version 5.7 or higher. Your version is $version $+ . Go to 12http://www.cosam.de/2 or 12http://www.mirc.co.uk/get.html2 to get the latest version.
.unload -rs $script
}
}
on *:unload:{
.remove %psini | .unset %psini
.remove %psys1 | .unset %psys1
.remove %psys2 | .unset %psys2
.unset %kicknumb
.unset %kicktimepass
echo -a Thx for using 1,2(12) 0coSAM Protection System 1(12)2 by Nutmeg3D
}
on *:start:{
.ial on
echo -a 1,2(12) 0coSAM Protection System 1(12)2 1.5 by Nutmeg3D Successfully started !
}
;Dialog and Menu
menu status,menubar,channel {
coSAM Protection System:dialog -m protsys protsys
}
dialog InfoBox {
title "Important"
size -1 -1 129 67
option dbu
text "Now you're seeing a dialog where you have to set up the 2 config files. If you're having problems with this, click the RECOVER button on tab ADVANCED, in the main dialog.", 1, 5 5 118 65
button "OK", 3, 43 46 42 15, ok
}
dialog protsys {
title "coSAM Protection System 1.5 by Nutmeg3D"
size -1 -1 282 215
option dbu
tab "Settings", 22, 4 3 273 201
tab "Advanced", 23
box "Punishment Settings", 39, 10 141 141 56, tab 23
text "Protected Masks", 1, 10 26 95 8, tab 22 center
text "Excluded Masks", 2, 177 26 95 8, tab 22 center
list 3, 10 39 95 130, tab 22 vsbar extsel
list 4, 177 39 95 130, tab 22 vsbar extsel
button "&Add", 5, 10 185 42 15, tab 22
button "&Remove", 6, 62 185 43 15, tab 22
button "A&dd", 7, 177 185 43 15, tab 22
button "R&emove", 8, 230 185 42 15, tab 22
box "Protections", 9, 112 43 58 81, tab 22
check "Friend Op", 11, 116 64 50 9, tab 22
check "Deop Prot", 12, 116 76 50 8, tab 22
check "Devoice Prot", 13, 116 87 50 8, tab 22
check "Kick Prot", 14, 116 99 50 8, tab 22
check "Ban Prot", 15, 116 110 50 9, tab 22
check "Join Op", 10, 116 53 50 8, tab 22
text " coSAM Protection System v1.5 (c) 2004 by Nutmeg3D", 16, 112 134 58 22, tab 22
button "- D&one -", 17, 112 185 58 15, tab 22 ok
link "www.cosam.de", 18, 122 26 40 8, tab 22
edit "", 19, 10 171 95 10, tab 22 autohs return
edit "", 20, 177 171 95 10, tab 22 autohs return
text " #cosam @ QuakeNet", 21, 112 173 58 10, tab 22
box "Channel Exclusion List", 24, 10 19 141 118, tab 23
box "Advanced Settings", 25, 159 19 108 164, tab 23
list 26, 16 31 129 71, tab 23 hsbar vsbar size
text "This feature allows you to ban someone, who kicked you several times in a row, so you don't keep kicking each other all the time.", 27, 164 32 98 27, tab 23
text "Number of kicks needed before ban:", 28, 169 67 88 7, tab 23
edit "", 29, 187 78 37 10, tab 23
text "Secs that passed since the first kick:", 30, 169 95 88 8, tab 23
edit "", 31, 187 108 37 10, tab 23
button "Ok", 32, 234 107 25 12, tab 23
button "Ok", 33, 234 78 25 12, tab 23
edit "", 34, 16 109 104 10, tab 23
button "Add", 35, 125 107 20 13, tab 23
text "( Doubleclick removes a Channel )", 36, 35 123 84 7, tab 23
text "If you deleted one of the config files, or just want to recover them, click the button below.", 37, 164 129 101 20, tab 23
button "Recover config files", 38, 185 155 58 12, tab 23
combo 40, 14 152 132 29, tab 23 drop
radio "DeOp", 41, 14 184 25 8, tab 23 group
radio "Kick", 42, 68 184 21 8, tab 23
radio "Ban", 43, 126 184 20 8, tab 23
text " ( Use 'done' button on Tab 1 )", 44, 169 188 84 7, tab 23
}
on *:dialog:protsys:init:*:{
if ( %psini == $null ) {
set %psini " $+ $mircdir $+ protsys.ini"
writeini -n %psini settings JoinOp OFF
writeini -n %psini settings FriendOp OFF
writeini -n %psini settings DopProt OFF
writeini -n %psini settings DevProt OFF
writeini -n %psini settings KickProt OFF
writeini -n %psini settings BanProt OFF
writeini -n %psini punishment DopPun BAN
writeini -n %psini punishment DevPun KICK
writeini -n %psini punishment KickPun KICK
writeini -n %psini punishment BanPun BAN
writeini -n %psini chanex num 0
writeini -n %psini version version 1.5
}
if ( %kicknumb == $null ) { set %kicknumb 10 }
if ( %kicktimepass == $null ) { set %kicktimepass 30 }
did -i protsys 29 1 %kicknumb
did -i protsys 31 1 %kicktimepass
if ($readini -n %psini settings JoinOp == ON) { did -c protsys 10 }
if ($readini -n %psini settings FriendOp == ON) { did -c protsys 11 }
if ($readini -n %psini settings DopProt == ON) { did -c protsys 12 }
if ($readini -n %psini settings DevProt == ON) { did -c protsys 13 }
if ($readini -n %psini settings KickProt == ON) { did -c protsys 14 }
if ($readini -n %psini settings BanProt == ON) { did -c protsys 15 }
didtok $dname 40 C DeOp Protection Punishment
didtok $dname 40 C DeVoice Protection Punishment
didtok $dname 40 C Kick Protection Punishment
didtok $dname 40 C Ban Protection Punishment
:psysinit1
if ( %psys1 == $null ) { set %psys1 " $+ $$sdir($mircdir,Select Path for Config File 1!) $+ protsys1.cfg" | write -l0 %psys1 0 }
set %psyscount1 1
set %entrynr1 $read(%psys1,0)
if ( %entrynr1 !isnum ) { .remove %psys1 | unset %psys1 | unset %psyscount1 | unset %entrynr1 | goto psysinit1 }
:psyson1
if %entrynr1 < %psyscount1 goto psysoff1
did -a protsys 3 $read(%psys1,%psyscount1)
inc %psyscount1 1
goto psyson1
:psysoff1
unset %psyscount1
unset %entrynr1
:psysinit2
if ( %psys2 == $null ) { set %psys2 " $+ $$sdir($mircdir,Select Path for Config File 2!) $+ protsys2.cfg" | write -l0 %psys2 0 }
set %psyscount2 1
set %entrynr2 $read(%psys2,0)
if ( %entrynr2 !isnum ) { .remove %psys2 | unset %psys2 | unset %psyscount2 | unset %entrynr2 | goto psysinit2 }
:psyson2
if %entrynr2 < %psyscount2 goto psysoff2
did -a protsys 4 $read(%psys2,%psyscount2)
inc %psyscount2 1
goto psyson2
:psysoff2
unset %psyscount2
unset %entrynr2
:psysinit3
set %psyscount3 1
set %entrynr3 $readini -n %psini chanex num
:psyson3
if %entrynr3 < %psyscount3 goto psysoff3
did -a protsys 26 $readini -n %psini chanex %psyscount3
inc %psyscount3 1
goto psyson3
:psysoff3
unset %psyscount3
unset %entrynr3
}
on *:dialog:protsys:sclick:*:{
if $did(3).sel {
did -i protsys 19 1 $did(3).seltext
}
if $did(4).sel {
did -i protsys 20 1 $did(4).seltext
}
if ($did == 5) && ($did(19)) {
set %entrynr1 $read(%psys1,0)
inc %entrynr1 1
write -l0 %psys1 %entrynr1
write %psys1 $did(19)
did -a protsys 3 $did(19)
did -r protsys 19
unset %entrynr1
}
if ($did == 6) && $did(3).sel {
set %pchoos1 $did(3).sel
did -d protsys 3 %pchoos1
write -dl $+ $calc(%pchoos1 + 1) %psys1
set %entrynr1 $read(%psys1,0)
write -l0 %psys1 $calc(%entrynr1 - 1)
did -r protsys 19
unset %entrynr1
unset %pchoos1
}
if ($did == 7) && ($did(20)) {
set %entrynr2 $read(%psys2,0)
inc %entrynr2 1
write -l0 %psys2 %entrynr2
write %psys2 $did(20)
did -a protsys 4 $did(20)
did -r protsys 20
unset %entrynr2
}
if ($did == 8) && $did(4).sel {
set %pchoos2 $did(4).sel
did -d protsys 4 %pchoos2
write -dl $+ $calc(%pchoos2 + 1) %psys2
set %entrynr2 $read(%psys2,0)
write -l0 %psys2 $calc(%entrynr2 - 1)
did -r protsys 20
unset %entrynr2
unset %pchoos2
}
if ($did == 10) {
if ($readini -n %psini settings JoinOp == ON) {
writeini -n %psini settings JoinOp OFF
}
else {
writeini -n %psini settings JoinOp ON
}
}
if ($did == 11) {
if ($readini -n %psini settings FriendOp == ON) {
writeini -n %psini settings FriendOp OFF
}
else {
writeini -n %psini settings FriendOp ON
}
}
if ($did == 12) {
if ($readini -n %psini settings DopProt == ON) {
writeini -n %psini settings DopProt OFF
}
else {
writeini -n %psini settings DopProt ON
}
}
if ($did == 13) {
if ($readini -n %psini settings DevProt == ON) {
writeini -n %psini settings DevProt OFF
}
else {
writeini -n %psini settings DevProt ON
}
}
if ($did == 14) {
if ($readini -n %psini settings KickProt == ON) {
writeini -n %psini settings KickProt OFF
}
else {
writeini -n %psini settings KickProt ON
}
}
if ($did == 15) {
if ($readini -n %psini settings BanProt == ON) {
writeini -n %psini settings BanProt OFF
}
else {
writeini -n %psini settings BanProt ON
}
}
if ($did == 18) {
url -an http://www.cosam.de/
}
if ($did == 33) && $did(29) {
set %kicknumb $did(29)
}
if ($did == 32) && $did(31) {
set %kicktimepass $did(31)
}
if ($did == 35) && ($did(34)) {
if ($readini -n %psini chanex $did(34)) || ($did(34) == $null) {
halt
}
set %num $readini -n %psini chanex num
inc %num 1
writeini %psini chanex num %num
writeini %psini chanex %num $did(34)
writeini %psini chanex $did(34) %num
unset %num
did -a protsys 26 $did(34)
did -r protsys 34
}
if ($did == 38) {
if ( %psys1 != $null ) { .remove %psys1 | .unset %psys1 }
if ( %psys2 != $null ) { .remove %psys2 | .unset %psys2 }
set %psys1 " $+ $mircdir $+ protsys1.cfg" | write -l0 %psys1 0
set %psys2 " $+ $mircdir $+ protsys2.cfg" | write -l0 %psys2 0
if ( %psini != $null ) {
.remove %psini | .unset %psini
set %psini " $+ $mircdir $+ protsys.ini"
writeini -n %psini settings JoinOp OFF
writeini -n %psini settings FriendOp OFF
writeini -n %psini settings DopProt OFF
writeini -n %psini settings DevProt OFF
writeini -n %psini settings KickProt OFF
writeini -n %psini settings BanProt OFF
writeini -n %psini chanex num 0
writeini -n %psini version version 1.5
}
dialog -k protsys
.timer -m 1 50 dialog -m protsys protsys
}
if ($did == 40) {
if ($did(40).sel == 1) {
if ($readini -n %psini punishment DopPun == DOP) { did -u protsys 42 | did -u protsys 43 | did -c protsys 41 }
if ($readini -n %psini punishment DopPun == KICK) { did -u protsys 41 | did -u protsys 43 | did -c protsys 42 }
if ($readini -n %psini punishment DopPun == BAN) { did -u protsys 41 | did -u protsys 42 | did -c protsys 43 }
}
if ($did(40).sel == 2) {
if ($readini -n %psini punishment DevPun == DOP) { did -u protsys 42 | did -u protsys 43 | did -c protsys 41 }
if ($readini -n %psini punishment DevPun == KICK) { did -u protsys 41 | did -u protsys 43 | did -c protsys 42 }
if ($readini -n %psini punishment DevPun == BAN) { did -u protsys 41 | did -u protsys 42 | did -c protsys 43 }
}
if ($did(40).sel == 3) {
if ($readini -n %psini punishment KickPun == DOP) { did -u protsys 42 | did -u protsys 43 | did -c protsys 41 }
if ($readini -n %psini punishment KickPun == KICK) { did -u protsys 41 | did -u protsys 43 | did -c protsys 42 }
if ($readini -n %psini punishment KickPun == BAN) { did -u protsys 41 | did -u protsys 42 | did -c protsys 43 }
}
if ($did(40).sel == 4) {
if ($readini -n %psini punishment BanPun == DOP) { did -u protsys 42 | did -u protsys 43 | did -c protsys 41 }
if ($readini -n %psini punishment BanPun == KICK) { did -u protsys 41 | did -u protsys 43 | did -c protsys 42 }
if ($readini -n %psini punishment BanPun == BAN) { did -u protsys 41 | did -u protsys 42 | did -c protsys 43 }
}
}
if ($did == 41) && ($did(40).sel == 1) {
writeini -n %psini punishment DopPun DOP
}
if ($did == 42) && ($did(40).sel == 1) {
writeini -n %psini punishment DopPun KICK
}
if ($did == 43) && ($did(40).sel == 1) {
writeini -n %psini punishment DopPun BAN
}
if ($did == 41) && ($did(40).sel == 2) {
writeini -n %psini punishment DevPun DOP
}
if ($did == 42) && ($did(40).sel == 2) {
writeini -n %psini punishment DevPun KICK
}
if ($did == 43) && ($did(40).sel == 2) {
writeini -n %psini punishment DevPun BAN
}
if ($did == 41) && ($did(40).sel == 3) {
writeini -n %psini punishment KickPun DOP
}
if ($did == 42) && ($did(40).sel == 3) {
writeini -n %psini punishment KickPun KICK
}
if ($did == 43) && ($did(40).sel == 3) {
writeini -n %psini punishment KickPun BAN
}
if ($did == 41) && ($did(40).sel == 4) {
writeini -n %psini punishment BanPun DOP
}
if ($did == 42) && ($did(40).sel == 4) {
writeini -n %psini punishment BanPun KICK
}
if ($did == 43) && ($did(40).sel == 4) {
writeini -n %psini punishment BanPun BAN
}
}
on *:dialog:protsys:dclick:26:{
set %wahl $did(26).sel
did -d protsys 26 %wahl
remini %psini chanex $readini -n %psini chanex %wahl
set %wahlcounter %wahl
set %num $readini -n %psini chanex num
writeini %psini chanex num $calc(%num - 1)
if %wahlcounter == %num goto selloopend
:selloop
set %wahlread $readini -n %psini chanex $calc(%wahlcounter + 1)
writeini -n %psini chanex %wahlcounter %wahlread
remini %psini chanex %wahlread
inc %wahlcounter 1
if %wahlcounter < %num goto selloop
:selloopend
remini %psini chanex %num
unset %wahlcounter
unset %wahlread
unset %nummz
unset %wahl
}
;Remote Events
on *:JOIN:#:{
if ($readini -n %psini chanex $chan == $null) {
if ($chan == %gotchan) && ($nick == %gotknick) && (%gotkick >= %kicknumb) { raw -q mode %gotchan -o+b %gotknick %gotmask $+ $crlf $+ kick %gotchan %gotknick : $+ 1,2(12) 0Stop Kicking me ! 1(12)2 }
if ($readini -n %psini settings JoinOp == ON) {
if ( $nick != $me ) && ( $nick ison $chan ) {
var %i = 1
while (%i <= $read(%psys1,0)) {
if ($read(%psys1,%i) iswm $address($nick,5)) && ($me isop $chan) {
raw -q mode $chan +o $nick
halt
}
inc %i
}
}
}
}
}
on *:OP:#:{
if ($readini -n %psini chanex $chan == $null) {
if ($readini -n %psini settings FriendOp == ON) {
if ( $opnick == $me ) {
var %i = 1, %j = 1
write -cl0 $scriptdir $+ oppingusers.txt 0
:first
while (%i <= $read(%psys1,0)) {
while (%j <= $nick($chan,0)) {
if ($read(%psys1,%i) iswm $address($nick($chan,%j),5)) && ($me isop $chan) && ($nick($chan,%j) !isop $chan) {
write -l0 $scriptdir $+ oppingusers.txt $calc($read($scriptdir $+ oppingusers.txt,0) +1)
write -al2 $scriptdir $+ oppingusers.txt $nick($chan,%j) $+ .
}
if (%j == $nick($chan,0)) { inc %i | var %j = 1 | goto first }
inc %j
}
}
var %i = 1
while (%i <= $read($scriptdir $+ oppingusers.txt,0)) {
mode $chan +oooooo $replace($gettok($read($scriptdir $+ oppingusers.txt, 1),%i,46),.,$chr(32)) $replace($gettok($read($scriptdir $+ oppingusers.txt, 1),$calc(%i + 1),46),.,$chr(32)) $replace($gettok($read($scriptdir $+ oppingusers.txt, 1),$calc(%i + 2),46),.,$chr(32)) $replace($gettok($read($scriptdir $+ oppingusers.txt, 1),$calc(%i + 3),46),.,$chr(32)) $replace($gettok($read($scriptdir $+ oppingusers.txt, 1),$calc(%i + 4),46),.,$chr(32)) $replace($gettok($read($scriptdir $+ oppingusers.txt, 1),$calc(%i + 5),46),.,$chr(32))
inc %i 6
}
.remove $scriptdir $+ oppingusers.txt
}
}
}
}
on *:DEOP:#:{
if ($readini -n %psini chanex $chan == $null) {
if ($readini -n %psini settings DopProt == ON) {
if ( $nick != $me ) && ( $nick ison $chan ) {
var %i = 1, %j = 1
while (%j <= $read(%psys2,0)) {
if ($read(%psys2,%j) iswm $address($nick,5)) { halt
}
inc %j
}
while (%i <= $read(%psys1,0)) {
if ($read(%psys1,%i) iswm $address($opnick,5)) && ($me isop $chan) {
if ($readini -n %psini punishment DopPun == DOP) { raw -q mode $chan -o+o $nick $opnick }
if ($readini -n %psini punishment DopPun == KICK) { raw -q mode $chan +o $opnick $+ $crlf $+ kick $chan $nick : $+ 1,2(12) 0User is protected ! 1(12)2 }
if ($readini -n %psini punishment DopPun == BAN) { raw -q mode $chan -o+bo $nick $address($nick,2) $opnick $+ $crlf $+ kick $chan $nick : $+ 1,2(12) 0User is protected ! 1(12)2 }
halt
}
inc %i
}
}
}
}
}
on *:DEVOICE:#:{
if ($readini -n %psini chanex $chan == $null) {
if ($readini -n %psini settings DevProt == ON) {
if ( $nick != $me ) && ( $nick ison $chan ) {
var %i = 1, %j = 1
while (%j <= $read(%psys2,0)) {
if ($read(%psys2,%j) iswm $address($nick,5)) { halt
}
inc %j
}
while (%i <= $read(%psys1,0)) {
if ($read(%psys1,%i) iswm $address($vnick,5)) && ($me isop $chan) {
if ($readini -n %psini punishment DevPun == DOP) { raw -q mode $chan -o+v $nick $vnick }
if ($readini -n %psini punishment DevPun == KICK) { raw -q mode $chan +v $vnick $+ $crlf $+ kick $chan $nick : $+ 1,2(12) 0User is protected ! 1(12)2 }
if ($readini -n %psini punishment DevPun == BAN) { raw -q mode $chan -o+bv $nick $address($nick,2) $vnick $+ $crlf $+ kick $chan $nick : $+ 1,2(12) 0User is protected ! 1(12)2 }
halt
}
inc %i
}
}
}
}
}
on *:KICK:#:{
if ($readini -n %psini chanex $chan == $null) {
if ($readini -n %psini settings KickProt == ON) {
if ( $nick != $me ) && ( $nick ison $chan ) {
var %i = 1, %j = 1
while (%j <= $read(%psys2,0)) {
if ($read(%psys2,%j) iswm $address($nick,5)) { halt
}
inc %j
}
while (%i <= $read(%psys1,0)) {
if ($read(%psys1,%i) iswm $address($knick,5)) && ($me isop $chan) {
if ($readini -n %psini punishment KickPun == DOP) { raw -q mode $chan -o $nick }
if ($readini -n %psini punishment KickPun == KICK) { raw -q kick $chan $nick : $+ 1,2(12) 0User is protected ! 1(12)2 }
if ($readini -n %psini punishment KickPun == BAN) { raw -q mode $chan -o+b $nick $address($nick,2) $+ $crlf $+ kick $chan $nick : $+ 1,2(12) 0User is protected ! 1(12)2 }
set %gotknick $nick
set %gotchan $chan
set %gotmask $address($nick,2)
if ( %gotkick == $null ) { set %gotkick 1 }
else { set %gotkick $calc( %gotkick + 1 ) }
.timer 1 %kicktimepass unset %gotknick
.timer 1 %kicktimepass unset %gotchan
.timer 1 %kicktimepass unset %gotmask
.timer 1 %kicktimepass unset %gotkick
halt
}
inc %i
}
}
}
}
}
on *:BAN:#:{
if ($readini -n %psini chanex $chan == $null) {
if ($readini -n %psini settings BanProt == ON) {
if ( $nick != $me ) && ( $nick ison $chan ) {
var %i = 1, %j = 1, %k = 1
while (%j <= $read(%psys2,0)) {
if ($read(%psys2,%j) iswm $address($nick,5)) { halt
}
inc %j
}
:first2
if ($ial($banmask,0) != 0) {
while (%i <= $read(%psys1,0)) {
while (%k <= $ial($banmask,0)) {
if ($read(%psys1,%i) iswm $ial($banmask,%k)) && ($me isop $chan) && ($nick ison $chan) {
if ($readini -n %psini punishment BanPun == DOP) { raw -q mode $chan -bo $banmask $nick }
if ($readini -n %psini punishment BanPun == KICK) { raw -q mode $chan -b $banmask $+ $crlf $+ kick $chan $nick : $+ 1,2(12) 0User is protected ! 1(12)2 }
if ($readini -n %psini punishment BanPun == BAN) { raw -q mode $chan -bo+b $banmask $nick $address($nick,2) $+ $crlf $+ kick $chan $nick : $+ 1,2(12) 0User is protected ! 1(12)2 }
halt
}
if (%k == $ial($banmask,0)) { inc %i | var %k = 1 | goto first2 }
inc %k
}
}
}
}
}
}
}
;The End