self.dmg_inflictor = inflictor;
if(g_ca && self != attacker && IS_PLAYER(attacker))
- PlayerScore_Add(attacker, SP_SCORE, (damage - excess) * autocvar_g_ca_damage2score_multiplier);
+ PlayerTeamScore_Add(attacker, SP_SCORE, ST_SCORE, (damage - excess) * autocvar_g_ca_damage2score_multiplier);
float abot, vbot, awep;
abot = (IS_BOT_CLIENT(attacker));
{
Send_Notification(NOTIF_ALL, world, MSG_CENTER, APP_TEAM_NUM_4(winner_team, CENTER_ROUND_TEAM_WIN_));
Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_NUM_4(winner_team, INFO_ROUND_TEAM_WIN_));
- TeamScore_AddToTeam(winner_team, ST_SCORE, +1);
+ TeamScore_AddToTeam(winner_team, ST_CA_ROUNDS, +1);
}
else if(winner_team == -1)
{
{
start_health = cvar("g_lms_start_health");
start_armorvalue = cvar("g_lms_start_armor");
-
+
start_ammo_shells = cvar("g_lms_start_ammo_shells");
start_ammo_nails = cvar("g_lms_start_ammo_nails");
start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
return 0;
}
+// scoreboard setup
+void ca_ScoreRules()
+{
+ ScoreRules_basics(2, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
+ ScoreInfo_SetLabel_TeamScore (ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
+ ScoreRules_basics_end();
+}
+
+void ca_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+{
+ ca_ScoreRules();
+}
+
void ca_Initialize()
{
allowed_to_spawn = TRUE;
addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
addstat(STAT_YELLOWALIVE, AS_INT, yellowalive_stat);
addstat(STAT_PINKALIVE, AS_INT, pinkalive_stat);
+
+ InitializeEntity(world, ca_DelayedInit, INITPRIO_GAMETYPE);
}
MUTATOR_DEFINITION(gamemode_ca)
// should be removed in the future, as other code should not have to care
.float caplayer; // 0.5 if scheduled to join the next round
+#ifdef SVQC
+
+#define ST_CA_ROUNDS 1
+
+#endif
}
}
-void PlayerStats_AddTeam(float t) // TODO: doesn't this remain unused?
+void PlayerStats_AddTeam(float t)
{
if(playerstats_db < 0)
return;
return val;
}
-void PlayerStats_TeamScore(float t, string event_id, float value) // TODO: doesn't this remain unused?
+void PlayerStats_TeamScore(float t, string event_id, float value)
{
string key;
float val;
U: UDP port number of the server
D: duration of the match
P: player ID of an existing player; this also sets the owner for all following "n", "e" and "t" lines (lower case!)
+ Q: team number of an existing team (format: team#NN); this also sets the owner for all following "e" lines (lower case!)
n: nickname of the player (optional)
t: team ID
i: player index
void PlayerStats_ready(entity fh, entity pass, float status)
{
+ string t, tn;
string p, pn;
string e, en;
string nn, tt;
url_fputs(fh, sprintf("C %d\n", cvar_purechanges_count));
url_fputs(fh, sprintf("U %d\n", cvar("port")));
url_fputs(fh, sprintf("D %f\n", max(0, time - game_starttime)));
+ if(teamplay)
+ {
+ for(t = teamstats_last; (tn = db_get(playerstats_db, sprintf("%d", stof(t)))) != ""; t = tn)
+ {
+ url_fputs(fh, sprintf("Q team#%s\n", t));
+ for(e = events_last; (en = db_get(playerstats_db, sprintf("*:%s", e))) != ""; e = en)
+ {
+ float v;
+ v = stof(db_get(playerstats_db, sprintf("team#%d:%s", stof(t), e)));
+ if(v != 0)
+ url_fputs(fh, sprintf("e %s %g\n", e, v));
+ }
+ }
+ }
for(p = playerstats_last; (pn = db_get(playerstats_db, sprintf("%s:*", p))) != ""; p = pn)
{
url_fputs(fh, sprintf("P %s\n", p));
entity p;
PlayerScore_Sort(score_dummyfield, 0, 0, 0);
PlayerScore_Sort(scoreboard_pos, 1, 1, 1);
+ if(teamplay)
+ PlayerScore_TeamStats();
FOR_EACH_CLIENT(p)
{
// add personal score rank
teamscores_primary = teamscores[i];
teamscores_flags_primary = scoreflags;
}
+ if(label != "")
+ {
+ PlayerStats_AddEvent(strcat(PLAYERSTATS_TOTAL, label));
+ PlayerStats_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label));
+ }
}
float ScoreInfo_SendEntity(entity to, float sf)
for(i = 0; i < MAX_TEAMSCORE; ++i)
if(sk.(teamscores[i]) != 0)
if(teamscores_label[i] != "")
- PlayerStats_TeamScore(t, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label[i]), sk.(teamscores[i]));
+ // the +1 is important here!
+ PlayerStats_TeamScore(t+1, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label[i]), sk.(teamscores[i]));
}
}