aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/adminproc.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-05-18 09:22:59 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-05-18 09:22:59 +0200
commit64bd6461a084e913f7b4f818abfbef68645a7a75 (patch)
tree299ce5a018057c37cf35744f7e33d1d8b61a65e7 /FICS/adminproc.c
parenteb254f0a7ebf40dd1234cea725d99a6a115b5eef (diff)
Reformatted com_asetadmin()
Diffstat (limited to 'FICS/adminproc.c')
-rw-r--r--FICS/adminproc.c78
1 files changed, 47 insertions, 31 deletions
diff --git a/FICS/adminproc.c b/FICS/adminproc.c
index eb30ff8..a0853ab 100644
--- a/FICS/adminproc.c
+++ b/FICS/adminproc.c
@@ -1438,40 +1438,56 @@ PUBLIC int com_asethandle(int p, param_list param)
* 2. You can only set the admin level to a level that is lower than
* yourself.
*/
-PUBLIC int com_asetadmin(int p, param_list param)
+PUBLIC int
+com_asetadmin(int p, param_list param)
{
- int p1, connected;
+ int p1, connected;
- ASSERT(parray[p].adminLevel >= ADMIN_GOD);
- if (!FindPlayer(p, param[0].val.word,&p1, &connected))
- return COM_OK;
+ ASSERT(parray[p].adminLevel >= ADMIN_GOD);
- if ((parray[p].adminLevel <= parray[p1].adminLevel) && !player_ishead(p)) {
- pprintf(p, "You can only set adminlevel for players below your adminlevel.\n");
- if (!connected)
- player_remove(p1);
- return COM_OK;
- }
- if ((parray[p1].login) == (parray[p].login)) {
- pprintf(p, "You can't change your own adminlevel.\n");
- return COM_OK;
- }
- if ((param[1].val.integer >= parray[p].adminLevel) && !player_ishead(p)) {
- pprintf(p, "You can't promote someone to or above your adminlevel.\n");
- if (!connected)
- player_remove(p1);
- return COM_OK;
- }
- //oldlevel = parray[p1].adminLevel; XXX: set but not used
- parray[p1].adminLevel = param[1].val.integer;
- pprintf(p, "Admin level of %s set to %d.\n", parray[p1].name, parray[p1].adminLevel);
- player_save(p1);
- if (connected) {
- pprintf_prompt(p1, "\n\n%s has set your admin level to %d.\n\n", parray[p].name, parray[p1].adminLevel);
- } else {
- player_remove(p1);
- }
- return COM_OK;
+ if (!FindPlayer(p, param[0].val.word,&p1, &connected))
+ return COM_OK;
+
+ if ((parray[p].adminLevel <= parray[p1].adminLevel) &&
+ !player_ishead(p)) {
+ pprintf(p, "You can only set adminlevel for players below your "
+ "adminlevel.\n");
+
+ if (!connected)
+ player_remove(p1);
+ return COM_OK;
+ }
+
+ if ((parray[p1].login) == (parray[p].login)) {
+ pprintf(p, "You can't change your own adminlevel.\n");
+ return COM_OK;
+ }
+
+ if ((param[1].val.integer >= parray[p].adminLevel) &&
+ !player_ishead(p)) {
+ pprintf(p, "You can't promote someone to or above your "
+ "adminlevel.\n");
+
+ if (!connected)
+ player_remove(p1);
+ return COM_OK;
+ }
+
+ parray[p1].adminLevel = param[1].val.integer;
+ pprintf(p, "Admin level of %s set to %d.\n",
+ parray[p1].name,
+ parray[p1].adminLevel);
+ player_save(p1);
+
+ if (connected) {
+ pprintf_prompt(p1, "\n\n%s has set your admin level to %d.\n\n",
+ parray[p].name,
+ parray[p1].adminLevel);
+ } else {
+ player_remove(p1);
+ }
+
+ return COM_OK;
}
PRIVATE void