From 47521092332573b4648af223e7097b3670fdad30 Mon Sep 17 00:00:00 2001 From: Monster Iestyn 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 | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3fdd9652..7c21d79f 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -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 : 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 : 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)