From 47521092332573b4648af223e7097b3670fdad30 Mon Sep 17 00:00:00 2001 From: Monster Iestyn <iestynjealous@ntlworld.com> Date: Fri, 7 Jul 2017 22:40:00 +0100 Subject: [PATCH] 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 --- src/d_clisrv.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3fdd96522b..7c21d79fc9 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2525,12 +2525,15 @@ static void Command_Nodes(void) static void Command_Ban(void) { - if (!netgame) // Don't kick Tails in splitscreen! + if (COM_Argc() < 2) + { + CONS_Printf(M_GetText("Ban <playername/playernum> <reason>: ban and kick a player\n")); return; + } - if (COM_Argc() == 1) + if (!netgame) // Don't kick Tails in splitscreen! { - CONS_Printf(M_GetText("Ban <playername/playernum> <reason>: ban and kick a player\n")); + CONS_Printf(M_GetText("This only works in a netgame.\n")); return; } @@ -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! + if (COM_Argc() < 2) + { + CONS_Printf(M_GetText("kick <playername/playernum> <reason>: kick a player\n")); return; + } - if (COM_Argc() == 1) + if (!netgame) // Don't kick Tails in splitscreen! { - CONS_Printf(M_GetText("kick <playername/playernum> <reason>: kick a player\n")); + 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) -- GitLab