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

Function bz_killPlayer

src/bzfs/bzfsAPI.cpp:2775–2802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2773//-------------------------------------------------------------------------
2774
2775BZF_API bool bz_killPlayer(int playerID, bool spawnOnBase, int killerID, const char* flagType) {
2776 GameKeeper::Player* player = GameKeeper::Player::getPlayerByIndex(playerID);
2777 if (!player) {
2778 return false;
2779 }
2780
2781 if (!player->player.isAlive()) {
2782 return false;
2783 }
2784
2785 if (killerID == -1) {
2786 killerID = ServerPlayer;
2787 }
2788
2789 FlagType* flag = NULL;
2790 if (flagType) {
2791 FlagTypeMap& flagMap = FlagType::getFlagMap();
2792 if (flagMap.find(std::string(flagType)) == flagMap.end()) {
2793 return false;
2794 }
2795
2796 flag = flagMap.find(std::string(flagType))->second;
2797 }
2798
2799 playerKilled(playerID, killerID, GotKilledMsg, -1, flag ? flag : Flags::Null, -1, spawnOnBase);
2800
2801 return true;
2802}
2803
2804//-------------------------------------------------------------------------
2805

Callers 12

KillPlayerFunction · 0.85
Player_killFunction · 0.85
KillTeamFunction · 0.85
killall.cppFile · 0.85
processMethod · 0.85
killTeamsFunction · 0.85
killPlayersFunction · 0.85
killAllHuntersFunction · 0.85
processMethod · 0.85
killTeamsFunction · 0.85
killPlayersFunction · 0.85
processMethod · 0.85

Calls 5

playerKilledFunction · 0.85
getPlayerByIndexFunction · 0.50
isAliveMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected