I wrote a script but it won't work.
The intention is that after a join a file read.
and if the nick is not in the list there would deposit money to the file
proc join:money {nick host 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
}
money chan nick hand
}
}
proc money {chan nick hand what} {
set line_to_add "$nick|500"
set fname "money.txt"
set fp [open $fname "a"]
puts $fp $line_to_add
close $fp
putserv "NOTICE $nick :Welkom op $chan, u heeft zojuist geld ontvangen"
putserv "NOTICE $nick :om bij mij uit te kunnen geven aan de bar."
return 0
}