PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : fehler in nem badword script


sYpHx
16.07.2006, 18:10
also ich hab n badword script

an sich funzt auch alles gut
nur spamt der mich dauernd mit ner fehler meldung zu und ich finde die ursache nich
und ich dreh noch durch bei den ganzen meldungen ^^

also der fehler is der:

Tcl error [word_fct]: can't read "kill": no such variable

# description: Kicks/Bans people who says bad words. Words are stored in file. Op protect is allowed. You can add new words without rehash/restart.

# Author: Tomekk
# e-mail: tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.2
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# default ban type is: *!*ident*@some.domain.com [4]

# added: 4 ban types
# fixed: some code fixes

# sets ban type
# 1) *!*@*.domain.com
# 2) *!*@some.domain.com
# 3) *nick*!*@some.domain.com
# 4) *!*ident*@some.domain.com
set btype 4

# 1 - protect ops, 0 - dont
set protectops "1"

# 1 - enable ban, 0 - disable ban
set want_ban "1"

# wait $wait times before ban
set wait "0"

# base directory
set dirname "badwords.db"

# kick message
set msg "bad word!"

# users directory
set usersdir "$dirname/lusers"

# dbase with bad words
set dbase "words_bank.db"

if {[file exists $dirname] == 0} {
file mkdir $dirname
set crtdb [open $dirname/$dbase a+]
puts $crtdb "fuck\nshit"
close $crtdb
}

if {[file exists $usersdir] == 0} {
file mkdir $usersdir
}

proc create_db { dbname definfo } {
if {[file exists $dbname] == 0} {
set crtdb [open $dbname a+]
puts $crtdb "$definfo"
close $crtdb
}
}

proc readdb { rdb } {
global ident times
set fs_open [open $rdb r]
gets $fs_open dbout
close $fs_open

set separate [split $dbout "&"]
set ident [lindex $separate 0]
set times [lindex $separate 1]
}

bind pubm - * word_fct

proc word_fct { nick uhost hand chan arg } {
global botnick dbase dirname protectops usersdir times ident wait want_ban msg

set f [open $dirname/$dbase]
set allwords [read $f]
close $f
set nasty_words [split $allwords "\n"]

if {[isop $botnick $chan]} {
foreach i [string tolower $nasty_words] {
if {$i != ""} {
if {[string match *$i* [string tolower $arg]]} {
if {$protectops == "0"} {
set kill "1"
} {
if {[isop $nick $chan] == "1"} {
continue
} {
set kill "1"
}
}
}
}
}

if {$kill == "1"} {
if {$want_ban == "1"} {
if {[file exists $usersdir/$nick] == 0} {
create_db "$usersdir/$nick" "$uhost&1"
} {
readdb "$usersdir/$nick"

file delete $usersdir/$nick

set overall [expr $times + 1]

create_db "$usersdir/$nick" "$ident&$overall"

readdb "$usersdir/$nick"

set player_ident "[banmask $uhost $nick]"

if {"$uhost" == "$ident"} {
if {$times >= $wait} {
putquick "MODE $chan +b $player_ident"
file delete $usersdir/$nick
}
} {
file delete $usersdir/$nick
create_db "$usersdir/$nick" "$uhost&1"
}

}
}
putkick $chan $nick $msg
}
}
}

proc banmask {host nick} {
global btype

switch -- $btype {

1 {
set mask "*!*@[lindex [split [maskhost $host] "@"] 1]"
}

2 {
set mask "*!*@[lindex [split $host @] 1]"
}

3 {
set mask "*$nick*!*@[lindex [split $host "@"] 1]"
}

4 {
set mask "*!*[lindex [split $host "@"] 0]*@[lindex [split $host "@"] 1]"
}

return $mask
}
}

putlog "tkbadword.tcl ver 0.2 by Tomekk loaded :: ficken? xD"

wäre echt gut wen mir wer helfen könnt :)

mfg


DarkAngel52457
17.07.2006, 20:58
der fehler sagt dir eigendlich schon was der fehler ist der wert kill kann nicht gelesen werden bessergesagt du hast keine variable kill und ich vermute mal schwer das es daran liegt weil du hier einen fehler hast


