This adds a command !top10 which shows the top ten most speaking users and the amount of words spoken.
I do realise there is a flaw with the method im using at the moment, specifically the variable size limit and I will change it to bin vars as soon as someone actually manages to hit it.
on *:TEXT:*:#:{
writeini words.ini $chan $nick $calc($readini(words.ini,$chan,$nick) + $0)
if ($1 == !top10) {
var %i 1
while (%i <= $ini(words.ini,$chan,0)) {
var %w $+(%w,:,$readini(words.ini,$chan,$ini(words.ini,$chan,%i)),-,$ini(words.ini,$chan,%i))
inc %i
}
var %w $sorttok(%w,58,nr)
var %i 1
while (%i <= 10) {
var %q $gettok(%w,%i,58)
var %win %win $+(%i,.) $gettok(%q,2,45) ( $+ $bytes($gettok(%q,1,45),b) $+ )
inc %i
}
msg $chan Top ten: %win
}
}