Code: Select all
#triggered when someone uses !top10 command
proc tgshowtop10 {nick host hand chan text} {
global tgscores tgchan tgscorestotal
if {[strlwr $chan]==[strlwr $tgchan]} {
tggetscores
if {$tgscorestotal>0} {
if {$tgscorestotal>9} {
set _max 9
} else {
set _max [expr $tgscorestotal-1]
}
set i 0
while {$i<=$_max} {
set _item [lindex $tgscores $i]
set _nick [join [lindex [split $_item ,] 2]]
set _score [join [lindex [split $_item ,] 0]]
if {$i==0} {
append _scores "[tgcolscr1]$_nick $_score"
} elseif {$i==1} {
append _scores ", [tgcolscr2]$_nick $_score"
} elseif {$i==2} {
append _scores ", [tgcolscr3]$_nick $_score"
} else {
append _scores ", [tgcolmisc1]$_nick $_score"
}
incr i
}
tggamemsg "[tgcolmisc1]Top 10: $_scores"
} else {
tggamemsg "[tgcolmisc1]Score table is empty."
}
}
}