Code: Select all
# wordlist location
set wlloc scripts/wordlist.txt
# nicklist location
set nlloc scripts/nicklist.txt
bind pubm - * kickifnick
bind DCC n addnick [list addtolist nicklist]
bind DCC n addword [list addtolist wordlist]
bind DCC n delnick [list delfromlist nicklist]
bind DCC n delword [list delfromlist wordlist]
bind time ?0* savelists
if {[file exists $wlloc]} {
set wordlist [split [read [set fwl [open $wlloc]]] \n][close $fwl]
} { set wordlist [list] }
if {[file exists $nlloc]} {
set nicklist [split [read [set fwl [open $wlloc]]] \n][close $fwl]
} { set nicklist [list] }
proc kickifnick {nick uhost hand chan arg} {
global wordlist nicklist
if {[lsearch -exact $nicklist [string tolower $nick]] != -1} {
set f 0
foreach w $wordlist {
if {[string match -nocase $w [string tolower $arg]]} {
set f 1
break
}
}
if {$f} {
putserv "kick $chan $nick :Bad word detected..."
putserv "mode $chan +b *!*@[lindex [split $uhost @] 1]"
}
}
}
proc addtolist {t hand idx arg} {
upvar $t list
if {[lsearch -exact $list [string tolower $arg]] == -1} {
lappend list [string tolower $arg]
putdcc $idx "Successfully added $arg to $t."
} {
putdcc $idx "$arg already exists in $t."
}
}
proc delfromlist {t hand idx arg} {
upvar $t list
if {[set i [lsearch -exact $list [string tolower $arg]]] != -1} {
set list [lreplace $list $i $i]
putdcc $idx "Successfully deleted $arg from $t."
} {
putdcc $idx "$arg does not exists in $t."
}
}
proc savelists args {
global nicklist wordlist nlloc wlloc
set f1 [open $nlloc w]
set f2 [open $wlloc w]
foreach n $nicklist w $wordlist {
if {$n != ""} { puts $f1 $n }
if {$w != ""} { puts $f2 $n }
}
close $f1
close $f2
}
Nice way to post to a newb, and I wouldnt be posting in a request section if I knew the stuff mtself, now would I?metroid wrote:"Do it yourself"
It wouldn't hurt people to try something once in awhile. You can almost exactly copy the DCC code and change some things so it is MSG related.
Code: Select all
bind pubm - * kickifnick
bind pub n .addnick [list addtolist nicklist]
bind pub n .addword [list addtolist wordlist]
bind pub n .delnick [list delfromlist nicklist]
bind pub n .delword [list delfromlist wordlist]
Code: Select all
Tcl error [addtolist t hand idx arg]: wrong # args: should be "addtolist t hand idx arg"