From 7b332ca6ffe44f38030c6fb70b3b6a49f5962b57 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 24 Dec 2023 13:39:24 +0100 Subject: Reformatted com_remplayer() --- FICS/adminproc.c | 77 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/FICS/adminproc.c b/FICS/adminproc.c index c262674..d7c5bdc 100644 --- a/FICS/adminproc.c +++ b/FICS/adminproc.c @@ -738,42 +738,51 @@ com_checkGAME(int p,param_list param) * 'zombie' files. These zombie accounts are not listed in handles or * totals. */ -PUBLIC int com_remplayer(int p, param_list param) +PUBLIC int +com_remplayer(int p, param_list param) { - char *player = param[0].val.word; - char playerlower[MAX_LOGIN_NAME]; - int p1, lookup; + char *player = param[0].val.word; + char playerlower[MAX_LOGIN_NAME]; + int p1, lookup; - ASSERT(parray[p].adminLevel >= ADMIN_ADMIN); - strcpy(playerlower, player); - stolower(playerlower); - p1 = player_new(); - lookup = player_read(p1, playerlower); - if (!lookup) { - if ((parray[p].adminLevel <= parray[p1].adminLevel) && !player_ishead(p)) { - pprintf(p, "You can't remove an admin with a level higher than or equal to yourself.\n"); - player_remove(p1); - return COM_OK; - } - } - player_remove(p1); - if (lookup) { - pprintf(p, "No player by the name %s is registered.\n", player); - return COM_OK; - } - if (player_find_bylogin(playerlower) >= 0) { - pprintf(p, "A player by that name is logged in.\n"); - return COM_OK; - } - if (!player_kill(playerlower)) { - pprintf(p, "Player %s removed.\n", player); - UpdateRank(TYPE_BLITZ, NULL, NULL, player); - UpdateRank(TYPE_STAND, NULL, NULL, player); - UpdateRank(TYPE_WILD, NULL, NULL, player); - } else { - pprintf(p, "Remplayer failed.\n"); - } - return COM_OK; + ASSERT(parray[p].adminLevel >= ADMIN_ADMIN); + + strcpy(playerlower, player); + stolower(playerlower); + p1 = player_new(); + lookup = player_read(p1, playerlower); + + if (!lookup) { + if (parray[p].adminLevel <= parray[p1].adminLevel && + !player_ishead(p)) { + pprintf(p, "You can't remove an admin with a level " + "higher than or equal to yourself.\n"); + player_remove(p1); + return COM_OK; + } + } + + player_remove(p1); + + if (lookup) { + pprintf(p, "No player by the name %s is registered.\n", player); + return COM_OK; + } + + if (player_find_bylogin(playerlower) >= 0) { + pprintf(p, "A player by that name is logged in.\n"); + return COM_OK; + } + + if (!player_kill(playerlower)) { + pprintf(p, "Player %s removed.\n", player); + UpdateRank(TYPE_BLITZ, NULL, NULL, player); + UpdateRank(TYPE_STAND, NULL, NULL, player); + UpdateRank(TYPE_WILD, NULL, NULL, player); + } else { + pprintf(p, "Remplayer failed.\n"); + } + return COM_OK; } /* -- cgit v1.2.3