|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
Is it possible for someone to make a bad word trigger script using this dialog with a timer kick message?
alias cspam _dialog -dmn cspam cspam
dialog cspam {
title "Offensive Words Trigger"
size -1 -1 400 320
list 1, 10 45 380 210, sort
button "Add", 2, 30 290 60 25, default,flat
button "Update", 7, 100 290 60 25, disable,flat
button "Remove", 3, 170 290 60 25, disable,flat
check "Enable Protection", 4, 50 250 120 25
edit "", 5, 10 20 380 25, autohs
box "You Can Use Wildmasks Trigger", 6, 5 5 390 275
check "Use penalty on spammer", 8, 200 250 150 25
button "Ok", 9, 310 290 60 25, ok,flat
button "Cancel", 10, 240 290 60 25, cancel,flat
}
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
A few small problems with your dialog layout, and a recommendation for a change to your layout, along with the balance of the code to the best of my ability based on what you've given. alias cspam dialog $iif(!$dialog(cspam),-mdn,-ev) cspam cspam
dialog cspam {
title "Offensive Words Trigger"
size -1 -1 400 320
option pixels
combo 1, 10 20 380 235, size
button "Add", 2, 30 290 60 25, disable default flat
button "Update", 7, 100 290 60 25, disable flat
button "Remove", 3, 170 290 60 25, disable flat
check "Enable Protection", 4, 50 250 120 25
box "You Can Use Wildmasks Trigger", 6, 5 5 390 275
check "Use penalty on spammer", 8, 200 250 150 25
button "Ok", 9, 310 290 60 25, flat ok
button "Cancel", 10, 240 290 60 25, flat cancel
}
on *:dialog:cspam:init:0:{
if !$hget(cspam) { .hmake cspam 100 }
if $exists(cspam.hsh) { .hload cspam cspam.hsh }
did -r $dname 1
var %a = 1, %b = $hget(cspam,0).item
while %a <= %b {
did -a $dname 1 $hget(cspam,%a).item
inc %a
}
}
on *:dialog:cspam:edit:1:{
did -e $dname 2
}
on *:dialog:cspam:sclick:2:{
did -a $dname 1 $did(1,0)
did -d $dname 1 0
}
on *:dialog:cspam:sclick:3:{
if $did(1,0) {
did -d $dname 1 $didwm($dname,1,$did(1,0))
}
elseif $did(1).seltext {
did -d $dname 1 $did(1).sel
}
}
on *:dialog:cspam:dclick:1:{
did -d $dname 1 $did(1).sel
}
on *:dialog:cspam:sclick:1:{
did -e $dname 2,7
}
on *:dialog:cspam:sclick:7:{
did -d $dname 1 $did(1).sel
did -a $dname 1 $did(1,0)
}
on *:dialog:cspam:sclick:9:{
.hfree cspam
var %a = 1, %b = $did(1).lines
while %a <= %b {
.hadd -m cspam %a $did(1,%a)
inc %a
}
.hadd -m cspam Enabled $did(4).state
.hadd -m cspam Penalty $did(8).state
}
on *:dialog:cspam:close:0:{
if $hget(cspam,0).item {
.hsave -o cspam cspam.hsh
}
}
on *:dialog:cspam:sclick:4:{
.hadd -m cspam Enabled $did(4).state
}
on *:dialog:cspam:sclick:8:{
.hadd -m cspam Penalty $did(8).state
}
on @*:text:*:#:{
if $hget(cspam,Enabled) {
var %a = 1, %b = $0
while %a <= %b {
if $hfind(cspam,$gettok($1-,%a,32),1) {
if !$hget(cspam,Penalty) {
kick $chan $nick Bad Word detected
%a = %b
}
else {
.hinc cspam $fulladddress 10
.ban -ku $+ $hget(cspam,$fulladdress) $chan $nick Bad Words detected. Ban for $duration($hget(cspam,$fulladdress))
%a = %b
}
}
inc %a
}
}
}
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
If you want, then i can send u my bad word kicker, it works just fine, and you need to configure your dialog so it works with my code, or use the popup menus i made, made a dialog too, but thats something i havent been riping out from my script
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
Its not working, when i add a word its adding a numbers and its also adding the word Enabled and Penalty ??
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Sorry, change did -a $dname 1 $hget(cspam,%a).item to did -a $dname 1 $hget(cspam,%a).data That should be the only change you need.
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
Ok thx and also when I check the enable and penalty box all it does is add number 1 and the box wont stay checked.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Re-write alias cspam dialog $iif(!$dialog(cspam),-mdn,-ev) cspam cspam
dialog cspam {
title "Offensive Words Trigger"
size -1 -1 400 320
option pixels
combo 1, 10 20 380 235, size
button "Add", 2, 30 290 60 25, disable default flat
button "Update", 7, 100 290 60 25, disable flat
button "Remove", 3, 170 290 60 25, disable flat
check "Enable Protection", 4, 50 250 120 25
box "You Can Use Wildmasks Trigger", 6, 5 5 390 275
check "Use penalty on spammer", 8, 200 250 150 25
button "Ok", 9, 310 290 60 25, flat ok
button "Cancel", 10, 240 290 60 25, flat cancel
}
on *:dialog:cspam:*:*:{
if $devent == init {
if !$hget(cspam) { .hmake cspam 100 }
if $exists(cspam.hsh) { .hload cspam cspam.hsh }
did -r $dname 1
did $iif($hget(cspam,Enabled),-c,-u) $dname 4
did $iif($hget(cspam,Penalty),-c,-u) $dname 8
var %a = 1, %b = $hget(cspam,0).item
while %a <= %b {
if !$istok(Enabled Protect,$hget(cspam,%a).item,32) { did -a $dname 1 $hget(cspam,%a).data }
inc %a
}
}
elseif $devent == dclick && $did == 1 { did -d $dname 1 $did(1).sel }
elseif $devent == edit && $did == 1 { did -e $dname 2 }
elseif $devent == sclick {
if $did == 2 {
did -a $dname 1 $did(1,0)
did -d $dname 1 0
}
elseif $did == 3 { did -d $dname 1 $iif($did(1).sel,$v1,$didwm($dname,1,$did(1,0))) }
elseif $did == 1 { did -e $dname 2,7 }
elseif $did == 7 {
did -d $dname 1 $did(1).sel
did -a $dname 1 $did(1,0)
}
elseif $did == 9 {
.hfree cspam
var %a = 1, %b = $did(1).lines
while %a <= %b {
.hadd -m cspam %a $did(1,%a)
inc %a
}
.hadd -m cspam Enabled $did(4).state
.hadd -m cspam Penalty $did(8).state
}
elseif $did == 4 || $did == 8 {
.hadd -m cspam $iif($did == 4,Enabled,Penalty) $did($did).state
}
}
elseif $devent == close {
if $hget(cspam,0).item {
.hsave -o cspam cspam.hsh
}
}
}
on @*:text:*:#:{
if $hget(cspam,Enabled) {
var %a = 1, %b = $0
while %a <= %b {
if $hfind(cspam,$gettok($1-,%a,32),1).data {
if !$hget(cspam,Penalty) {
kick $chan $nick Bad Word detected
%a = %b
}
else {
.hinc cspam $fulladddress 10
.ban -ku $+ $hget(cspam,$fulladdress) $chan $nick Bad Words detected. Ban for $duration($hget(cspam,$fulladdress))
%a = %b
}
}
inc %a
}
}
}
Last edited by RusselB; 07/05/07 04:40 AM.
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
Ok i still cant see the checks in the check box and it wont kick or ban :P
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
All working but it wont kick or ban :P
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Does the bot/client that the code is on have full ops in the channel? If not, make it so. If so, what, if any, error messages are being generated?
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
Yes its full sop and no I dont get any error.
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
missed a parameter in the $hfind line, so it was looking in the item, not the data for the match. Sorry. Code edited.
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
Cool its working fine now :P Last questions please, Why all these numbers adding in the box and in cspam.hash when i add a bad word?
3 0 4 0 5 1 6 1 7 1 8 1 9 1 Enabled 1 Penalty 1 12 1 10 gay 11 1 1 1 2 fag
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
Only thing I can think of, is that it's an accumulation of past runs of the code that didn't work properly. If you don't have many words added yet, before you run the code next time, issue the following commands: /remove cspam.hsh /hfree cspam
|
|
|
|
Joined: Aug 2006
Posts: 469
Fjord artisan
|
OP
Fjord artisan
Joined: Aug 2006
Posts: 469 |
ok thx very much for all your help.
|
|
|
|
|