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

Function DMFCInputCommand_Ban

netgames/dmfc/dmfcinputcommand.cpp:357–381  ·  view source on GitHub ↗

handles banning a player from the game Usage: "$ban " where pnum is the playernumber of the player to ban

Source from the content-addressed store, hash-verified

355// handles banning a player from the game
356// Usage: "$ban <int pnum>" where pnum is the playernumber of the player to ban
357void DMFCInputCommand_Ban(const char *input_string) {
358 if (basethis->GetLocalRole() != LR_SERVER)
359 return;
360 int p;
361 char temp[20];
362
363 // parse "$ban"
364 if (!StringParseWord(input_string, temp, 20, &input_string)) {
365 basethis->DisplayInputCommandHelp(DTXT_IC_BAN);
366 return;
367 }
368
369 // parse pnum
370 if (!StringParseNumber(input_string, &p, &input_string)) {
371 basethis->DisplayInputCommandHelp(DTXT_IC_BAN);
372 return;
373 }
374
375 if (!basethis->CheckPlayerNum(p))
376 return;
377
378 BanPlayer(p);
379 if (p != *basethis->Player_num)
380 DLLAddHUDMessage(DTXT_BANMSG, basethis->Players[p].callsign);
381}
382
383// handles ending the level
384// Usage: "$endlevel"

Callers

nothing calls this directly

Calls 6

StringParseWordFunction · 0.85
StringParseNumberFunction · 0.85
BanPlayerFunction · 0.85
GetLocalRoleMethod · 0.80
CheckPlayerNumMethod · 0.80

Tested by

no test coverage detected