proc do_addpts { nick rest } {

set bsscores ""
set bsscfile /home/nameless/eggdrop/scripts/bsscores.txt

if {![file exists $bsscfile]} {
        set fd [open $bsscfile w]
        puts $fd "0"
set bsscores ""
set bsscfile /home/nameless/eggdrop/scripts/bsscores.txt

if {![file exists $bsscfile]} {
        set fd [open $bsscfile w]
        puts $fd "0"
        close $fd
        }

set fd [open $bsscfile r]
set sctot [gets $fd]
for { set bss 0 } { $bss < $sctot } { incr bss } {
        set line [gets $fd]
        lappend bsscores [split $line]
        }
close $fd

set nfound 0

for { set bss 0 } { $bss < [llength $bsscores] } { incr bss } {
        if { [lindex $bsscores $bss 0] == "$nick" } {
                set oscore [lindex $bsscores $bss 1]
                set nscore [expr $oscore + $rest]
                lset bsscores $bss 1 $nscore
                set nfound 1
                }
        }

if {$nfound == "0"} {
        lappend bsscores [ list $nick $rest ]
        }

set fd [open $bsscfile w]
set sctot [llength $bsscores]
puts $fd $sctot
for { set bss 0 } { $bss < $sctot } { incr bss } {
        set line [lindex $bsscores $bss]
        puts $fd $line
        }
close $fd

}