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

Function killPlayers

plugins/koth/koth.cpp:402–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400}
401
402void killPlayers(int safeid, std::string kothcallsign) {
403 bz_APIIntList* playerList = bz_newIntList();
404 bz_getPlayerIndexList(playerList);
405
406 for (unsigned int i = 0; i < playerList->size(); i++) {
407
408 bz_BasePlayerRecord* player = bz_getPlayerByIndex(playerList->operator[](i));
409
410 if (player) {
411
412 if (player->playerID != safeid) {
413 bz_killPlayer(player->playerID, true, koth.id);
414 if (koth.soundEnabled) {
415 bz_sendPlayCustomLocalSound(player->playerID, "flag_lost");
416 }
417 }
418 else if (koth.soundEnabled) {
419 bz_sendPlayCustomLocalSound(player->playerID, "flag_won");
420 }
421 }
422
423 bz_freePlayerRecord(player);
424 }
425
426 bz_deleteIntList(playerList);
427
428 bz_sendTextMessagef(BZ_SERVER, BZ_ALLUSERS, "%s IS KING OF THE HILL!", kothcallsign.c_str());
429
430 return;
431}
432
433void sendWarnings(const char* teamcolor, std::string playercallsign, double kothstartedtime) {
434 double TimeElapsed = bz_getCurrentTime() - kothstartedtime;

Callers 1

processMethod · 0.70

Calls 9

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

Tested by

no test coverage detected