Hello ... I have a score file in which there are two things when its output it seems like this
teamname,points
example
Gladiators,5000 Titanic,3000 Clusters,2000
at months end it reset whole file and i just want to delete the scores and reset it to 0 as below
Gladiators,0 Titanic,0 Clusters,0
#MANUALLY reset current Team Member scores & Team Scores for month MANUALLY
proc tgresetscores {nick host hand text} {
global tgteambyname tgteamscore tgscoresbyname tgteamscoretotal
global tgtscf tgteamscore
if {($tgresetreqpw==1 && [passwdok $hand $text]) || $tgresetreqpw==0} {
if {[file exists member.scores]&&[file size member.scores]>2} {
set _sfile [open member.scores w]
puts $_sfile ""
close $_sfile
set tgteamscore ""
set tgteamscoretotal 0
}
#THIS IS THE 2ND PART WHICH IS RESETTING WHOLE FILE WE JUST NEED TO DELETE THE SCORE NOT THE TEAM
if {[file exists $tgtscf]&&[file size $tgtscf]>2} {
set _sfile [open $tgtscf w]
puts $_sfile ""
close $_sfile
set tgteamscore ""
set tgteamscoretotal 0
}
tggamemsg "[tgcolrset]===== Score table & Stats reset by $nick! ====="
}
}
[/code]
Last edited by Mas on Thu Mar 03, 2016 5:00 pm, edited 1 time in total.
proc tgresetscores {nick host hand text} {
global tgteambyname tgteamscore tgscoresbyname tgteamscoretotal
global tgtscf tgteamscore
if {($tgresetreqpw==1 && [passwdok $hand $text]) || $tgresetreqpw==0} {
if {[file exists member.scores]&&[file size member.scores]>2} {
set _sfile [open member.scores w]
puts $_sfile ""
close $_sfile
### remove 2 lines here ###
}
#THIS IS THE 2ND PART WHICH WE JUST NEED TO DELETE THE SCORE NOT THE TEAM
set tlist [array names tgteamscore]
foreach team $tlist {
set tgteamscore($team) 0
}
tgsavescores
set tgteamscoretotal [llength $tlist]
tggamemsg "[tgcolrset]===== Score table & Stats reset by $nick! ====="
}
}