Some more tweaks of my own:

*Add CONS_Printf messages for !netgame checks
*Arg count is checked first regardless of netgame status for both kick and ban, < 2 is checked instead of == 1 just in case these weren't called from console for some stupid reason?
*Moved Command_Kick's buffer vars to within the code that actually does kicking stuff
This commit is contained in:
Monster Iestyn 2017-07-07 22:40:00 +01:00
parent 9a1e1180ff
commit 4752109233
1 changed files with 16 additions and 11 deletions

View File

@ -2525,15 +2525,18 @@ static void Command_Nodes(void)
static void Command_Ban(void)
{
if (!netgame) // Don't kick Tails in splitscreen!
return;
if (COM_Argc() == 1)
if (COM_Argc() < 2)
{
CONS_Printf(M_GetText("Ban <playername/playernum> <reason>: ban and kick a player\n"));
return;
}
if (!netgame) // Don't kick Tails in splitscreen!
{
CONS_Printf(M_GetText("This only works in a netgame.\n"));
return;
}
if (server || adminplayer == consoleplayer)
{
XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
@ -2588,20 +2591,22 @@ static void Command_Ban(void)
static void Command_Kick(void)
{
XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
UINT8 *p = buf;
if (!netgame) // Don't kick Tails in splitscreen!
return;
if (COM_Argc() == 1)
if (COM_Argc() < 2)
{
CONS_Printf(M_GetText("kick <playername/playernum> <reason>: kick a player\n"));
return;
}
if (!netgame) // Don't kick Tails in splitscreen!
{
CONS_Printf(M_GetText("This only works in a netgame.\n"));
return;
}
if (server || adminplayer == consoleplayer)
{
XBOXSTATIC UINT8 buf[3 + MAX_REASONLENGTH];
UINT8 *p = buf;
const SINT8 pn = nametonum(COM_Argv(1));
if (pn == -1 || pn == 0)