#-------------------------------------------------------------------------------------------------------------
# COPYRIGHT C.LEONHARDT 2007 for the people who stole my script and
# posted it to the egghelp tcl archive without giving me any credit.
# Except the stolen copy looks like sh*t, doesn't work and is specific
# for wincrap.
# kickban top ten html list - requires the script I made here (or at least the same general log format):
# http://forum.egghelp.org/viewtopic.php?p=68656#68656
#
# Log Format (case-insensitive):
# Ban: set by $nick
# Kick: set by $nick
# And no, this counter does not differentiate between kicks and bans, it just totals everything by nick.
# I leave it up to others to further refine the script if you want it to distinguish kicks or bans. :P
# The html format is simply <pre> tags.. Feel free to change it below. You break it, you keep the pieces.
# Bind to run script once a day at midnight (uncomment the line below to enable)
#bind time - "01 00 * * *" proc:kblog
# Bind for running script manually
bind msg - .kblog proc:kblogmsg
proc proc:kblogmsg {nick uhost hand text} {
proc:kblog 00 00 * * *
return
}
proc proc:kblog {min hr day mon yr} {
# change these to your file locations/names.
set kickbanlog "/tmp/kickban.log"
set htmlfile "/tmp/kblog.html"
if {![file exists $kickbanlog]} {putcmdlog "There's no kick-ban log to work with!";return}
set input [open $kickbanlog r]
set logtemp [split [read $input] \n]
catch {close $input}
# array bit below borrowed from my quotes script.
set kbtmp "";set kbnum "";set usermatch "";set kbusertmp "";set showkbuser "";set count 0
foreach line $logtemp {
if {$line != ""} {
set kbtmp [lindex $line 3]
if {[array names kbname $kbtmp] == ""} {
array set kbname "$kbtmp 1"
} else {
set kbnum [lindex [array get kbname $kbtmp] 1]
incr kbnum
array set kbname "$kbtmp $kbnum"
}
}
}
foreach {name count} [array get kbname] {
set usermatch "$name: total kicks/bans: $count"
lappend kbusertmp $usermatch
}
array unset kbname
# just in case we have no data, abort.
if {$kbusertmp == ""} {putcmdlog "Hmm..No data..PUNT!";return}
# sort the data
if {$kbusertmp != ""} {
set showkbuser "[lsort -integer -decreasing -index 3 $kbusertmp]"
}
set count 0
foreach item [lrange $showkbuser 0 end] {
incr count
# This limits the output to the top 10. Change the number to whatever you want.
if {$count < 11} {
lappend output "<pre>Top Ten Kick-Banners: $count\: $item</pre>"
} else {
break
}
}
# write the new html data
set outfile [open $htmlfile w]
foreach line [lrange $output 0 end] {
puts $outfile $line
}
flush $outfile
catch {close $outfile}
putcmdlog "Wrote kickban html file.."
}
putlog "kbloghtml.tcl loaded"
Tested..Worked for me. YMMV
Last edited by rosc2112 on Mon Mar 05, 2007 4:31 am, edited 1 time in total.
Dude, we "Stolen" only your idea from the fisrt tcl http://forum.egghelp.org/viewtopic.php? ... ckban+html
and complete the new one tcl.
But I promise you, that I will send version 2.0 of this script, and put your CREDITS there.
Thanks a lot again !
Give credit where credit is due.. Or, actually, considering how sloppy and horribly written "your" script was, don't even bother, I don't want to be associated with that mess. Write your own code from scratch.