diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-24 13:39:24 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-24 13:39:24 +0100 |
commit | 7b332ca6ffe44f38030c6fb70b3b6a49f5962b57 (patch) | |
tree | f90af2c0a332c1ff3b2e248efcc443c5ec2059bf | |
parent | ed137bb30b5663b12483c337843c289ecc0f2101 (diff) |
Reformatted com_remplayer()
-rw-r--r-- | FICS/adminproc.c | 77 |
1 files 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; } /* |