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

Function killPlayers

plugins/keepaway/keepaway.cpp:561–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559}
560
561void killPlayers(int safeid, std::string keepawaycallsign) {
562 bz_APIIntList* playerList = bz_newIntList();
563 bz_getPlayerIndexList(playerList);
564
565 for (unsigned int i = 0; i < playerList->size(); i++) {
566
567 bz_BasePlayerRecord* player = bz_getPlayerByIndex(playerList->operator[](i));
568
569 if (player) {
570
571 if (player->playerID != safeid) {
572 bz_killPlayer(player->playerID, true, keepaway.id);
573 if (keepaway.soundEnabled) {
574 bz_sendPlayCustomLocalSound(player->playerID, "flag_lost");
575 }
576 }
577 else if (keepaway.soundEnabled) {
578 bz_sendPlayCustomLocalSound(player->playerID, "flag_won");
579 }
580 }
581
582 bz_freePlayerRecord(player);
583 }
584
585 bz_deleteIntList(playerList);
586
587 bz_sendTextMessagef(BZ_SERVER, BZ_ALLUSERS, "%s Kept the Flag Away!", keepawaycallsign.c_str());
588
589 if (keepaway.flagResetEnabled) {
590 bz_resetFlags(true);
591 }
592
593 return;
594}
595
596void sendWarnings(const char* teamcolor, std::string playercallsign, double keepawaystartedtime) {
597 double TimeElapsed = bz_getCurrentTime() - keepawaystartedtime;

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
bz_resetFlagsFunction · 0.85
c_strMethod · 0.80
sizeMethod · 0.45
operator[]Method · 0.45

Tested by

no test coverage detected