MCPcopy Create free account
hub / github.com/assaultcube/AC / teaminfo

Function teaminfo

source/src/clientgame.cpp:311–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309COMMANDN(player1, playerinfolocal, "s");
310
311void teaminfo(const char *team, const char *attr)
312{
313 if(!team || !attr || !m_teammode) return;
314 int t = teamatoi(team); // get player clientnum
315 if(!team_isactive(t))
316 {
317 conoutf("invalid team: %s", team);
318 return;
319 }
320 int t_flags = 0;
321 int t_frags = 0;
322 int t_deaths = 0;
323
324 string teammembers = "";
325
326 loopv(players) if(players[i] && players[i]->team == t)
327 {
328 t_frags += players[i]->frags;
329 t_deaths += players[i]->deaths;
330 t_flags += players[i]->flagscore;
331 concatformatstring(teammembers, "%d ", players[i]->clientnum);
332 }
333
334 loopv(discscores) if(discscores[i].team == t)
335 {
336 t_frags += discscores[i].frags;
337 t_deaths += discscores[i].deaths;
338 t_flags += discscores[i].flags;
339 }
340
341 if(player1->team == t)
342 {
343 t_frags += player1->frags;
344 t_deaths += player1->deaths;
345 t_flags += player1->flagscore;
346 concatformatstring(teammembers, "%d ", player1->clientnum);
347 }
348
349 ATTR_INT(flags, t_flags);
350 ATTR_INT(frags, t_frags);
351 ATTR_INT(deaths, t_deaths);
352 ATTR_STR(name, team_string(t));
353 ATTR_STR(players, teammembers);
354 conoutf("invalid attribute: %s", attr);
355}
356
357COMMAND(teaminfo, "ss");
358

Callers

nothing calls this directly

Calls 5

teamatoiFunction · 0.85
concatformatstringFunction · 0.85
team_stringFunction · 0.85
conoutfFunction · 0.70
loopvFunction · 0.70

Tested by

no test coverage detected