bind pub - !money pub:money
proc pub:money {nick host hand chan arg} {
global botnick
set searchstring $arg
set fname "money.txt"
set fp [open $fname "r"]
set data [read -nonewline $fp]
close $fp
set lines [split $data "\n"]
set searchresult ""
foreach line $lines {
if {[string match * $nick* [join $line]]} {
lappend searchresult $line
}
if {[$nick == "[lindex [split [join $searchresult] "|"] 0]"} {
putserv "NOTICE $nick :Je bent al een keer hier geweest."
return 0
}
putserv "NOTICE $nick :You have €[lindex [split [join $searchresult] "|"] 1]"} {
return 0
}
}
And i'm getting this error: [14:35:22] Tcl error [pub:money]: wrong # args: should be "foreach varList list ?varList list ...? command"
bind pub - !money pub:money
proc pub:money {nick host hand chan arg} {
global botnick
set searchstring $arg
set fname "money.txt"
set fp [open $fname "r"]
set data [read -nonewline $fp]
close $fp
set lines [split $data "\n"]
set searchresult ""
foreach line $lines {
if {[string match * $nick* [join $line]]} {
lappend searchresult $line
}
if {[$nick == "[lindex [split [join $searchresult] "|"] 0]"} {
putserv "NOTICE $nick :Je bent al een keer hier geweest."
return 0
}
putserv "NOTICE $nick :You have €[lindex [split [join $searchresult] '|'] 1]"
return 0
}
}
Think to indent your code and you'll see this kind of errors