This is/was my second attemp on a proper dialog, and it ended up well. I came up with the dialog structure, finished it, and DarthReven topped it off, with some special stuff. (he remade most of the $did events, thanks!)
How to use:
Either click status (in the main menu) or right click the channel.
After that, you'll see the "Blacklist". Hold ur mouse cursor over it, and a option "Open Dialog" will pop up, cick it, and the rest is pretty much self explanatory.
If you find any bugs, questions about anything, or if it aint working, leave a comment and ill see what I can do.
Also leave a comment of what you simply think of the code!
Good? Bad? Average? Why?
Just some constructive information!
Also, rate it ;)
Once again, Special thanks to DarthReven!
(If you wonder why I made it, It was simply to keep ban evaders away! Cause, im in a crowded channel, and people tend to ban evade. When I did it like this, it worked out pretty nice ;).)
-EDIT-
With the help yet again, from Darthreven, he managed to solve the problem, to see if the eprson is on any of your provided channels. Which you will be promped for.
Many thanks to him.
Also a few aliases got removed, that didnt make much sence, and as I noticed the start event was not needed, I cleaned it up.
on *:start: {
if ($version < 6.16) {
echo -st » You are running a version below 6.16 which might cause troubble!
echo -st » I highly advice you to download the newest mIRC client from http://www.mirc.com
echo -st » The script will not unload itself, automaicly.
unload -rs $script
}
else {
if (!%action) {
%action = kick
%chan = -Undefined-
%k.msg = Ban evaders don't belong here! And Don't come back!
}
}
}
on *:unload: { unset %action | unset %chan | unset %k.msg | .remove ban_evasion_list.txt }
menu status,channel,nicklist,query {
-
Ban Evasion
.Open dialog: dialog -m Ban_Evasion Ban_Evasion
.$iif($active ischan,Advertise) {
if ($active ischan) { msg $active Blacklist AKA Ban evasion protection by 4Lindrian! v.0.4 | msg $active Contact me through irc.deltaanime.net @ #Lindrian or #L2forever! Also join me at: irc.ungowa.org @ #Ungowa }
}
}
dialog ban_evasion {
Title "Ban the ban evaders~"
Size -1 -1 200 245
Tab "General", 1, 0 10 200 240
Tab "Settings", 18
Tab "BlackList", 2
Text "Enable/Disable", 3, 20 40 89 19, tab 1
Button "&on", 4, 10 56 180 19, tab 1
Text "Please, do not 'modify' this code and call it yours!", 6, 20 85 140 50, tab 1, disabled
Text "v.0.4 by Lindrian.", 7, 20 115 140 50, tab 1, disabled
List 5, 5 45 108 200, tab 2
Button "&Add user", 9, 120 75 75 23, tab 2
Button "&Remove user", 10, 120 100 75 23, tab 2
Box "Status", 11, 10 140 180 85 , tab 1
Text • Status:, 12, 25 155 130 15, tab 1
Text • Action:, 14, 25 177 130 15, tab 1
Text • Channel: , 13, 25 200 200 15, tab 1
Button "Remov&e all", 16, 120 125 75 23, tab 2
text "Theese are the current settings!", 17, 10 40 180 15, tab 18, disabled
Text "Kick message: (?)", 33, 10 60 100 15, tab 18
Edit "", 19, 10 80 160 20, tab 18 autohs
Text "Channel: (?)", 20, 10 115 120 15, tab 18
Edit "", 21, 10 135 160 20, tab 18 autohs
Text • Action: , 22, 10 170 200 100 50, tab 18
Text "Blacklist section", 51, 120 50 75 20, disable, tab 2
Text $chr(169) $+ Lindrian ɛ $chr(10) 2006 - 2007, 53, 130 185 75 75, disable, tab 2
Button Kick, 24, 60 195 50 23, tab 18
Button Ban, 25, 10 195 50 23, tab 18
Button Kick/ban, 26, 10 220 100 23, tab 18
Button "Save", 27, 140 195 50 23, tab 18
Button "?", 28, 175 80 20 19, tab 18
Button "?", 35, 175 135 20 19, tab 18
Button "?", 36, 175 170 20 19, tab 18
Text "————————————————————————————————————", 29, 10 100 180 15, tab 18 disabled
Text "————————————————————————————————————", 30, 10 155 180 15, tab 18 disabled
Button "Cancel", 31, 140 220 50 23, ok, tab 18
}
on *:dialog:ban_evasion:*:*:{
if ($devent == init) {
if ($group(#ban_evasion) == on) { did -ra $dname 4 o&ff }
if ($isfile(ban_evasion_list.txt)) { loadbuf -o $dname 5 ban_evasion_list.txt }
if (%action == ban) { did -b $dname 19 }
did -a $dname 12 • Status: $group(#ban_evasion)
did -a $dname 14 • Action: $iif(%action,$v1,-undefined-)
did -a $dname 13 • Channel: $iif(%chan,$v1,-undefined-)
did -a $dname 22 • Action: $iif(%action,$v1,-undefined-)
did -a $dname 19 %k.msg
did -a $dname 21 %chan
}
else {
if ($devent == sclick) {
if ($did == 4) {
if ($remove($did($v1),&) == on) { enable #ban_evasion }
else { disable #ban_evasion }
did -ra $dname 4 $iif($group(#ban_evasion) == on,o&ff,&on)
did -a $dname 12 • Status: $group(#ban_evasion)
}
elseif ($did == 9) {
var %nick = $?="Username to add into Blacklist:"
if (%nick) && (%nick !isin $didtok($dname,5,32)) {
did -a $dname 5 %nick
write ban_evasion_list.txt %nick
var %option $input(Would you like to search your $iif($numtok(%chan,44) > 1,channels,channel) for $+(%nick,?),yv,Blacklist - Check)
if (%option == $yes) { $ban_evade_process(%nick) }
}
else {
beep 2
var %e_code = $iif(!%nick,No nick was given to add to the blacklist.,%nick is already in the blacklist.), %error
%error = $input(%e_code,o,Error - Blacklist)
}
}
elseif ($did == 10) {
if ($did(5).sel) { did -d $dname 5 $v1 | write $+(-dl,$did(5).sel) ban_evasion_list.txt }
else { beep 2 | var %error $input(No nick was selected to be removed,o,Error - Blacklist) }
}
elseif ($did == 16) {
var %del_chk $input(Please conferm that you would like to clear your blacklist completely,vn,Blacklist Clear)
if (%del_chk == $yes) { did -r $dname 5 | .remove ban_evasion_list.txt }
}
elseif ($istok(24 25 26,$did,32)) {
if ($did == 24) {
if (%action != kick) { %action = $v2 | did -e $dname 19 }
else { beep 2 | var %error $input(Your action is already set to kick.,o,Error - Blacklist) }
}
elseif ($did == 25) {
if (%action != ban) { %action = $v2 | did -b $dname 19 }
else { beep 2 | var %error $input(Your action is already set to ban.,o,Error - Blacklist) }
}
else {
if (%action != ban/kick) { %action = $v2 | did -e $dname 19 }
else { beep 2 | var %error $input(Your action is already set to ban/kick.,o,Error - Blacklist) }
}
}
elseif ($did == 27) {
if (%k.msg != $did(19)) || (%chan != $did(21)) {
%k.msg = $iif(%k.msg != $did(19),$v2,%k.msg)
%chan = $iif(%chan != $did(21),$v2,%chan)
did -ra $dname 19 %k.msg
did -ra $dname 21 %chan
did -ra $dname 31 Ok
}
}
elseif ($istok(28 35 36,$did,32)) {
if ($did == 28) { var %? $input(This field is for inputing a custom kick message,o,Blacklist Information) }
elseif ($did == 35) { var %? $input(This field is for inputing channel names seperated by commas $crlf EX: $+(#Hawkee.com,$chr(44),#teens,$chr(44),#scripting),o,Blacklist Information) }
else { var %? $input(This field indecates what action will be taken when the script detects a user on your blacklist.,o,Blacklist Information) }
}
}
}
}
alias ban_evade_reset {
var %r_chk $input(Would you like to reset all settings to default? $crlf $str(-,55) $crlf Action: kick $crlf Channel: -Undefined- $crlf Kick Message: Ban evaders don't belong here! And Don't come back! $crlf $str(-,55),yv,Blacklist - Reset)
if (%r_chk == $yes) {
%action = kick
%chan = -Undefined-
%k.msg = Ban evaders don't belong here! And Don't come back!
.remove ban_evasion_list.txt
var %out $input(All settings have been reset to script defaults,o,Blacklist - Reset)
}
}
alias ban_evade_process {
var %chan_# $numtok(%chan,44), %nick, %out
:%chan_#
if ($ial($1).nick) {
%nick = $v1
if (%nick ison $gettok(%chan,%chan_#,44)) { %out = $v2 | goto punish }
else { dec %chan_# | if (%chan_#) { goto $v1 } | else { var %error $input(Sorry there was no match found for $1,o,Blacklist - Channel Check) } }
}
else { var %error = $input(Sorry $1 could not be found on $network right now,o,Blacklist - Channel Check) }
:punish
if ($nick(%out,$me,oh)) {
if (%action == kick) { kick %out %nick %k.msg }
elseif (%action == ban) { ban %out %nick 2 }
else { ban -k %out %nick 2 %k.msg }
}
}
#ban_evasion on
on *:join:%chan: {
if ($nick != $me) {
if ($nick($chan,$me,oh)) {
if ($ban_evade($nick,$chan).nick) || ($ban_evade($nick,$chan).addr) || ($ban_evade($nick,$chan).wild) {
if (%action == kick) { kick $chan $nick %k.msg }
elseif (%action == ban) { ban $chan $nick 2 }
else { ban -k $chan $nick 2 %k.msg }
}
close -@ @ban_evade
}
}
}
on !*:part:%chan: {
if ($nick != $me) {
if ($nick($chan,$me,oh)) {
if ($ban_evade($nick,$chan).nick) || ($ban_evade($nick,$chan).addr) || ($ban_evade($nick,$chan).wild) {
if (%action == kick) { return }
elseif (%action == ban) { ban $chan $nick 2 }
else { ban -k $chan $nick 2 %k.msg }
}
close -@ @ban_evade
}
}
}
alias ban_evade {
if ($prop) {
if ($v1 == nick) { if ($read(ban_evasion_list.txt,s,$1)) { return $true } }
elseif ($v1 == addr) {
if ($address($1,5)) {
var %mask 1
while (%mask <= 9) { if ($read(ban_evasion_list.txt,s,$address($1,%mask))) { return $true | %mask = 9 } | inc %mask }
}
}
elseif ($v1 == wild) {
window -ahH @ban_evade
loadbuf @ban_evade ban_evasion_list.txt
var %numeric 1
while (%numeric <= $line(@ban_evade,0)) {
if ($line(@ban_evade,$v1) iswm $1) { return $true }
inc %numeric
}
}
}
}
#ban_evasion end