if {$protectops == "0"} {
set kill "1"
} {
if {[isop $nick $chan] == "1"} {
continue
} {
set kill "1"
}



schaue mal solltest du eigendlich alleine hin bekommen gucke dir mal an wo du denn wert setzt

sYpHx
19.07.2006, 12:01
ehrlich gesagt bekomm ichs nicht selbst hin ^^

meine tcl fähigkeiten sind recht beschränkt, das der fehler daran liegt hab ich der nachricht auch entnehmen können aber ich sehe nicht was daran im script falsch sein soll.

und wie gesagt meine tcl fähigkeiten sind beschränkt drum könnte ich nur raten was da nich stimmt, daher bitte ich hier um hilfe :)

trotzdem ty

mfg

tomekk
13.08.2006, 22:44
Hi People,

I found this bug at google (lol).
Yes, its my fault. I forgot to assign default value for 'kill' string.

Here is a fixed version, try this:

# description: Kicks/Bans people who says bad words. Words are stored in file. Op protect is allowed. You can add new words without rehash/restart.

# Author: Tomekk
# e-mail: tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.3
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# default ban type is: *!*ident*@some.domain.com [4]

# fixed: code fixes

# sets ban type
# 1) *!*@*.domain.com
# 2) *!*@some.domain.com
# 3) *nick*!*@some.domain.com
# 4) *!*ident*@some.domain.com
set btype 4

# 1 - protect ops, 0 - dont
set protectops "0"

# 1 - enable ban, 0 - disable ban
set want_ban "0"

# wait $wait times before ban
set wait "3"

# base directory
set dirname "badwords.db"

# kick message
set msg "bad word!"

# users directory
set usersdir "$dirname/lusers"

# dbase with bad words
set dbase "words_bank.db"

if {[file exists $dirname] == 0} {
file mkdir $dirname
set crtdb [open $dirname/$dbase a+]
puts $crtdb "fuck\nshit"
close $crtdb
}

if {[file exists $usersdir] == 0} {
file mkdir $usersdir
}

proc create_db { dbname definfo } {
if {[file exists $dbname] == 0} {
set crtdb [open $dbname a+]
puts $crtdb "$definfo"
close $crtdb
}
}

proc readdb { rdb } {
global ident times
set fs_open [open $rdb r]
gets $fs_open dbout
close $fs_open

set separate [split $dbout "&"]
set ident [lindex $separate 0]
set times [lindex $separate 1]
}

bind pubm - * word_fct

proc word_fct { nick uhost hand chan arg } {
global botnick dbase dirname protectops usersdir times ident wait want_ban msg

set f [open $dirname/$dbase]
set allwords [read $f]
close $f
set nasty_words [split $allwords "\n"]

set kill 0

if {[isop $botnick $chan]} {
foreach i [string tolower $nasty_words] {
if {$i != ""} {
if {[string match *$i* [string tolower $arg]]} {
if {$protectops == "0"} {
set kill "1"
} {
if {[isop $nick $chan] == "1"} {
continue
} {
set kill "1"
}
}
}
}
}

if {$kill == "1"} {
if {$want_ban == "1"} {
if {[file exists $usersdir/$nick] == 0} {
create_db "$usersdir/$nick" "$uhost&1"
} {
readdb "$usersdir/$nick"

file delete $usersdir/$nick

set overall [expr $times + 1]

create_db "$usersdir/$nick" "$ident&$overall"

readdb "$usersdir/$nick"

set player_ident "[banmask $uhost $nick]"

if {"$uhost" == "$ident"} {
if {$times >= $wait} {
putquick "MODE $chan +b $player_ident"
file delete $usersdir/$nick
append msg " - banned"
}
} {
file delete $usersdir/$nick
create_db "$usersdir/$nick" "$uhost&1"
}

}
}
putkick $chan $nick $msg
}
}
}

proc banmask {host nick} {
global btype

switch -- $btype {

1 {
set mask "*!*@[lindex [split [maskhost $host] "@"] 1]"
}

2 {
set mask "*!*@[lindex [split $host @] 1]"
}

3 {
set mask "*$nick*!*@[lindex [split $host "@"] 1]"
}

4 {
set mask "*!*[lindex [split $host "@"] 0]*@[lindex [split $host "@"] 1]"
}

return $mask
}
}

putlog "tkbadword.tcl ver 0.3 by Tomekk loaded"


best regards, tomekk