I made this little procedure to have ranking under CTS Reloaded... nothing perfect, but working
Enjoy...
PHP Code:
proc cts-quota:rank { nick uhost hand chan text } { global cts enabled
set us [lindex [split $text] 0]
cts-quota:save.quota $nick $uhost $hand $chan $text
set stats [readfile $cts(progdir)/cts/logs/cts.quota.now]
foreach line [split $stats '\n'] {
lappend lista [lindex [split $line '|'] 1]
}
set sorted [lsort -integer -decreasing [split $lista]]
set y 1
set z 1
set precelem 0
set prec "First!"
set diff 0
foreach element [split [lrange $sorted 0 100]] {
foreach line [split $stats '\n'] {
if { $element == "[lindex [split $line '|'] 1]" && $element != 0 } {
set login [lindex [split $line '|'] 0]
set diff [expr $precelem-$element+1]
if { [lindex [split $login '@'] 0] == $us && $y == 1 } {hubsend msg 5 $chan MSG "\0033\[\003RANKiNG\0033\]\003\00312:\003 \0033[b][u]$us[u][b]\003 you are the \0034FiRST\003 with [b]$element[b] mbs globally uploaded! Well done!"}
if { [lindex [split $login '@'] 0] == $us && $y != 1 } {hubsend msg 5 $chan MSG "\0033\[\003RANKiNG\0033\]\003\00312:\003 \0034(\003\00314$us\003\0034)\003, your position is \0034(\003\00314$y\003\0034)\003 with \0034(\003\00314$element\003\0034)\003 mbs globally uploaded. You need to up \0034(\003\00314$diff\003\0034)\003 mbs more to hook \0034(\003\00314$prec\003\0034)\003 and gain position \0034(\003\00314$z\003\0034)\003"}
set prec [lindex [split $login '@'] 0]
set precelem $element
set z $y
incr y
}
}
}
}
Add it under cts-quota.tcl
PS: Obviously is not PHP, just to have some colours