MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / BanPlayer

Function BanPlayer

netgames/dmfc/dmfcmenu.cpp:960–978  ·  view source on GitHub ↗

Server Only. Temp bans a player from the game

Source from the content-addressed store, hash-verified

958}
959// Server Only. Temp bans a player from the game
960void BanPlayer(int pnum) {
961 if (basethis->GetLocalRole() != LR_SERVER) {
962 mprintf(0, "BanPlayer Error: You're Not The Server\n");
963 return;
964 }
965 if (pnum == basethis->GetPlayerNum()) {
966 mprintf(0, "BanPlayer Error: Server can't ban themself\n");
967 DLLAddHUDMessage(DTXT_SERVERCANTBAN);
968 return;
969 }
970 if (!basethis->CheckPlayerNum(pnum)) {
971 mprintf(0, "BanPlayer Error: Pnum %d not in game\n", pnum);
972 DLLAddHUDMessage(DTXT_INVALIDPNUM, pnum);
973 return;
974 }
975 basethis->SendControlMessageToPlayer(pnum, CM_BANNED);
976 DLLMultiDisconnectPlayer(pnum);
977 basethis->BanPlayerFromGame(pnum);
978}
979// Server Only. Ends the current level
980void EndMultiLevel(int i) {
981 if (basethis->GetLocalRole() != LR_SERVER) {

Callers 2

DMFCInputCommand_BanFunction · 0.85

Calls 5

GetLocalRoleMethod · 0.80
GetPlayerNumMethod · 0.80
CheckPlayerNumMethod · 0.80
BanPlayerFromGameMethod · 0.80

Tested by

no test coverage detected