Administrators coders-irc_Bot Posted October 16, 2022 Administrators Report Share Posted October 16, 2022 A nice protection script, has channel protections from Deop, Ban, Kick and also has flood protections. ;Protection Script Z31 ;Made for mIRC Script Z31 ;By Neo Nemesis ;Version 1.1 on *:LOAD: { writeini z31.ini main protect on,on,on,on,on,on,2,5,on echo -a $+ $color(info) $+ * Protection Script Z31 Loaded successfuly! Use /protection for the options menu! } menu channel,nicklist,query,status { Protection Script Z31:/protection } alias protection { if (!$1) { dialog -m protect protect } if ($1 == op) { if ($2) { writeini z31.ini Main Protect $puttok($protect.file,$2,1,44) } elseif (!$2) { return $gettok($protect.file,1,44) } } if ($1 == kick) { if ($2) { writeini z31.ini Main Protect $puttok($protect.file,$2,2,44) } elseif (!$2) { return $gettok($protect.file,2,44) } } if ($1 == ban) { if ($2) { writeini z31.ini Main Protect $puttok($protect.file,$2,3,44) } elseif (!$2) { return $gettok($protect.file,3,44) } } if ($1 == massjoin) { if ($2) { writeini z31.ini Main Protect $puttok($protect.file,$2,4,44) } elseif (!$2) { return $gettok($protect.file,4,44) } } if ($1 == flood) { if ($2) { writeini z31.ini Main Protect $puttok($protect.file,$2,5,44) } elseif (!$2) { return $gettok($protect.file,5,44) } } if ($1 == iflood) { if ($2) { writeini z31.ini Main Protect $puttok($protect.file,$2,6,44) } elseif (!$2) { return $gettok($protect.file,6,44) } } if ($1 == timer) { if ($2) { writeini z31.ini Main Protect $puttok($protect.file,$2,7,44) } elseif (!$2) { return $gettok($protect.file,7,44) } } if ($1 == num) { if ($2) { writeini z31.ini Main Protect $puttok($protect.file,$2,8,44) } elseif (!$2) { return $gettok($protect.file,8,44) } } if ($1 == pmflood) { if ($2) { writeini z31.ini Main Protect $puttok($protect.file,$2,9,44) } elseif (!$2) { return $gettok($protect.file,9,44) } } } alias protect.file { return $readini(z31.ini,Main,Protect) } alias z31.file { return $readini(z31.ini,$1,$2) } alias exempt { if ($1 == chan) { if (!$2) { return $z31.file(exempt,01) } if ($2 == add) { writeini z31.ini exempt 01 $addtok($z31.file(exempt,01),$3,44) } if ($2 == del) { if ($z31.file(exempt,01) == $3) { remini z31.ini exempt 01 } elseif ($z31.file(exempt,01) != $3) { writeini z31.ini exempt 01 $remtok($z31.file(exempt,01),$3,1,44) } } elseif ($2) { if ($z31.file(exempt,01)) { %Z31.1 = 1 while (%Z31.1 <= $numtok($z31.file(exempt,01),44)) { if ($gettok($z31.file(exempt,01),%Z31.1,44) == $2) { return $true } else { inc %Z31.1 } } } return $false } } if ($1 == user) { if (!$2) { return $z31.file(exempt,02) } if ($2 == add) { writeini z31.ini exempt 02 $addtok($z31.file(exempt,02),$3,44) } if ($2 == del) { if ($z31.file(exempt,02) == $3) { remini z31.ini exempt 02 } elseif ($z31.file(exempt,02) != $3) { writeini z31.ini exempt 02 $remtok($z31.file(exempt,02),$3,1,44) } } elseif ($2) { if ($z31.file(exempt,02)) { %Z31.2 = 1 while (%Z31.2 <= $numtok($z31.file(exempt,02),44)) { if ($gettok($z31.file(exempt,02),%Z31.2,44) == $2) { return $true } else { inc %Z31.2 } } } return $false } } if ($1 == host) { if (!$2) { return $z31.file(exempt,03) } if ($2 == add) { writeini z31.ini exempt 03 $addtok($z31.file(exempt,03),$3,44) } if ($2 == del) { if ($z31.file(exempt,03) == $3) { remini z31.ini exempt 03 } elseif ($z31.file(exempt,03) != $3) { writeini z31.ini exempt 03 $remtok($z31.file(exempt,03),$3,1,44) } } elseif ($2) { if ($z31.file(exempt,03)) { %Z31.3 = 1 while (%Z31.3 <= $numtok($z31.file(exempt,03),44)) { if ($gettok($z31.file(exempt,03),%Z31.3,44) == $2) { return $true } else { inc %Z31.3 } } } return $false } } } dialog protect { size -1 -1 445 272 title Protection box "Protections"1, 5 5 140 205 check "DeOP Protection"2, 10 20 98 15 check "Kick Protection"3, 10 35 90 15 check "Ban Protection"4, 10 50 88 15 check "Mass Join Protection"5, 10 65 115 15 check "Flood Protection"6, 10 80 95 15 check "Invite Flood Protection"7, 10 95 128 15 text "Flood trigger:"8, 10 110 80 15 edit ""9, 20 125 40 23 text "Joins/Messages"10, 65 130 75 15 text "in"11, 23 150 15 15 edit ""12, 20 165 40 23 text "seconds."13, 65 170 50 15 check "PM Flood Protection"28, 10 190 113 15 box "Exceptions"14, 150 5 293 265 tab "Channels"15, 155 20 280 245 tab "Users"16 tab "Hostmasks"17 ;tab 15 list 18, 160 45 270 200,vsbar,tab 15 button "Add"19, 160 235 80 23,tab 15 button "Remove"20, 245 235 80 23,tab 15 ;tab 16 list 21, 160 45 270 200,vsbar,tab 16 button "Add"22, 160 235 80 23,tab 16 button "Remove"23, 245 235 80 23,tab 16 ;tab 17 list 24, 160 45 270 200,vsbar,tab 17 button "Add"25, 160 235 80 23,tab 17 button "Remove"26, 245 235 80 23,tab 17 button "Close"27, 35 225 80 23,ok } on *:DIALOG:protect:init:*: { if ($protection(op) == on) { did -c protect 2 } if ($protection(kick) == on) { did -c protect 3 } if ($protection(ban) == on) { did -c protect 4 } if ($protection(massjoin) == on) { did -c protect 5 } if ($protection(flood) == on) { did -c protect 6 } if ($protection(iflood) == on) { did -c protect 7 } did -a protect 9 $protection(num) did -a protect 12 $protection(timer) if ($exempt(chan)) { %Z31.4 = 1 while (%Z31.4 <= $numtok($exempt(chan),44)) { did -a protect 18 $gettok($exempt(chan),%Z31.4,44) inc %Z31.4 } } if ($exempt(user)) { %Z31.5 = 1 while (%Z31.5 <= $numtok($exempt(user),44)) { did -a protect 21 $gettok($exempt(user),%Z31.5,44) inc %Z31.5 } } if ($exempt(host)) { %Z31.6 = 1 while (%Z31.6 <= $numtok($exempt(host),44)) { did -a protect 24 $gettok($exempt(host),%Z31.6,44) inc %Z31.6 } } if ($protection(pmflood) == on) { did -c protect 28 } unset %Z31.* } on *:DIALOG:protect:sclick:*: { if ($did == 2) { if ($did(2).state == 1) { protection op on } else { protection op off } } if ($did == 3) { if ($did(3).state == 1) { protection kick on } else { protection kick off } } if ($did == 4) { if ($did(4).state == 1) { protection ban on } else { protection ban off } } if ($did == 5) { if ($did(5).state == 1) { protection massjoin on } else { protection massjoin off } } if ($did == 6) { if ($did(6).state == 1) { protection flood on } else { protection flood off } } if ($did == 7) { if ($did(7).state == 1) { protection iflood on } else { protection iflood off } } if ($did == 19) { %z31.7 = $input(Please enter the channel you wish to add to the exception list.,oe,Protection) if ($chr(35) !isin %z31.7) { %z31.dump = $input(You must enter the # symbol before the channel name.,oh,Protection) } elseif ($chr(35) isin %z31.7) { exempt chan add %z31.7 did -a protect 18 %z31.7 } } if ($did == 20) { if (!$did(18).sel) { %z31.dump = $input(Please select the channel you wish to remove from the exception list first.,oh,Protection) } elseif ($did(18).sel) { %z31.dump = $input(Are you sure you want to remove $did(18).seltext from the exception list?,yw,Protection) if (%z31.dump == $true) { exempt chan del $did(18).seltext did -r protect 18 if ($exempt(chan)) { %Z31.4 = 1 while (%Z31.4 <= $numtok($exempt(chan),44)) { did -a protect 18 $gettok($exempt(chan),%Z31.4,44) inc %Z31.4 } } } } } if ($did == 22) { %z31.8 = $input(Please enter the user name you wish to add to the exception list.,oe,Protection) if (%z31.8 != $false) && (%z31.8 != $null) { exempt user add %z31.8 did -a protect 21 %z31.8 } } if ($did == 23) { if (!$did(21).sel) { %z31.dump = $input(Please select the user name you wish to remove from the exception list first.,oh,Protection) } elseif ($did(21).sel) { %z31.dump = $input(Are you sure you want to remove $did(21).seltext from the exception list?,yw,Protection) if (%z31.dump == $true) { exempt user del $did(21).seltext did -r protect 21 if ($exempt(user)) { %Z31.5 = 1 while (%Z31.5 <= $numtok($exempt(user),44)) { did -a protect 21 $gettok($exempt(user),%Z31.5,44) inc %Z31.5 } } } } } if ($did == 25) { %z31.9 = $input(Please enter the hostmask you wish to add to the exception list. NOTE: It must be a valid hostmask!,oe,Protection) if ($chr(46) !isin %z31.9) || ($chr(64) !isin %z31.9) || ($chr(33) !isin %z31.9) { %z31.dump = $input(%z31.9 is not a valid host mask.,oh,Protection) } elseif ($chr(46) isin %z31.9) && ($chr(64) isin %z31.9) && ($chr(33) isin %z31.9) { exempt host add %z31.9 did -a protect 24 %z31.9 } } if ($did == 26) { if (!$did(24).sel) { %z31.dump = $input(Please select the hostmask you wish to remove from the exception list first.,oh,Protection) } elseif ($did(24).sel) { %z31.dump = $input(Are you sure you want to remove $did(24).seltext from the exception list?,yw,Protection) if (%z31.dump == $true) { exempt host del $did(24).seltext did -r protect 24 if ($exempt(host)) { %Z31.6 = 1 while (%Z31.6 <= $numtok($exempt(host),44)) { did -a protect 24 $gettok($exempt(user),%Z31.6,44) inc %Z31.6 } } } } } if ($did == 28) { if ($did(28).state == 1) { protection pmflood on } else { protection pmflood off } } :end unset %z31.* } on *:DIALOG:protect:edit:9: { if ($did(9).text) { protection num $did(9).text } } on *:DIALOG:protect:edit:12: { if ($did(12).text) { protection timer $did(12).text } } alias IsExempt { if ($1) { if ($exempt(chan,$1) == $true) { return $true } if ($exempt(user,$1) == $true) { return $true } if ($exempt(host,$address($1,0)) == $true) { return $true } if ($exempt(host,$address($1,1)) == $true) { return $true } if ($exempt(host,$address($1,2)) == $true) { return $true } if ($exempt(host,$address($1,3)) == $true) { return $true } if ($exempt(host,$address($1,4)) == $true) { return $true } if ($exempt(host,$address($1,5)) == $true) { return $true } if ($exempt(host,$address($1,6)) == $true) { return $true } if ($exempt(host,$address($1,7)) == $true) { return $true } if ($exempt(host,$address($1,8)) == $true) { return $true } if ($exempt(host,$address($1,9)) == $true) { return $true } else { return $false } } } on *:DEOP:#: { if ($protection(op) == on) { if ($nick == $me) || ($nick == ChanServ) || ($IsExempt($chan) == $true) || ($IsExempt($nick) == $true) { goto end } if ($opnick == $me) { %z31-op = $true %z31-chan = $chan %z31-nick = $nick .timerZ31.1 1 1 chanserv op $chan $me } } :end } on *:OP:%z31-chan: { if (%z31-op == $true) || (%z31-kick == $true) || (%z31-ban == $true) { if (%z31-nick ison $chan) { mode $chan -ob %z31-nick %z31-banmask .timerZ31.3 -m 1 1500 kick $chan %z31-nick Kicked by $me 4(OP Abuse) } } unset %z31-* } on @*:KICK:#: { if ($protection(kick) == on) { if ($nick == $me) || ($nick == ChanServ) || ($IsExempt($chan) == $true) || ($IsExempt($nick) == $true) { goto end } if ($knick == $me) { %z31-kick = $true %z31-chan = $chan %z31-nick = $nick .timerZ31.4 1 1 join %z31-chan } } :end } alias IsBanned { if ($me isin $1) { return $true } if ($address($me,0) == $1) { return $true } if ($address($me,1) == $1) { return $true } if ($address($me,2) == $1) { return $true } if ($address($me,3) == $1) { return $true } if ($address($me,4) == $1) { return $true } if ($address($me,5) == $1) { return $true } if ($address($me,6) == $1) { return $true } if ($address($me,7) == $1) { return $true } if ($address($me,8) == $1) { return $true } if ($address($me,9) == $1) { return $true } if ($gettok($host,4,46) isin $1) { return $true } else { return $false } } on @*:BAN:#: { if ($protection(ban) == on) { if ($nick == $me) || ($nick == ChanServ) || ($IsExempt($chan) == $true) || ($IsExempt($nick) == $true) { goto end } if ($IsBanned($banmask) == $true) { set -u8 %z31-ban $true set -u8 %z31-banmask $banmask set -u8 %z31-chan $chan set -u8 %z31-nick $nick .timerZ31.6 1 1 mode $chan -bo $banmask $nick .timerZ31.7 1 2 kick $chan $nick Kicked by $me 4(OP Abuse) } } :end } raw *:*: { if (%z31-kick == $true) { if ($numeric == 471) || ($numeric == 473) || ($numeric == 474) || ($numeric == 475) { .timerZ31.5 1 1 chanserv invite %z31-chan halt } } } on ^*:NOTICE:*:*: { if (%z31-op == $true) || (%z31-kick == $true) || (%z31-ban == $true) && ($nick == ChanServ) { %chanserv = $strip($1-) if (access denied isin %chanserv) || (permission denied isin %chanserv) || (You do not have access isin %chanserv) { echo -a $+ $color(info) $+ * ChanServ could not complete the operation on %z31-chan $+ . (Access Denied) unset %z31-* } if (not registered isin %chanserv) { echo -a $+ $color(info) $+ * ChanServ could not complete the operation on %z31-chan $+ . (Channel not registered) unset %z31-* } unset %chanserv halt } } on @*:JOIN:#: { if ($protection(massjoin) == on) { if ($IsExempt($chan) == $true) || ($nick isreg $chan) { goto end } inc % [ $+ [ $chan ] ] %clones. [ $+ [ $chan ] ] = $addtok(%clones. [ $+ [ $chan ] ],$nick,44) .timerJOINS1 1 $protection(timer) unset % [ $+ [ $chan ] ] .timerJOINS2 1 $protection(timer) unset %clones. [ $+ [ $chan ] ] if (% [ $+ [ $chan ] ] >= $protection(num)) { mode $chan +dim .timerJOINS* off .timerMODE 1 300 mode $chan -dim clonek $chan } } :end } alias clonek { %kick = 1 while (%kick <= $numtok(%clones. [ $+ [ $1 ] ],44)) { if ($gettok(%clones. [ $+ [ $1 ] ],%kick,44) ison $1) { .timerCK $+ %kick -m 1 $calc(1300 * %kick + 660) kick $chan $gettok(%clones. [ $+ [ $1 ] ],%kick,44) Mass Join 4(Clone) } inc %kick } if (!$timerKICK*) { .timerKICK $+ $rand(1,999) 1 $calc($numtok(%clones. [ $+ [ $1 ] ],44) + 2) ck.us $1 } } alias ck.us { unset % [ $+ [ $1 ] ] unset %clones. [ $+ [ $1 ] ] unset %kick } on *:TEXT:*:#: { if ($protection(flood) == on) { if (Serv isin $nick) || ($IsExempt($chan) == $true) || ($IsExempt($nick) == $true) { goto end } inc % [ $+ [ $nick ] ] if (!$timer($nick)) { .timer $+ $nick 1 $protection(timer) unset % $+ $nick } if (% [ $+ [ $nick ] ] >= $protection(num)) { if ($me isop $chan) { .timer $+ $nick $+ 1 1 1 kick $chan $nick Slow down! 4(Flooding) } elseif ($me !isop $chan) { .ignore -u180 $nick $+ !*@* .echo -a $+ $color(info) $+ * 4Flooding Detected: $+ $color(info) $chan by $nick - Ignored for 3 minutes. } unset % [ $+ [ $nick ] ] } } :end } on *:NOTICE:*:#: { if ($protection(flood) == on) { if (Serv isin $nick) || ($IsExempt($chan) == $true) || ($IsExempt($nick) == $true) { goto end } inc % [ $+ [ $nick ] ] if (!$timer($nick)) { .timer $+ $nick 1 $protection(timer) unset % $+ $nick } if (% [ $+ [ $nick ] ] >= $protection(num)) { if ($me isop $chan) { .timer $+ $nick $+ 1 1 1 kick $chan $nick Slow down! 4(Flooding) } elseif ($me !isop $chan) { .ignore -u180 $nick $+ !*@* .echo -a $+ $color(info) $+ * 4Flooding Detected: $+ $color(info) $chan by $nick - Ignored for 3 minutes. } unset % [ $+ [ $nick ] ] } } :end } on *:ACTION:*:#: { if ($protection(flood) == on) { if (Serv isin $nick) || ($IsExempt($chan) == $true) || ($IsExempt($nick) == $true) { goto end } inc % [ $+ [ $nick ] ] if (!$timer($nick)) { .timer $+ $nick 1 $protection(timer) unset % $+ $nick } if (% [ $+ [ $nick ] ] >= $protection(num)) { if ($me isop $chan) { .timer $+ $nick $+ 1 1 1 kick $chan $nick Slow down! 4(Flooding) } elseif ($me !isop $chan) { .ignore -u180 $nick $+ !*@* .echo -a $+ $color(info) $+ * 4Flooding Detected: $+ $color(info) $chan by $nick - Ignored for 3 minutes. } unset % [ $+ [ $nick ] ] } } :end } on *:TEXT:*:?: { if ($protection(pmflood) == on) { if (Serv isin $nick) || ($IsExempt($chan) == $true) || ($IsExempt($nick) == $true) { goto end } inc % [ $+ [ $nick ] ] if (!$timer($nick)) { .timer $+ $nick 1 $protection(timer) unset % $+ $nick } if (% [ $+ [ $nick ] ] >= $protection(num)) { .ignore -u180 $nick $+ !*@* .echo -a $+ $color(info) $+ * 4Flooding Detected: $+ $color(info) Private Message by $nick - Ignored for 3 minutes. close -m $nick unset % [ $+ [ $nick ] ] } } :end } on *:ACTION:*:?: { if ($protection(pmflood) == on) { if (Serv isin $nick) || ($IsExempt($chan) == $true) || ($IsExempt($nick) == $true) { goto end } inc % [ $+ [ $nick ] ] if (!$timer($nick)) { .timer $+ $nick 1 $protection(timer) unset % $+ $nick } if (% [ $+ [ $nick ] ] >= $protection(num)) { .ignore -u180 $nick $+ !*@* .echo -a $+ $color(info) $+ * 4Flooding Detected: $+ $color(info) Private Message by $nick - Ignored for 3 minutes. close -m $nick unset % [ $+ [ $nick ] ] } } :end } on *:NOTICE:*:?: { if ($protection(flood) == on) { if (Serv isin $nick) || ($IsExempt($chan) == $true) || ($IsExempt($nick) == $true) { goto end } inc % [ $+ [ $nick ] ] if (!$timer($nick)) { .timer $+ $nick 1 $protection(timer) unset % $+ $nick } if (% [ $+ [ $nick ] ] >= $protection(num)) { .ignore -u180 $nick $+ !*@* .echo -a $+ $color(info) $+ * 4Flooding Detected: $+ $color(info) Notice by $nick - Ignored for 3 minutes. close -m $nick unset % [ $+ [ $nick ] ] } } :end } on *:INVITE:#: { if ($protection(iflood) == on) { if (Serv isin $nick) || ($IsExempt($chan) == $true) || ($IsExempt($nick) == $true) { goto end } inc %invites if (!$timer(invite)) { .timerinvite 1 $protection(timer) unset %invites } if (%invites >= $calc($protection(num) - 1)) { ignore -iu240 *!*@* echo -a $+ $color(info) $+ * - 4Flooding Detected: $+ $color(info) Invite Flood - All invites ignored for 4 minutes. } } :end } Quote Link to comment Share on other sites More sharing options...