1.1 --- a/configs/admin_overrides.cfg Mon Oct 22 06:01:07 2007 +0000
1.2 +++ b/configs/admin_overrides.cfg Mon Oct 22 06:23:58 2007 +0000
1.3 @@ -5,13 +5,17 @@
1.4 * 1)Command Name (for example, "csdm_enable")
1.5 * 2)Command Group Name (for example, "CSDM")
1.6 * 3)Command Level (for example, "changemap")
1.7 + *
1.8 * You can override the default flags assigned to individual commands or command groups in this way.
1.9 * To override a group, use the "@" character before the name. Example:
1.10 * Examples:
1.11 * "@CSDM" "b" // Override the CSDM group to 'b' flag
1.12 * "csdm_enable" "bgi" // Override the csdm_enable command to 'bgi' flags
1.13 + *
1.14 * Note that for overrides, order is important. In the above example, csdm_enable overwrites
1.15 * any setting that csdm_enable previously had.
1.16 + *
1.17 + * You can make a command completely public by using an empty flag string.
1.18 */
1.19 }
1.20
2.1 --- a/plugins/basecommands/who.sp Mon Oct 22 06:01:07 2007 +0000
2.2 +++ b/plugins/basecommands/who.sp Mon Oct 22 06:23:58 2007 +0000
2.3 @@ -1,5 +1,5 @@
2.4
2.5 -PerformWho(client, target, ReplySource:reply)
2.6 +PerformWho(client, target, ReplySource:reply, bool:is_admin)
2.7 {
2.8 decl String:name[MAX_NAME_LENGTH];
2.9 GetClientName(target, name, sizeof(name));
2.10 @@ -20,28 +20,35 @@
2.11 }
2.12 else
2.13 {
2.14 - new flags = GetUserFlagBits(target);
2.15 - decl String:flagstring[255];
2.16 - if (flags == 0)
2.17 + if (!is_admin)
2.18 {
2.19 - strcopy(flagstring, sizeof(flagstring), "none");
2.20 - }
2.21 - else if (flags & ADMFLAG_ROOT)
2.22 - {
2.23 - strcopy(flagstring, sizeof(flagstring), "root");
2.24 + ReplyToCommand(client, "[SM] %t", "Player is an admin", name);
2.25 }
2.26 else
2.27 {
2.28 - FlagsToString(flagstring, sizeof(flagstring), flags);
2.29 - }
2.30 -
2.31 - if (show_name)
2.32 - {
2.33 - ReplyToCommand(client, "[SM] %t", "Admin logged in as", name, admin_name, flagstring);
2.34 - }
2.35 - else
2.36 - {
2.37 - ReplyToCommand(client, "[SM] %t", "Admin logged in anon", name, flagstring);
2.38 + new flags = GetUserFlagBits(target);
2.39 + decl String:flagstring[255];
2.40 + if (flags == 0)
2.41 + {
2.42 + strcopy(flagstring, sizeof(flagstring), "none");
2.43 + }
2.44 + else if (flags & ADMFLAG_ROOT)
2.45 + {
2.46 + strcopy(flagstring, sizeof(flagstring), "root");
2.47 + }
2.48 + else
2.49 + {
2.50 + FlagsToString(flagstring, sizeof(flagstring), flags);
2.51 + }
2.52 +
2.53 + if (show_name)
2.54 + {
2.55 + ReplyToCommand(client, "[SM] %t", "Admin logged in as", name, admin_name, flagstring);
2.56 + }
2.57 + else
2.58 + {
2.59 + ReplyToCommand(client, "[SM] %t", "Admin logged in anon", name, flagstring);
2.60 + }
2.61 }
2.62 }
2.63
2.64 @@ -110,7 +117,7 @@
2.65 }
2.66 else
2.67 {
2.68 - PerformWho(param1, target, SM_REPLY_TO_CHAT);
2.69 + PerformWho(param1, target, SM_REPLY_TO_CHAT, (GetUserFlagBits(param1) != 0 ? true : false));
2.70 }
2.71
2.72 /* Re-draw the menu if they're still valid */
2.73 @@ -125,15 +132,29 @@
2.74 }
2.75 public Action:Command_Who(client, args)
2.76 {
2.77 + new bool:is_admin = false;
2.78 +
2.79 + if (client && GetUserFlagBits(client) != 0)
2.80 + {
2.81 + is_admin = true;
2.82 + }
2.83 +
2.84 if (args < 1)
2.85 {
2.86 /* Display header */
2.87 decl String:t_access[16], String:t_name[16], String:t_username[16];
2.88 - Format(t_access, sizeof(t_access), "%t", "Access", client);
2.89 + Format(t_access, sizeof(t_access), "%t", "Admin access", client);
2.90 Format(t_name, sizeof(t_name), "%t", "Name", client);
2.91 Format(t_username, sizeof(t_username), "%t", "Username", client);
2.92
2.93 - PrintToConsole(client, " %-24.23s %-18.17s %s", t_name, t_username, t_access);
2.94 + if (is_admin)
2.95 + {
2.96 + PrintToConsole(client, " %-24.23s %-18.17s %s", t_name, t_username, t_access);
2.97 + }
2.98 + else
2.99 + {
2.100 + PrintToConsole(client, " %-24.23s %s", t_name, t_access);
2.101 + }
2.102
2.103 /* List all players */
2.104 new maxClients = GetMaxClients();
2.105 @@ -169,7 +190,21 @@
2.106 GetAdminUsername(id, username, sizeof(username));
2.107 }
2.108
2.109 - PrintToConsole(client, "%2d. %-24.23s %-18.17s %s", i, name, username, flagstring);
2.110 + if (is_admin)
2.111 + {
2.112 + PrintToConsole(client, "%2d. %-24.23s %-18.17s %s", i, name, username, flagstring);
2.113 + }
2.114 + else
2.115 + {
2.116 + if (flags == 0)
2.117 + {
2.118 + PrintToConsole(client, "%2d. %-24.23s %t", i, name, "No");
2.119 + }
2.120 + else
2.121 + {
2.122 + PrintToConsole(client, "%2d. %-24.23s %t", i, name, "Yes");
2.123 + }
2.124 + }
2.125 }
2.126
2.127 if (GetCmdReplySource() == SM_REPLY_TO_CHAT)
2.128 @@ -183,13 +218,13 @@
2.129 decl String:arg[65];
2.130 GetCmdArg(1, arg, sizeof(arg));
2.131
2.132 - new target = FindTarget(client, arg);
2.133 + new target = FindTarget(client, arg, false, false);
2.134 if (target == -1)
2.135 {
2.136 return Plugin_Handled;
2.137 }
2.138
2.139 - PerformWho(client, target, GetCmdReplySource());
2.140 + PerformWho(client, target, GetCmdReplySource(), is_admin);
2.141
2.142 return Plugin_Handled;
2.143 }
3.1 --- a/translations/plugin.basecommands.txt Mon Oct 22 06:01:07 2007 +0000
3.2 +++ b/translations/plugin.basecommands.txt Mon Oct 22 06:23:58 2007 +0000
3.3 @@ -105,7 +105,13 @@
3.4 "Player is not an admin"
3.5 {
3.6 "#format" "{1:s}"
3.7 - "en" "\"{1}\" is not logged in as an admin."
3.8 + "en" "\"{1}\" is not an admin."
3.9 + }
3.10 +
3.11 + "Player is an admin"
3.12 + {
3.13 + "#format" "{1:s}"
3.14 + "en" "\"{1}\" is an admin."
3.15 }
3.16
3.17 "Username"
3.18 @@ -118,4 +124,9 @@
3.19 "#format" "{1:t}"
3.20 "en" "Kicked {1}."
3.21 }
3.22 +
3.23 + "Admin access"
3.24 + {
3.25 + "en" "Admin access"
3.26 + }
3.27 }