MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / killTeams

Function killTeams

plugins/koth/koth.cpp:372–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372void killTeams(bz_eTeamType safeteam, std::string kothcallsign) {
373 bz_APIIntList* playerList = bz_newIntList();
374 bz_getPlayerIndexList(playerList);
375
376 for (unsigned int i = 0; i < playerList->size(); i++) {
377
378 bz_BasePlayerRecord* player = bz_getPlayerByIndex(playerList->operator[](i));
379
380 if (player) {
381
382 if (player->team != safeteam) {
383 bz_killPlayer(player->playerID, true, BZ_SERVER);
384 if (koth.soundEnabled) {
385 bz_sendPlayCustomLocalSound(player->playerID, "flag_lost");
386 }
387 }
388 else if (koth.soundEnabled) {
389 bz_sendPlayCustomLocalSound(player->playerID, "flag_won");
390 }
391 }
392
393 bz_freePlayerRecord(player);
394 }
395 bz_deleteIntList(playerList);
396
397 bz_sendTextMessagef(BZ_SERVER, BZ_ALLUSERS, "%s (%s) IS KING OF THE HILL!", getTeamColor(safeteam), kothcallsign.c_str());
398
399 return;
400}
401
402void killPlayers(int safeid, std::string kothcallsign) {
403 bz_APIIntList* playerList = bz_newIntList();

Callers 1

processMethod · 0.70

Calls 10

bz_getPlayerIndexListFunction · 0.85
bz_killPlayerFunction · 0.85
bz_freePlayerRecordFunction · 0.85
bz_deleteIntListFunction · 0.85
bz_sendTextMessagefFunction · 0.85
c_strMethod · 0.80
getTeamColorFunction · 0.70
sizeMethod · 0.45
operator[]Method · 0.45

Tested by

no test coverage detected