3 #include "command/common.qh"
4 #include "mutators/all.qh"
5 #include "../common/playerstats.qh"
6 #include "../common/teams.qh"
9 entity teamscorekeepers[16];
10 string scores_label[MAX_SCORE];
11 float scores_flags[MAX_SCORE];
12 string teamscores_label[MAX_TEAMSCORE];
13 float teamscores_flags[MAX_TEAMSCORE];
14 float teamscores_entities_count;
15 var .float scores_primary;
16 var .float teamscores_primary;
17 float scores_flags_primary;
18 float teamscores_flags_primary;
20 vector ScoreField_Compare(entity t1, entity t2, .float field, float fieldflags, vector previous, float strict) // returns: cmp value, best prio
22 if(!strict && !(fieldflags & SFL_SORT_PRIO_MASK)) // column does not sort
24 if((fieldflags & SFL_SORT_PRIO_MASK) < previous.y)
26 if (t1.(field) == t2.(field))
29 previous.y = fieldflags & SFL_SORT_PRIO_MASK;
31 if(fieldflags & SFL_ZERO_IS_WORST)
38 else if (t2.(field) == 0)
45 if (fieldflags & SFL_LOWER_IS_BETTER)
46 previous.x = (t2.(field) - t1.(field));
48 previous.x = (t1.(field) - t2.(field));
57 bool TeamScore_SendEntity(entity this, entity to, float sendflags)
59 float i, p, longflags;
61 WriteHeader(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
62 int t = this.team - 1;
63 assert(t, eprint(this));
64 WriteByte(MSG_ENTITY, t);
67 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
68 if(self.(teamscores[i]) > 127 || self.(teamscores[i]) <= -128)
71 #if MAX_TEAMSCORE <= 8
72 WriteByte(MSG_ENTITY, sendflags);
73 WriteByte(MSG_ENTITY, longflags);
75 WriteShort(MSG_ENTITY, sendflags);
76 WriteShort(MSG_ENTITY, longflags);
78 for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
82 WriteInt24_t(MSG_ENTITY, self.(teamscores[i]));
84 WriteChar(MSG_ENTITY, self.(teamscores[i]));
90 void TeamScore_Spawn(float t, string name)
92 entity ts = new(csqc_score_team);
94 ts.netname = name; // not used yet, FIXME
96 Net_LinkEntity(ts, false, 0, TeamScore_SendEntity);
97 teamscorekeepers[t - 1] = ts;
98 ++teamscores_entities_count;
99 PlayerStats_GameReport_AddTeam(t);
102 float TeamScore_AddToTeam(float t, float scorefield, float score)
109 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
110 if(t <= 0 || t >= 16)
114 error("Adding score to invalid team!");
116 s = teamscorekeepers[t - 1];
121 error("Adding score to unknown team!");
124 if(teamscores_label[scorefield] != "")
125 s.SendFlags |= pow(2, scorefield);
126 return (s.(teamscores[scorefield]) += score);
129 float TeamScore_Add(entity player, float scorefield, float score)
131 return TeamScore_AddToTeam(player.team, scorefield, score);
134 float TeamScore_Compare(entity t1, entity t2, float strict)
136 if(!t1 || !t2) return (!t2) - !t1;
138 vector result = '0 0 0';
140 for(i = 0; i < MAX_TEAMSCORE; ++i)
144 result = ScoreField_Compare(t1, t2, f, teamscores_flags[i], result, strict);
147 if (result.x == 0 && strict)
148 result.x = t1.team - t2.team;
154 * the scoreinfo entity
157 void ScoreInfo_SetLabel_PlayerScore(float i, string label, float scoreflags)
159 scores_label[i] = label;
160 scores_flags[i] = scoreflags;
161 if((scoreflags & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
163 scores_primary = scores[i];
164 scores_flags_primary = scoreflags;
168 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
169 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
173 void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags)
175 teamscores_label[i] = label;
176 teamscores_flags[i] = scoreflags;
177 if((scoreflags & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
179 teamscores_primary = teamscores[i];
180 teamscores_flags_primary = scoreflags;
184 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
185 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
189 bool ScoreInfo_SendEntity(entity this, entity to, int sf)
192 WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES_INFO);
193 WriteInt24_t(MSG_ENTITY, MapInfo_LoadedGametype);
194 for(i = 0; i < MAX_SCORE; ++i)
196 WriteString(MSG_ENTITY, scores_label[i]);
197 WriteByte(MSG_ENTITY, scores_flags[i]);
199 for(i = 0; i < MAX_TEAMSCORE; ++i)
201 WriteString(MSG_ENTITY, teamscores_label[i]);
202 WriteByte(MSG_ENTITY, teamscores_flags[i]);
207 void ScoreInfo_Init(float teams)
209 if(scores_initialized)
211 scores_initialized.SendFlags |= 1; // force a resend
215 scores_initialized = new(ent_client_scoreinfo);
216 make_pure(scores_initialized);
217 Net_LinkEntity(scores_initialized, false, 0, ScoreInfo_SendEntity);
220 TeamScore_Spawn(NUM_TEAM_1, "Red");
222 TeamScore_Spawn(NUM_TEAM_2, "Blue");
224 TeamScore_Spawn(NUM_TEAM_3, "Yellow");
226 TeamScore_Spawn(NUM_TEAM_4, "Pink");
230 * per-player score entities
233 bool PlayerScore_SendEntity(entity this, entity to, float sendflags)
235 float i, p, longflags;
237 WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES);
238 WriteByte(MSG_ENTITY, etof(self.owner));
241 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
242 if(self.(scores[i]) > 127 || self.(scores[i]) <= -128)
246 WriteByte(MSG_ENTITY, sendflags);
247 WriteByte(MSG_ENTITY, longflags);
249 WriteShort(MSG_ENTITY, sendflags);
250 WriteShort(MSG_ENTITY, longflags);
252 for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
256 WriteInt24_t(MSG_ENTITY, self.(scores[i]));
258 WriteChar(MSG_ENTITY, self.(scores[i]));
264 float PlayerScore_Clear(entity player)
269 if(teamscores_entities_count)
272 if(MUTATOR_CALLHOOK(ForbidPlayerScore_Clear)) return 0;
274 sk = player.scorekeeper;
275 for(i = 0; i < MAX_SCORE; ++i)
277 if(sk.(scores[i]) != 0)
278 if(scores_label[i] != "")
279 sk.SendFlags |= pow(2, i);
286 void Score_ClearAll()
290 FOREACH_CLIENTSLOT(true,
295 for(int j = 0; j < MAX_SCORE; ++j)
297 if(sk.(scores[j]) != 0)
298 if(scores_label[j] != "")
299 sk.SendFlags |= pow(2, j);
303 for(t = 0; t < 16; ++t)
305 sk = teamscorekeepers[t];
308 for(int j = 0; j < MAX_TEAMSCORE; ++j)
310 if(sk.(teamscores[j]) != 0)
311 if(teamscores_label[j] != "")
312 sk.SendFlags |= pow(2, j);
313 sk.(teamscores[j]) = 0;
318 void PlayerScore_Attach(entity player)
320 if(player.scorekeeper)
321 error("player already has a scorekeeper");
322 entity sk = new(scorekeeper);
325 Net_LinkEntity(sk, false, 0, PlayerScore_SendEntity);
326 player.scorekeeper = sk;
329 void PlayerScore_Detach(entity player)
331 if(!player.scorekeeper)
332 error("player has no scorekeeper");
333 remove(player.scorekeeper);
334 player.scorekeeper = world;
337 float PlayerScore_Add(entity player, float scorefield, float score)
339 bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score);
343 if(!mutator_returnvalue)
346 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
347 entity s = player.scorekeeper;
352 LOG_WARNING("Adding score to unknown player!");
356 if(scores_label[scorefield] != "")
357 s.SendFlags |= pow(2, scorefield);
359 PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_TOTAL, scores_label[scorefield]), score);
360 return (s.(scores[scorefield]) += score);
363 float PlayerTeamScore_Add(entity player, float pscorefield, float tscorefield, float score)
366 r = PlayerScore_Add(player, pscorefield, score);
367 if(teamscores_entities_count) // only for teamplay
368 r = TeamScore_Add(player, tscorefield, score);
372 float PlayerScore_Compare(entity t1, entity t2, float strict)
374 if(!t1 || !t2) return (!t2) - !t1;
376 vector result = '0 0 0';
378 for(i = 0; i < MAX_SCORE; ++i)
382 result = ScoreField_Compare(t1, t2, f, scores_flags[i], result, strict);
385 if (result.x == 0 && strict)
386 result.x = etof(t1.owner) - etof(t2.owner);
391 void WinningConditionHelper()
396 entity winnerscorekeeper;
397 entity secondscorekeeper;
401 // gametype:P<pure>:S<slots>::plabel,plabel:tlabel,tlabel:teamid:tscore,tscore:teamid:tscore,tscore
402 // score labels always start with a symbol or with lower case
403 // so to match pure, match for :P0:
404 // to match full, match for :S0:
406 fullstatus = autocvar_g_full_getstatus_responses;
409 s = strcat(s, ":", autocvar_g_xonoticversion);
410 s = strcat(s, ":P", ftos(cvar_purechanges_count));
411 s = strcat(s, ":S", ftos(nJoinAllowed(self, world)));
412 s = strcat(s, ":F", ftos(serverflags));
413 s = strcat(s, ":M", modname);
414 s = strcat(s, "::", GetPlayerScoreString(world, (fullstatus ? 1 : 2)));
416 if(teamscores_entities_count)
420 s = strcat(s, ":", GetTeamScoreString(0, 1));
421 for(t = 0; t < 16; ++t)
422 if(teamscorekeepers[t])
423 s = strcat(s, ":", ftos(t+1), ":", GetTeamScoreString(t+1, 1));
425 WinningConditionHelper_winnerteam = -1;
426 WinningConditionHelper_secondteam = -1;
427 winnerscorekeeper = world;
428 secondscorekeeper = world;
429 for(t = 0; t < 16; ++t)
431 sk = teamscorekeepers[t];
432 c = TeamScore_Compare(winnerscorekeeper, sk, 1);
435 WinningConditionHelper_secondteam = WinningConditionHelper_winnerteam;
436 WinningConditionHelper_winnerteam = t + 1;
437 secondscorekeeper = winnerscorekeeper;
438 winnerscorekeeper = sk;
442 c = TeamScore_Compare(secondscorekeeper, sk, 1);
445 WinningConditionHelper_secondteam = t + 1;
446 secondscorekeeper = sk;
451 WinningConditionHelper_equality = (TeamScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
452 if(WinningConditionHelper_equality)
453 WinningConditionHelper_winnerteam = WinningConditionHelper_secondteam = -1;
455 WinningConditionHelper_topscore = winnerscorekeeper.teamscores_primary;
456 WinningConditionHelper_secondscore = secondscorekeeper.teamscores_primary;
457 WinningConditionHelper_lowerisbetter = (teamscores_flags_primary & SFL_LOWER_IS_BETTER);
458 WinningConditionHelper_zeroisworst = (teamscores_flags_primary & SFL_ZERO_IS_WORST);
460 WinningConditionHelper_winner = world; // not supported in teamplay
461 WinningConditionHelper_second = world; // not supported in teamplay
465 WinningConditionHelper_winner = world;
466 WinningConditionHelper_second = world;
467 winnerscorekeeper = world;
468 secondscorekeeper = world;
469 FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
471 c = PlayerScore_Compare(winnerscorekeeper, sk, 1);
474 WinningConditionHelper_second = WinningConditionHelper_winner;
475 WinningConditionHelper_winner = it;
476 secondscorekeeper = winnerscorekeeper;
477 winnerscorekeeper = sk;
481 c = PlayerScore_Compare(secondscorekeeper, sk, 1);
484 WinningConditionHelper_second = it;
485 secondscorekeeper = sk;
490 WinningConditionHelper_equality = (PlayerScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
491 if(WinningConditionHelper_equality)
492 WinningConditionHelper_winner = WinningConditionHelper_second = world;
494 WinningConditionHelper_topscore = winnerscorekeeper.scores_primary;
495 WinningConditionHelper_secondscore = secondscorekeeper.scores_primary;
496 WinningConditionHelper_lowerisbetter = (scores_flags_primary & SFL_LOWER_IS_BETTER);
497 WinningConditionHelper_zeroisworst = (scores_flags_primary & SFL_ZERO_IS_WORST);
499 WinningConditionHelper_winnerteam = -1; // no teamplay
500 WinningConditionHelper_secondteam = -1; // no teamplay
503 if(WinningConditionHelper_topscore == 0)
505 if(scores_flags_primary & SFL_ZERO_IS_WORST)
507 if(WinningConditionHelper_lowerisbetter)
508 WinningConditionHelper_topscore = 999999999;
510 WinningConditionHelper_topscore = -999999999;
512 WinningConditionHelper_equality = 0;
515 if(WinningConditionHelper_secondscore == 0)
517 if(scores_flags_primary & SFL_ZERO_IS_WORST)
519 if(WinningConditionHelper_lowerisbetter)
520 WinningConditionHelper_secondscore = 999999999;
522 WinningConditionHelper_secondscore = -999999999;
527 strunzone(worldstatus);
528 worldstatus = strzone(s);
530 FOREACH_CLIENT(true, LAMBDA(
534 s = GetPlayerScoreString(it, 1);
535 s = strcat(s, IS_REAL_CLIENT(it) ? ":human" : ":bot");
536 ret_string = string_null;
537 if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it, s))
538 s = strcat(s, ":spectator");
539 if (ret_string) s = strcat(s, ret_string);
543 ret_string = string_null;
544 if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it, s))
545 s = GetPlayerScoreString(it, 2);
548 if (ret_string) s = strcat(s, ret_string);
552 strunzone(it.clientstatus);
553 it.clientstatus = strzone(s);
557 string GetScoreLogLabel(string label, float fl)
559 if(fl & SFL_LOWER_IS_BETTER)
560 label = strcat(label, "<");
561 if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
562 label = strcat(label, "!!");
563 else if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
564 label = strcat(label, "!");
568 string GetPlayerScoreString(entity pl, float shortString)
579 for(i = 0; i < MAX_SCORE; ++i)
580 if((scores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
584 out = strcat(out, GetScoreLogLabel(l, f), ",");
587 for(i = 0; i < MAX_SCORE; ++i)
588 if((scores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
592 out = strcat(out, GetScoreLogLabel(l, f), ",");
595 for(i = 0; i < MAX_SCORE; ++i)
596 if((scores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
597 if((scores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
601 out = strcat(out, GetScoreLogLabel(l, f), ",");
603 out = substring(out, 0, strlen(out) - 1);
605 else if((sk = pl.scorekeeper))
607 for(i = 0; i < MAX_SCORE; ++i)
608 if((scores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
609 out = strcat(out, ftos(sk.(scores[i])), ",");
611 for(i = 0; i < MAX_SCORE; ++i)
612 if((scores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
613 out = strcat(out, ftos(sk.(scores[i])), ",");
615 for(i = 0; i < MAX_SCORE; ++i)
616 if((scores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
617 if((scores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
618 out = strcat(out, ftos(sk.(scores[i])), ",");
619 out = substring(out, 0, strlen(out) - 1);
624 string GetTeamScoreString(float tm, float shortString)
635 for(i = 0; i < MAX_TEAMSCORE; ++i)
636 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
638 f = teamscores_flags[i];
639 l = teamscores_label[i];
640 out = strcat(out, GetScoreLogLabel(l, f), ",");
643 for(i = 0; i < MAX_TEAMSCORE; ++i)
644 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
646 f = teamscores_flags[i];
647 l = teamscores_label[i];
648 out = strcat(out, GetScoreLogLabel(l, f), ",");
651 for(i = 0; i < MAX_TEAMSCORE; ++i)
652 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
653 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
655 f = teamscores_flags[i];
656 l = teamscores_label[i];
657 out = strcat(out, GetScoreLogLabel(l, f), ",");
659 out = substring(out, 0, strlen(out) - 1);
661 else if((sk = teamscorekeepers[tm - 1]))
663 for(i = 0; i < MAX_TEAMSCORE; ++i)
664 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
665 out = strcat(out, ftos(sk.(teamscores[i])), ",");
667 for(i = 0; i < MAX_TEAMSCORE; ++i)
668 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
669 out = strcat(out, ftos(sk.(teamscores[i])), ",");
671 for(i = 0; i < MAX_TEAMSCORE; ++i)
672 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
673 if((teamscores_flags[i] & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
674 out = strcat(out, ftos(sk.(teamscores[i])), ",");
675 out = substring(out, 0, strlen(out) - 1);
680 float PlayerTeamScore_Compare(entity p1, entity p2, float teams, float strict)
682 if(teams && teamscores_entities_count)
684 if(p1.team != p2.team)
688 t1 = teamscorekeepers[p1.team - 1];
689 t2 = teamscorekeepers[p2.team - 1];
690 r = TeamScore_Compare(t1, t2, ((teams >= 0) ? 1 : strict));
697 return PlayerScore_Compare(p1.scorekeeper, p2.scorekeeper, strict);
700 entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators)
702 entity p, plist, pprev, pbest, pbestprev, pfirst, plast;
707 FOREACH_CLIENT(true, LAMBDA(it.(field) = 0));
709 FOREACH_CLIENT(it.scorekeeper,
712 if(it.frags == FRAGS_SPECTATOR)
718 // Now plist points to the whole list.
720 pfirst = plast = world;
725 pprev = pbestprev = world;
727 for(p = plist; (pprev = p), (p = p.chain); )
729 if(PlayerTeamScore_Compare(p, pbest, teams, strict) > 0)
736 // remove pbest out of the chain
737 if(pbestprev == world)
740 pbestprev.chain = pbest.chain;
744 if(!plast || PlayerTeamScore_Compare(plast, pbest, teams, 0))
759 float TeamScore_GetCompareValue(float t)
764 if(t <= 0 || t >= 16)
768 error("Reading score of invalid team!");
771 sk = teamscorekeepers[t - 1];
774 s = sk.teamscores_primary;
775 if(teamscores_flags_primary & SFL_ZERO_IS_WORST)
778 if(teamscores_flags_primary & SFL_LOWER_IS_BETTER)
783 const float NAMEWIDTH = 22;
784 const float SCORESWIDTH = 58;
785 // TODO put this somewhere in common?
786 string Score_NicePrint_ItemColor(float vflags)
788 if(vflags & SFL_SORT_PRIO_PRIMARY)
790 else if(vflags & SFL_SORT_PRIO_SECONDARY)
796 void Score_NicePrint_Team(entity to, float t, float w)
804 sk = teamscorekeepers[t - 1];
807 s = strcat(s, Team_ColoredFullName(t));
808 for(i = 0; i < MAX_TEAMSCORE; ++i)
809 if(teamscores_label[i] != "")
811 fl = teamscores_flags[i];
812 sc = sk.(teamscores[i]);
813 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), ScoreString(fl, sc));
819 s = strcat(s, strpad(max(0, NAMEWIDTH - strlennocol(s)), ""));
821 for(i = 0; i < MAX_SCORE; ++i)
822 if(scores_label[i] != "")
824 fl = scores_flags[i];
825 s2 = scores_label[i];
826 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, substring(s2, 0, w)));
832 void Score_NicePrint_Player(entity to, entity p, float w)
842 s = strcat(s, p.netname);
845 i = strlennocol(s) - NAMEWIDTH;
847 s = substring(s, 0, strlen(s) - i);
850 s = strcat(s, strpad(i, ""));
855 for(i = 0; i < MAX_SCORE; ++i)
856 if(scores_label[i] != "")
858 fl = scores_flags[i];
860 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, ScoreString(fl, sc)));
866 void Score_NicePrint_Spectators(entity to)
868 print_to(to, "Spectators:");
871 void Score_NicePrint_Spectator(entity to, entity p)
873 print_to(to, strcat(" ", p.netname));
876 .float score_dummyfield;
877 void Score_NicePrint(entity to)
884 for(i = 0; i < MAX_SCORE; ++i)
885 if(scores_label[i] != "")
887 w = bound(6, floor(SCORESWIDTH / t - 1), 9);
889 p = PlayerScore_Sort(score_dummyfield, 1, 1, 0);
892 if(!teamscores_entities_count)
893 Score_NicePrint_Team(to, t, w);
896 if(teamscores_entities_count)
898 Score_NicePrint_Team(to, p.team, w);
899 Score_NicePrint_Player(to, p, w);
905 FOREACH_CLIENT(!IS_PLAYER(it), LAMBDA(
907 Score_NicePrint_Spectators(to);
908 Score_NicePrint_Spectator(to, it);
913 void PlayerScore_PlayerStats(entity p)
919 for(i = 0; i < MAX_SCORE; ++i)
920 if(s.(scores[i]) != 0)
921 if(scores_label[i] != "")
922 PS_GR_P_ADDVAL(s.owner, strcat(PLAYERSTATS_SCOREBOARD, scores_label[i]), s.(scores[i]));
925 void PlayerScore_TeamStats()
929 for(t = 0; t < 16; ++t)
931 sk = teamscorekeepers[t];
934 for(i = 0; i < MAX_TEAMSCORE; ++i)
935 if(sk.(teamscores[i]) != 0)
936 if(teamscores_label[i] != "")
937 // the +1 is important here!
938 PS_GR_T_ADDVAL(t+1, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label[i]), sk.(teamscores[i]));