|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
Anyone able to make this code work in this dialog? dialog ops.script { title "Bad Script Protection" size -1 -1 148 162 option dbu combo 1, 9 28 125 85, sort size button "Add", 2, 5 148 45 12 button "Delete", 3, 52 148 44 12 edit "", 202, 4 132 139 12, multi autohs autovs box "Enter Bad Script To Ban.", 5, 5 18 135 101 text "Enter the kick message below!", 6, 4 122 138 8, center button "Ok", 7, 98 148 45 12, ok } alias { dialog -dmn ops.script ops.script } on 1:dialog:ops.script:sclick:*: { if ($did == 2) { } if ($did == 3) { } if ($did == 4) { } if ($did == 7) { } if ($did == 9) { } }
on $*:text:/^!ctcp (on|off)/Si:*:{
if $nick isop $chan {
set $+(%,ctcp,.,$chan) $iif($2 == on,$true,$false)
}
elseif !$chan {
var %a = 1, %b = $comchan($nick,0)
while %a <= %b {
if $nick isop $comchan($nick,%a) {
set $+(%,ctcp,.,$comchan($nick,%a)) $iif($2 == on,$true,$false)
}
inc %a
}
}
}
on @*:join:#:{
if $($+(%,ctcp,.,$chan),2) && !$($+(%,version.check,.,$address),2) {
.ctcp $nick VERSION
set -e $+(%,version.check,.,$address) $chan
}
}
on *:ctcpreply:version*:{
if $($+(%,version.check,.,$address),2) {
if !$hget(vercheck) { hmake vercheck 10 }
filter -c CTCP.txt CTCP.txt ?*
if $filtered { hdel -w vercheck * | hload -n vercheck CTCP.txt }
if $hfind(vercheck,$strip($2-),1,R).data { ban -k $($+(%,version.check,.,$address),2) $nick 2 14Bad Script Detected }
halt
}
}
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
with alterations the two can be made to work with each other. I need to know the following: 1) Do you want the kick message to be specific to the bad script detected? The dialog implies yes, but the scripted code implies no. 2) What format do you want the entry of the bad scripts to use? plain text as entered, plain text with regex automatically added, regex as entered. Personally, the plain text is the easiest, but in your code you do a regex comparison.
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
What ever you think is best and it dont matter for for the kick msg but it would be nice if you could added in :P
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
ok...I'm heading to bed, as I have to be at work in 5 1/2 hours, but I'll do this up when I get home tomorrow (probably between 9 & 10 am EDT)
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
ok cool thx Ill be here
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
The banned CTCP version replies are in the same place (CTCP.txt), the kicks are stored in CTCP2.txt.
dialog ops.script {
title "Bad Script Protection"
size -1 -1 148 162
option dbu
combo 1, 9 28 125 85, sort size
button "Add", 2, 5 148 45 12
button "Delete", 3, 52 148 44 12
edit "", 202, 4 132 139 12, multi autohs autovs
box "Enter Bad Script To Ban.", 5, 5 18 135 101
text "Enter the kick message below!", 6, 4 122 138 8, center
button "Ok", 7, 98 148 45 12, ok
}
alias { dialog -dmn ops.script ops.script }
on 1:dialog:ops.script:*:*: {
if ($devent == init) {
did -b $dname 3
var %x = 1
while (%x <= $lines(CTCP.txt)) {
did -a $dname 1 $read(CTCP.txt,%x)
inc %x
}
}
if ($devent == sclick) {
if ($did == 1) {
did -e $dname 3
}
if ($did == 2) {
if ($did($dname,1)) && ($did($dname,202)) {
if (!$didwm(ops.script,1,$did($dname,1),0)) {
write CTCP.txt $did($dname,1)
write CTCP2.txt $did($dname,202)
did -a $dname 1 $did($dname,1)
}
}
}
if ($did == 3) {
write -dw $did($dname,1).seltext CTCP.txt
write $+(-d,$did($dname,1).sel) CTCP2.txt
did -d $dname 1 $did($dname,1).sel
did -b $dname 3
}
}
}
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
ok cool and where is the kick msg?
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
The kick messages are stored in CTCP2.txt.
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
ic ok cool let me try this thx :P
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
I cant add from the dialog and when i remove a script it also removes my kick msg from CTCP2.txt file.
Last edited by Garou; 16/06/07 12:17 AM.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Adding items seems to work for me, you have to have both editboxes filled before adding something.
I made it remove the kick message from the CTCP2.txt file because I thought the kick message was supposed to be specific to the script. Did you want random messages? Because that would be a lot easier.
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
No i need the same kick msg for all the bad script so maybe i dont need ctcp2.txt i can just use the kick msg in the box?
Last edited by Garou; 16/06/07 12:39 AM.
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
I removed the ctcp2.txt file hope i did it right. Is it possible to use the check box or make button from the dialog to turn on/off this way I would not need it in the menubar.
menu menubar {
-
Bad Script Protection:{ dialog -dmn ops.script ops.script }
-
CTCP VERSION # ( %ctcp. [ $+ [ # ] ] )
.ON:.set %ctcp. $+ # $true | echo 10 -ta CTCP Version For # is On.
.OFF:.set %ctcp. $+ # $false | echo 10 -ta CTCP Version For # is Off.
-
}
dialog ops.script {
title "Bad Script Protection"
size -1 -1 148 162
option dbu
combo 1, 9 15 125 95, sort size
button "Add", 2, 5 148 45 12, flat
button "Delete", 3, 52 148 44 12, flat
edit "14Bad Script Detected (Opscript)", 202, 4 132 139 12, autohs
box "Enter Bad Script To Ban.", 5, 5 5 135 110
text "Enter the kick message below!", 6, 4 120 138 8, center
button "Ok", 7, 98 148 45 12, flat, ok
check "On/Off", 333, 115 120 138 10
}
on 1:dialog:ops.script:*:*: {
if ($devent == init) {
did -b $dname 3
var %x = 1
while (%x <= $lines(CTCP.txt)) {
did -a $dname 1 $read(CTCP.txt,%x)
inc %x
}
}
if ($devent == sclick) {
if ($did == 1) {
did -e $dname 3
}
if ($did == 2) {
if ($did($dname,1)) {
if (!$didwm(ops.script,1,$did($dname,1),0)) {
write CTCP.txt $did($dname,1)
did -a $dname 1 $did($dname,1)
}
}
}
if ($did == 3) {
write -dw $did($dname,1).seltext CTCP.txt
did -d $dname 1 $did($dname,1).sel
did -b $dname 3
}
}
}
on $*:text:/^!ctcp (on|off)/Si:*:{
if $nick isop $chan {
set $+(%,ctcp,.,$chan) $iif($2 == on,$true,$false)
}
elseif !$chan {
var %a = 1, %b = $comchan($nick,0)
while %a <= %b {
if $nick isop $comchan($nick,%a) {
set $+(%,ctcp,.,$comchan($nick,%a)) $iif($2 == on,$true,$false)
}
inc %a
}
}
}
on @*:join:#:{
if $($+(%,ctcp,.,$chan),2) && !$($+(%,version.check,.,$address),2) {
.ctcp $nick VERSION
set -e $+(%,version.check,.,$address) $chan
}
}
on *:ctcpreply:version*:{
if $($+(%,version.check,.,$address),2) {
if !$hget(vercheck) { hmake vercheck 10 }
filter -c CTCP.txt CTCP.txt ?*
if $filtered { hdel -w vercheck * | hload -n vercheck CTCP.txt }
if $hfind(vercheck,$strip($2-),1,R).data { ban -k $($+(%,version.check,.,$address),2) $nick 2 14Bad Script Detected }
halt
}
}
Last edited by Garou; 16/06/07 06:12 PM.
|
|
|
|
|