3 #include "command/common.qh"
4 #include "mutators/_mod.qh"
5 #include <common/net_linked.qh>
6 #include "../common/playerstats.qh"
7 #include "../common/teams.qh"
8 #include <common/scores.qh>
11 entity teamscorekeepers[16];
12 float teamscores_entities_count;
13 var .float scores_primary;
14 var .float teamscores_primary;
15 float scores_flags_primary;
16 float teamscores_flags_primary;
18 vector ScoreField_Compare(entity t1, entity t2, .float field, float fieldflags, vector previous, float strict) // returns: cmp value, best prio
20 if(!strict && !(fieldflags & SFL_SORT_PRIO_MASK)) // column does not sort
22 if((fieldflags & SFL_SORT_PRIO_MASK) < previous.y)
24 if (t1.(field) == t2.(field))
27 previous.y = fieldflags & SFL_SORT_PRIO_MASK;
29 if(fieldflags & SFL_ZERO_IS_WORST)
36 else if (t2.(field) == 0)
43 if (fieldflags & SFL_LOWER_IS_BETTER)
44 previous.x = (t2.(field) - t1.(field));
46 previous.x = (t1.(field) - t2.(field));
55 bool TeamScore_SendEntity(entity this, entity to, float sendflags)
59 WriteHeader(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
60 int t = this.team - 1;
61 assert(t, eprint(this));
62 WriteByte(MSG_ENTITY, t);
65 for(i = 0; i < MAX_TEAMSCORE; ++i)
66 if(this.(teamscores(i)) > 127 || this.(teamscores(i)) <= -128)
69 #if MAX_TEAMSCORE <= 8
70 WriteByte(MSG_ENTITY, sendflags);
71 WriteByte(MSG_ENTITY, longflags);
73 WriteShort(MSG_ENTITY, sendflags);
74 WriteShort(MSG_ENTITY, longflags);
76 for(i = 0; i < MAX_TEAMSCORE; ++i)
77 if(sendflags & BIT(i))
79 if(longflags & BIT(i))
80 WriteInt24_t(MSG_ENTITY, this.(teamscores(i)));
82 WriteChar(MSG_ENTITY, this.(teamscores(i)));
88 void TeamScore_Spawn(float t, string name)
90 entity ts = new_pure(csqc_score_team);
91 ts.netname = name; // not used yet, FIXME
93 Net_LinkEntity(ts, false, 0, TeamScore_SendEntity);
94 teamscorekeepers[t - 1] = ts;
95 ++teamscores_entities_count;
96 PlayerStats_GameReport_AddTeam(t);
99 float TeamScore_AddToTeam(int t, float scorefield, float score)
106 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
107 if(t <= 0 || t >= 16)
111 error("Adding score to invalid team!");
113 s = teamscorekeepers[t - 1];
118 error("Adding score to unknown team!");
121 if(teamscores_label(scorefield) != "")
122 s.SendFlags |= (2 ** scorefield);
123 return (s.(teamscores(scorefield)) += score);
126 float TeamScore_Add(entity player, float scorefield, float score)
128 return TeamScore_AddToTeam(player.team, scorefield, score);
131 float TeamScore_Compare(entity t1, entity t2, float strict)
133 if(!t1 || !t2) return (!t2) - !t1;
135 vector result = '0 0 0';
137 for(i = 0; i < MAX_TEAMSCORE; ++i)
141 result = ScoreField_Compare(t1, t2, f, teamscores_flags(i), result, strict);
144 if (result.x == 0 && strict)
145 result.x = t1.team - t2.team;
151 * the scoreinfo entity
154 void ScoreInfo_SetLabel_PlayerScore(PlayerScoreField i, string label, float scoreflags)
156 scores_label(i) = label;
157 scores_flags(i) = scoreflags;
158 if((scoreflags & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
160 scores_primary = scores(i);
161 scores_flags_primary = scoreflags;
165 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
166 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
170 void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags)
172 teamscores_label(i) = label;
173 teamscores_flags(i) = scoreflags;
174 if((scoreflags & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
176 teamscores_primary = teamscores(i);
177 teamscores_flags_primary = scoreflags;
181 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
182 PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
186 bool ScoreInfo_SendEntity(entity this, entity to, int sf)
189 WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES_INFO);
190 WriteRegistered(Gametypes, MSG_ENTITY, MapInfo_LoadedGametype);
191 FOREACH(Scores, true, {
192 WriteString(MSG_ENTITY, scores_label(it));
193 WriteByte(MSG_ENTITY, scores_flags(it));
195 for(i = 0; i < MAX_TEAMSCORE; ++i)
197 WriteString(MSG_ENTITY, teamscores_label(i));
198 WriteByte(MSG_ENTITY, teamscores_flags(i));
203 void ScoreInfo_Init(int teams)
205 if(scores_initialized)
207 scores_initialized.SendFlags |= 1; // force a resend
211 scores_initialized = new_pure(ent_client_scoreinfo);
212 Net_LinkEntity(scores_initialized, false, 0, ScoreInfo_SendEntity);
215 TeamScore_Spawn(NUM_TEAM_1, "Red");
217 TeamScore_Spawn(NUM_TEAM_2, "Blue");
219 TeamScore_Spawn(NUM_TEAM_3, "Yellow");
221 TeamScore_Spawn(NUM_TEAM_4, "Pink");
225 * per-player score entities
228 bool PlayerScore_SendEntity(entity this, entity to, float sendflags)
230 WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES);
231 WriteByte(MSG_ENTITY, etof(this.owner));
234 FOREACH(Scores, true, {
235 int p = 1 << (i % 16);
236 if (this.(scores(it)) > 127 || this.(scores(it)) <= -128)
240 WriteShort(MSG_ENTITY, sendflags);
241 WriteShort(MSG_ENTITY, longflags);
242 FOREACH(Scores, true, {
243 int p = 1 << (i % 16);
247 WriteInt24_t(MSG_ENTITY, this.(scores(it)));
249 WriteChar(MSG_ENTITY, this.(scores(it)));
256 float PlayerScore_Clear(entity player)
260 if(teamscores_entities_count)
263 if(MUTATOR_CALLHOOK(ForbidPlayerScore_Clear)) return 0;
265 sk = CS(player).scorekeeper;
266 FOREACH(Scores, true, {
267 if(sk.(scores(it)) != 0)
268 if(scores_label(it) != "")
269 sk.SendFlags |= (2 ** (i % 16));
277 void Score_ClearAll()
281 FOREACH_CLIENTSLOT(true, {
282 sk = CS(it).scorekeeper;
284 FOREACH(Scores, true, {
285 if(sk.(scores(it)) != 0)
286 if(scores_label(it) != "")
287 sk.SendFlags |= (2 ** (i % 16));
292 for(t = 0; t < 16; ++t)
294 sk = teamscorekeepers[t];
297 for(int j = 0; j < MAX_TEAMSCORE; ++j)
299 if(sk.(teamscores(j)) != 0)
300 if(teamscores_label(j) != "")
301 sk.SendFlags |= (2 ** j);
302 sk.(teamscores(j)) = 0;
307 void PlayerScore_Attach(entity player)
309 if(CS(player).scorekeeper)
310 error("player already has a scorekeeper");
311 entity sk = new_pure(scorekeeper);
313 Net_LinkEntity(sk, false, 0, PlayerScore_SendEntity);
314 CS(player).scorekeeper = sk;
317 void PlayerScore_Detach(entity player)
319 if(!CS(player).scorekeeper)
320 error("player has no scorekeeper");
321 delete(CS(player).scorekeeper);
322 CS(player).scorekeeper = NULL;
325 float PlayerScore_Add(entity player, PlayerScoreField scorefield, float score)
327 bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score, player);
328 score = M_ARGV(1, float);
331 if(!mutator_returnvalue)
334 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
335 entity s = CS(player).scorekeeper;
340 LOG_WARN("Adding score to unknown player!");
345 return s.(scores(scorefield));
347 if(scores_label(scorefield) != "")
348 s.SendFlags |= (2 ** (scorefield.m_id % 16));
350 PlayerStats_GameReport_Event_Player(s.owner, strcat(PLAYERSTATS_TOTAL, scores_label(scorefield)), score);
351 s.(scores(scorefield)) += score;
352 MUTATOR_CALLHOOK(AddedPlayerScore, scorefield, score, player);
353 return s.(scores(scorefield));
356 float PlayerScore_Set(entity player, PlayerScoreField scorefield, float score)
358 if(!scores_initialized) return 0; // FIXME remove this when everything uses this system
359 entity s = CS(player).scorekeeper;
364 LOG_WARN("Setting score of unknown player!");
368 float oldscore = s.(scores(scorefield));
369 if(oldscore == score)
372 if(scores_label(scorefield) != "")
373 s.SendFlags |= (2 ** (scorefield.m_id % 16));
374 s.(scores(scorefield)) = score;
375 return s.(scores(scorefield));
378 float PlayerTeamScore_Add(entity player, PlayerScoreField pscorefield, float tscorefield, float score)
381 r = PlayerScore_Add(player, pscorefield, score);
382 if(teamscores_entities_count) // only for teamplay
383 r = TeamScore_Add(player, tscorefield, score);
387 float PlayerScore_Compare(entity t1, entity t2, float strict)
389 if(!t1 || !t2) return (!t2) - !t1;
391 vector result = '0 0 0';
392 FOREACH(Scores, true, {
393 var .float f = scores(it);
394 result = ScoreField_Compare(t1, t2, f, scores_flags(it), result, strict);
397 if (result.x == 0 && strict)
398 result.x = etof(t1.owner) - etof(t2.owner);
403 void WinningConditionHelper(entity this)
408 entity winnerscorekeeper;
409 entity secondscorekeeper;
413 // gametype:P<pure>:S<slots>::plabel,plabel:tlabel,tlabel:teamid:tscore,tscore:teamid:tscore,tscore
414 // score labels always start with a symbol or with lower case
415 // so to match pure, match for :P0:
416 // to match full, match for :S0:
418 fullstatus = autocvar_g_full_getstatus_responses;
421 s = strcat(s, ":", autocvar_g_xonoticversion);
422 s = strcat(s, ":P", ftos(cvar_purechanges_count));
423 s = strcat(s, ":S", ftos(nJoinAllowed(this, NULL)));
424 s = strcat(s, ":F", ftos(serverflags));
425 s = strcat(s, ":M", modname);
426 s = strcat(s, "::", GetPlayerScoreString(NULL, (fullstatus ? 1 : 2)));
428 if(teamscores_entities_count)
432 s = strcat(s, ":", GetTeamScoreString(0, 1));
433 for(t = 0; t < 16; ++t)
434 if(teamscorekeepers[t])
435 s = strcat(s, ":", ftos(t+1), ":", GetTeamScoreString(t+1, 1));
437 WinningConditionHelper_winnerteam = -1;
438 WinningConditionHelper_secondteam = -1;
439 winnerscorekeeper = NULL;
440 secondscorekeeper = NULL;
441 for(t = 0; t < 16; ++t)
443 sk = teamscorekeepers[t];
444 c = TeamScore_Compare(winnerscorekeeper, sk, 1);
447 WinningConditionHelper_secondteam = WinningConditionHelper_winnerteam;
448 WinningConditionHelper_winnerteam = t + 1;
449 secondscorekeeper = winnerscorekeeper;
450 winnerscorekeeper = sk;
454 c = TeamScore_Compare(secondscorekeeper, sk, 1);
457 WinningConditionHelper_secondteam = t + 1;
458 secondscorekeeper = sk;
463 WinningConditionHelper_equality = (TeamScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
464 if(WinningConditionHelper_equality)
465 WinningConditionHelper_winnerteam = WinningConditionHelper_secondteam = -1;
467 WinningConditionHelper_topscore = winnerscorekeeper.teamscores_primary;
468 WinningConditionHelper_secondscore = secondscorekeeper.teamscores_primary;
469 WinningConditionHelper_lowerisbetter = (teamscores_flags_primary & SFL_LOWER_IS_BETTER);
470 WinningConditionHelper_zeroisworst = (teamscores_flags_primary & SFL_ZERO_IS_WORST);
472 WinningConditionHelper_winner = NULL; // not supported in teamplay
473 WinningConditionHelper_second = NULL; // not supported in teamplay
477 WinningConditionHelper_winner = NULL;
478 WinningConditionHelper_second = NULL;
479 winnerscorekeeper = NULL;
480 secondscorekeeper = NULL;
481 FOREACH_CLIENT(IS_PLAYER(it), {
482 sk = CS(it).scorekeeper;
483 c = PlayerScore_Compare(winnerscorekeeper, sk, 1);
486 WinningConditionHelper_second = WinningConditionHelper_winner;
487 WinningConditionHelper_winner = it;
488 secondscorekeeper = winnerscorekeeper;
489 winnerscorekeeper = sk;
493 c = PlayerScore_Compare(secondscorekeeper, sk, 1);
496 WinningConditionHelper_second = it;
497 secondscorekeeper = sk;
502 WinningConditionHelper_equality = (PlayerScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0);
503 if(WinningConditionHelper_equality)
504 WinningConditionHelper_winner = WinningConditionHelper_second = NULL;
506 WinningConditionHelper_topscore = winnerscorekeeper.scores_primary;
507 WinningConditionHelper_secondscore = secondscorekeeper.scores_primary;
508 WinningConditionHelper_lowerisbetter = (scores_flags_primary & SFL_LOWER_IS_BETTER);
509 WinningConditionHelper_zeroisworst = (scores_flags_primary & SFL_ZERO_IS_WORST);
511 WinningConditionHelper_winnerteam = -1; // no teamplay
512 WinningConditionHelper_secondteam = -1; // no teamplay
515 if(WinningConditionHelper_topscore == 0)
517 if(scores_flags_primary & SFL_ZERO_IS_WORST)
519 if(WinningConditionHelper_lowerisbetter)
520 WinningConditionHelper_topscore = 999999999;
522 WinningConditionHelper_topscore = -999999999;
524 WinningConditionHelper_equality = 0;
527 if(WinningConditionHelper_secondscore == 0)
529 if(scores_flags_primary & SFL_ZERO_IS_WORST)
531 if(WinningConditionHelper_lowerisbetter)
532 WinningConditionHelper_secondscore = 999999999;
534 WinningConditionHelper_secondscore = -999999999;
538 strcpy(worldstatus, s);
540 FOREACH_CLIENT(true, {
544 s = GetPlayerScoreString(it, 1);
545 s = strcat(s, IS_REAL_CLIENT(it) ? ":human" : ":bot");
546 if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it))
547 s = strcat(s, ":spectator");
551 if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it))
552 s = GetPlayerScoreString(it, 2);
557 strcpy(it.clientstatus, s);
561 string GetScoreLogLabel(string label, float fl)
563 if(fl & SFL_LOWER_IS_BETTER)
564 label = strcat(label, "<");
565 if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
566 label = strcat(label, "!!");
567 else if((fl & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
568 label = strcat(label, "!");
572 string GetPlayerScoreString(entity pl, float shortString)
583 FOREACH(Scores, true, {
584 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
586 f = scores_flags(it);
587 l = scores_label(it);
588 out = strcat(out, GetScoreLogLabel(l, f), ",");
592 FOREACH(Scores, true, {
593 if((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
595 f = scores_flags(it);
596 l = scores_label(it);
597 out = strcat(out, GetScoreLogLabel(l, f), ",");
601 FOREACH(Scores, true, {
602 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
603 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
605 f = scores_flags(it);
606 l = scores_label(it);
607 out = strcat(out, GetScoreLogLabel(l, f), ",");
610 out = substring(out, 0, strlen(out) - 1);
612 else if((sk = CS(pl).scorekeeper))
614 FOREACH(Scores, true, {
615 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
616 out = strcat(out, ftos(sk.(scores(it))), ",");
619 FOREACH(Scores, true, {
620 if ((scores_flags(it) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
621 out = strcat(out, ftos(sk.(scores(it))), ",");
624 FOREACH(Scores, true, {
625 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
626 if((scores_flags(it) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
627 out = strcat(out, ftos(sk.(scores(it))), ",");
629 out = substring(out, 0, strlen(out) - 1);
634 string GetTeamScoreString(float tm, float shortString)
645 for(i = 0; i < MAX_TEAMSCORE; ++i)
646 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
648 f = teamscores_flags(i);
649 l = teamscores_label(i);
650 out = strcat(out, GetScoreLogLabel(l, f), ",");
653 for(i = 0; i < MAX_TEAMSCORE; ++i)
654 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
656 f = teamscores_flags(i);
657 l = teamscores_label(i);
658 out = strcat(out, GetScoreLogLabel(l, f), ",");
661 for(i = 0; i < MAX_TEAMSCORE; ++i)
662 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
663 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
665 f = teamscores_flags(i);
666 l = teamscores_label(i);
667 out = strcat(out, GetScoreLogLabel(l, f), ",");
669 out = substring(out, 0, strlen(out) - 1);
671 else if((sk = teamscorekeepers[tm - 1]))
673 for(i = 0; i < MAX_TEAMSCORE; ++i)
674 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_PRIMARY)
675 out = strcat(out, ftos(sk.(teamscores(i))), ",");
677 for(i = 0; i < MAX_TEAMSCORE; ++i)
678 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) == SFL_SORT_PRIO_SECONDARY)
679 out = strcat(out, ftos(sk.(teamscores(i))), ",");
681 for(i = 0; i < MAX_TEAMSCORE; ++i)
682 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_PRIMARY)
683 if((teamscores_flags(i) & SFL_SORT_PRIO_MASK) != SFL_SORT_PRIO_SECONDARY)
684 out = strcat(out, ftos(sk.(teamscores(i))), ",");
685 out = substring(out, 0, strlen(out) - 1);
690 float PlayerTeamScore_Compare(entity p1, entity p2, float teams, float strict)
692 if(teams && teamscores_entities_count)
694 if(p1.team != p2.team)
698 t1 = teamscorekeepers[p1.team - 1];
699 t2 = teamscorekeepers[p2.team - 1];
700 r = TeamScore_Compare(t1, t2, ((teams >= 0) ? 1 : strict));
707 return PlayerScore_Compare(CS(p1).scorekeeper, CS(p2).scorekeeper, strict);
710 entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators)
712 entity p, plist, pprev, pbest, pbestprev, pfirst, plast;
717 FOREACH_CLIENT(true, { it.(field) = 0; });
719 FOREACH_CLIENT(CS(it).scorekeeper,
722 if(it.frags == FRAGS_SPECTATOR)
728 // Now plist points to the whole list.
730 pfirst = plast = NULL;
735 pprev = pbestprev = NULL;
737 for(p = plist; (pprev = p), (p = p.chain); )
739 if(PlayerTeamScore_Compare(p, pbest, teams, strict) > 0)
746 // remove pbest out of the chain
747 if(pbestprev == NULL)
750 pbestprev.chain = pbest.chain;
754 if(!plast || PlayerTeamScore_Compare(plast, pbest, teams, 0))
769 float TeamScore_GetCompareValue(float t)
774 if(t <= 0 || t >= 16)
778 error("Reading score of invalid team!");
781 sk = teamscorekeepers[t - 1];
784 s = sk.teamscores_primary;
785 if(teamscores_flags_primary & SFL_ZERO_IS_WORST)
788 if(teamscores_flags_primary & SFL_LOWER_IS_BETTER)
793 const float NAMEWIDTH = 22;
794 const float SCORESWIDTH = 58;
795 // TODO put this somewhere in common?
796 string Score_NicePrint_ItemColor(float vflags)
798 if(vflags & SFL_SORT_PRIO_PRIMARY)
800 else if(vflags & SFL_SORT_PRIO_SECONDARY)
806 void Score_NicePrint_Team(entity to, float t, float w)
814 sk = teamscorekeepers[t - 1];
817 s = strcat(s, Team_ColoredFullName(t));
818 for(i = 0; i < MAX_TEAMSCORE; ++i)
819 if(teamscores_label(i) != "")
821 fl = teamscores_flags(i);
822 sc = sk.(teamscores(i));
823 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), ScoreString(fl, sc));
829 s = strcat(s, strpad(max(0, NAMEWIDTH - strlennocol(s)), ""));
831 FOREACH(Scores, true, {
832 if(scores_label(it) != "")
834 fl = scores_flags(it);
835 s2 = scores_label(it);
836 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, substring(s2, 0, w)));
843 void Score_NicePrint_Player(entity to, entity p, float w)
851 sk = CS(p).scorekeeper;
853 s = strcat(s, playername(p, false));
856 i = strlennocol(s) - NAMEWIDTH;
858 s = substring(s, 0, strlen(s) - i);
861 s = strcat(s, strpad(i, ""));
866 FOREACH(Scores, true, {
867 if(scores_label(it) != "")
869 fl = scores_flags(it);
870 sc = sk.(scores(it));
871 s = strcat(s, " ", Score_NicePrint_ItemColor(fl), strpad(-w, ScoreString(fl, sc)));
878 void Score_NicePrint_Spectators(entity to)
880 print_to(to, "Spectators:");
883 void Score_NicePrint_Spectator(entity to, entity p)
885 print_to(to, strcat(" ", playername(p, false)));
888 .float score_dummyfield;
889 void Score_NicePrint(entity to)
895 FOREACH(Scores, true, {
896 if(scores_label(it) != "")
899 w = bound(6, floor(SCORESWIDTH / t - 1), 9);
901 p = PlayerScore_Sort(score_dummyfield, 1, 1, 0);
904 if(!teamscores_entities_count)
905 Score_NicePrint_Team(to, t, w);
908 if(teamscores_entities_count)
910 Score_NicePrint_Team(to, p.team, w);
911 Score_NicePrint_Player(to, p, w);
917 FOREACH_CLIENT(!IS_PLAYER(it), {
919 Score_NicePrint_Spectators(to);
920 Score_NicePrint_Spectator(to, it);
925 void PlayerScore_PlayerStats(entity p)
927 entity s = CS(p).scorekeeper;
928 FOREACH(Scores, true, {
929 if(s.(scores(it)) != 0 && scores_label(it) != "")
930 PlayerStats_GameReport_Event_Player(s.owner,
931 strcat(PLAYERSTATS_SCOREBOARD, scores_label(it)), s.(scores(it)));
935 void PlayerScore_TeamStats()
939 for(t = 0; t < 16; ++t)
941 sk = teamscorekeepers[t];
944 for(i = 0; i < MAX_TEAMSCORE; ++i)
945 if(sk.(teamscores(i)) != 0 && teamscores_label(i) != "")
946 // the +1 is important here!
947 PlayerStats_GameReport_Event_Team(t+1,
948 strcat(PLAYERSTATS_SCOREBOARD, teamscores_label(i)), sk.(teamscores(i)));