ID:164338
 
scoreboard_add(name,score)
if(!name)return
if(!score)return
if(score >= 1e+20)score = 1e+1000
if(findtext("[scoretext]","[name]"))
var/a
var/n = 0
var/z
var/out
for(var/i = 1, i <= length(scoretext), i++){if(!n){z = length(name) + 1;a = copytext(scoretext, i, i+z);if(a == "[name]="){i += z;n = 1};else{a = copytext(scoretext, i, i+1);out += a}};else{out +="[name]=[num2text(round(score),100)]&";i = findtext3("[scoretext]","&",i);n = 0}}
if(out){scoretext = out;scorelist = params2list(scoretext);return}
scoretext += "[name]=[num2text(round(score),100)]&"
scorelist = params2list(scoretext)


In this scoreboard add can sameone tell me how to make the rever to make it remove a person from it i try alot of ways but or does not remove or removes the wrong score please help me i try everything and i wanst able please
If you had made that scoreboard yourself, you would know how to remove someone from it.

But do not fret, I will give you an example on how to make your own scoreboards:

var/list/scores

proc
scoreboard_add(name,score)
if(!scores) scores=list(0,0)

if(!(name in scores)) scores+=name
scores[name]=score
scoreboard_remove(name)
if(!scores) return
if(name in scores) scores-=name

if(!scores.len) scores=null


It's that easy! In fact, if you want to output scores, all you have to do is this:

mob/verb/output_scores()
if(scores&&scores.len)
usr<<"<b>Name</b>\t <b>Score</b>"
for(var/X in scores) usr<<"[X]\t [scores[X]]"
else usr<<"There are no scores posted yet."


-- Data
In response to Android Data
look into the code i posted its not that easy because the level of the person is connected with the name so i have to make it look first into the name and than delete them both so your way dont work in the one im using but tkz
squadscoreboard_remove(name,squad)
if(!name)return
if(!squad)return
if(squad==1)
sq1scorelist=params2list(sq1scoretext)
var/list/w = list(sq1scoretext)
for(var/T in w)
var/z=1
var/n
var/found=0
world<<"Start: [T]"
check
world<<"Right now is [n]"
n+=copytext(T, z, z+1)
if(n==name){found++}
if(z>length(T)){if(found){goto delete};else{continue}}
z++
goto check
delete
world<<"Deleting [n] and [sq1scoretext]"
world<<"Deleted [n] and [sq1scoretext]"
var/p=n
sq1scoretext -= p
sq1scorelist=params2list(sq1scoretext)
break


Please i really need help i will post down from here the result of the command


runtime error: type mismatch
proc name: squadscoreboard remove (/mob/proc/squadscoreboard_remove)
usr: Sapo (/mob)
src: Sapo (/mob)
call stack:
Sapo (/mob): squadscoreboard remove("Sapo", 1, 1)
Sapo (/mob): Leave Squad()
Start: Sapo=1&
Right now is
Right now is S
Right now is Sa
Right now is Sap
Right now is Sapo
Right now is Sapo=
Right now is Sapo=1
Right now is Sapo=1&
Deleting Sapo=1& and Sapo=1&
Deleted Sapo=1& and Sapo=1&
Sapo left squad 1


i know the error is in sq1scoretext -= p but i dont know why i dont see any problem in it
In response to Destroior
That is terrible, terrible, terrible, TERRIBLE code, and I suggest you scrap it immediately.
In response to Garthor
already recoded and already is working but tkz anyway