1.1 --- a/gamedata/core.games.txt Sun Oct 21 20:09:28 2007 +0000
1.2 +++ b/gamedata/core.games.txt Sun Oct 21 20:35:15 2007 +0000
1.3 @@ -9,6 +9,12 @@
1.4 "windows" "13"
1.5 "linux" "14"
1.6 }
1.7 +
1.8 + "m_lifeState"
1.9 + {
1.10 + "class" "CBasePlayer"
1.11 + "prop" "m_lifeState"
1.12 + }
1.13 }
1.14 }
1.15
2.1 --- a/plugins/basecommands.sp Sun Oct 21 20:09:28 2007 +0000
2.2 +++ b/plugins/basecommands.sp Sun Oct 21 20:35:15 2007 +0000
2.3 @@ -300,8 +300,10 @@
2.4
2.5 if ((GetConVarFlags(hndl) & FCVAR_PROTECTED) != FCVAR_PROTECTED)
2.6 {
2.7 - ShowActivity(client, "%t", "Cvar changed", cvarname, value);
2.8 - } else {
2.9 + ShowActivity2(client, "[SM] ", "%t", "Cvar changed", cvarname, value);
2.10 + }
2.11 + else
2.12 + {
2.13 ReplyToCommand(client, "[SM] %t", "Cvar changed", cvarname, value);
2.14 }
2.15
3.1 --- a/plugins/basecommands/cancelvote.sp Sun Oct 21 20:09:28 2007 +0000
3.2 +++ b/plugins/basecommands/cancelvote.sp Sun Oct 21 20:35:15 2007 +0000
3.3 @@ -7,7 +7,7 @@
3.4 return;
3.5 }
3.6
3.7 - ShowActivity(client, "%t", "Cancelled Vote");
3.8 + ShowActivity2(client, "[SM] ", "%t", "Cancelled Vote");
3.9
3.10 CancelVote();
3.11 }
4.1 --- a/plugins/basecommands/execcfg.sp Sun Oct 21 20:09:28 2007 +0000
4.2 +++ b/plugins/basecommands/execcfg.sp Sun Oct 21 20:35:15 2007 +0000
4.3 @@ -8,7 +8,7 @@
4.4 return;
4.5 }
4.6
4.7 - ShowActivity(client, "%t", "Executed config", path[4]);
4.8 + ShowActivity2(client, "[SM] ", "%t", "Executed config", path[4]);
4.9
4.10 LogAction(client, -1, "\"%L\" executed config (file \"%s\")", client, path[4]);
4.11
5.1 --- a/plugins/basecommands/kick.sp Sun Oct 21 20:09:28 2007 +0000
5.2 +++ b/plugins/basecommands/kick.sp Sun Oct 21 20:35:15 2007 +0000
5.3 @@ -1,11 +1,6 @@
5.4
5.5 PerformKick(client, target, const String:reason[])
5.6 {
5.7 - decl String:name[MAX_NAME_LENGTH];
5.8 -
5.9 - GetClientName(target, name, sizeof(name));
5.10 -
5.11 - ShowActivity(client, "%t", "Kicked player", name);
5.12 LogAction(client, target, "\"%L\" kicked \"%L\" (reason \"%s\")", client, target, reason);
5.13
5.14 if (reason[0] == '\0')
5.15 @@ -80,6 +75,9 @@
5.16 }
5.17 else
5.18 {
5.19 + decl String:name[MAX_NAME_LENGTH];
5.20 + GetClientName(target, name, sizeof(name));
5.21 + ShowActivity2(param1, "[SM] ", "%t", "Kicked target", "_S", name);
5.22 PerformKick(param1, target, "");
5.23 }
5.24
5.25 @@ -104,13 +102,7 @@
5.26
5.27 decl String:arg[65];
5.28 new len = BreakString(Arguments, arg, sizeof(arg));
5.29 -
5.30 - new target = FindTarget(client, arg);
5.31 - if (target == -1)
5.32 - {
5.33 - return Plugin_Handled;
5.34 - }
5.35 -
5.36 +
5.37 if (len == -1)
5.38 {
5.39 /* Safely null terminate */
5.40 @@ -118,7 +110,49 @@
5.41 Arguments[0] = '\0';
5.42 }
5.43
5.44 - PerformKick(client, target, Arguments[len]);
5.45 + decl String:target_name[MAX_TARGET_LENGTH];
5.46 + decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
5.47 +
5.48 + if ((target_count = ProcessTargetString(
5.49 + arg,
5.50 + client,
5.51 + target_list,
5.52 + MAXPLAYERS,
5.53 + COMMAND_FILTER_CONNECTED,
5.54 + target_name,
5.55 + sizeof(target_name),
5.56 + tn_is_ml)) > 0)
5.57 + {
5.58 + if (tn_is_ml)
5.59 + {
5.60 + ShowActivity2(client, "[SM] ", "%t", "Kicked target", target_name);
5.61 + }
5.62 + else
5.63 + {
5.64 + ShowActivity2(client, "[SM] ", "%t", "Kicked target", "_S", target_name);
5.65 + }
5.66 +
5.67 + new kick_self = 0;
5.68 +
5.69 + for (new i = 0; i < target_count; i++)
5.70 + {
5.71 + /* Kick everyone else first */
5.72 + if (target_list[i] == client)
5.73 + {
5.74 + kick_self = client;
5.75 + }
5.76 + PerformKick(client, target_list[i], Arguments[len]);
5.77 + }
5.78 +
5.79 + if (kick_self)
5.80 + {
5.81 + PerformKick(client, client, Arguments[len]);
5.82 + }
5.83 + }
5.84 + else
5.85 + {
5.86 + ReplyToTargetError(client, target_count);
5.87 + }
5.88
5.89 return Plugin_Handled;
5.90 }
6.1 --- a/plugins/basecommands/map.sp Sun Oct 21 20:09:28 2007 +0000
6.2 +++ b/plugins/basecommands/map.sp Sun Oct 21 20:35:15 2007 +0000
6.3 @@ -14,7 +14,7 @@
6.4
6.5 GetMenuItem(menu, param2, map, sizeof(map));
6.6
6.7 - ShowActivity(param1, "%t", "Changing map", map);
6.8 + ShowActivity2(param1, "[SM] ", "%t", "Changing map", map);
6.9
6.10 LogAction(param1, -1, "\"%L\" changed map to \"%s\"", param1, map);
6.11
6.12 @@ -59,7 +59,7 @@
6.13 return Plugin_Handled;
6.14 }
6.15
6.16 - ShowActivity(client, "%t", "Changing map", map);
6.17 + ShowActivity2(client, "[SM] ", "%t", "Changing map", map);
6.18
6.19 LogAction(client, -1, "\"%L\" changed map to \"%s\"", client, map);
6.20
7.1 --- a/plugins/include/console.inc Sun Oct 21 20:09:28 2007 +0000
7.2 +++ b/plugins/include/console.inc Sun Oct 21 20:35:15 2007 +0000
7.3 @@ -241,10 +241,28 @@
7.4
7.5 /**
7.6 * Displays usage of an admin command to users depending on the
7.7 - * setting of the sm_show_activity cvar.
7.8 + * setting of the sm_show_activity cvar. All users receive a message
7.9 + * in their chat text, except for the originating client, who receives
7.10 + * the message based on the current ReplySource.
7.11 *
7.12 - * If the original client did not use a console command, they will
7.13 - * not see the public display in their chat.
7.14 + * @param client Client index doing the action, or 0 for server.
7.15 + * @param tag Tag to display before the message string. For example,
7.16 + * "[SM] " would show "[SM] <message>".
7.17 + * @param format Formatting rules.
7.18 + * @param ... Variable number of format parameters.
7.19 + * @noreturn
7.20 + * @error
7.21 + */
7.22 +native ShowActivity2(client, const String:tag[], const String:format[], any:...);
7.23 +
7.24 +/**
7.25 + * Displays usage of an admin command to users depending on the
7.26 + * setting of the sm_show_activity cvar.
7.27 + *
7.28 + * This version does not display a message to the originating client
7.29 + * if used from chat triggers or menus. If manual replies are used
7.30 + * for these cases, then this function will suffice. Otherwise,
7.31 + * ShowActivity2() is slightly more useful.
7.32 *
7.33 * @param client Client index doing the action, or 0 for server.
7.34 * @param format Formatting rules.
7.35 @@ -268,19 +286,6 @@
7.36 native ShowActivityEx(client, const String:tag[], const String:format[], any:...);
7.37
7.38 /**
7.39 - * Same as ShowActivityEx(), except the text will always be mirrored to the
7.40 - * client's chat (and console, if the reply source specifies as such).
7.41 - *
7.42 - * @param client Client index doing the action, or 0 for server.
7.43 - * @param tag Tag to display with.
7.44 - * @param format Formatting rules.
7.45 - * @param ... Variable number of format parameters.
7.46 - * @noreturn
7.47 - * @error
7.48 - */
7.49 -native ShowActivity2(client, const String:tag[], const String:format[], any:...);
7.50 -
7.51 -/**
7.52 * Called when a server-only command is invoked.
7.53 *
7.54 * @params args Number of arguments that were in the argument string.
8.1 --- a/public/IPlayerHelpers.h Sun Oct 21 20:09:28 2007 +0000
8.2 +++ b/public/IPlayerHelpers.h Sun Oct 21 20:35:15 2007 +0000
8.3 @@ -232,6 +232,60 @@
8.4 }
8.5 };
8.6
8.7 + #define COMMAND_FILTER_ALIVE (1<<0) /**< Only allow alive players */
8.8 + #define COMMAND_FILTER_DEAD (1<<1) /**< Only filter dead players */
8.9 + #define COMMAND_FILTER_CONNECTED (1<<2) /**< Allow players not fully in-game */
8.10 + #define COMMAND_FILTER_NO_IMMUNITY (1<<3) /**< Ignore immunity rules */
8.11 + #define COMMAND_FILTER_NO_MULTI (1<<4) /**< Do not allow multiple target patterns */
8.12 + #define COMMAND_FILTER_NO_BOTS (1<<5) /**< Do not allow bots to be targetted */
8.13 +
8.14 + #define COMMAND_TARGET_VALID 1 /**< Client passed the filter */
8.15 + #define COMMAND_TARGET_NONE 0 /**< No target was found */
8.16 + #define COMMAND_TARGET_NOT_ALIVE -1 /**< Single client is not alive */
8.17 + #define COMMAND_TARGET_NOT_DEAD -2 /**< Single client is not dead */
8.18 + #define COMMAND_TARGET_NOT_IN_GAME -3 /**< Single client is not in game */
8.19 + #define COMMAND_TARGET_IMMUNE -4 /**< Single client is immune */
8.20 + #define COMMAND_TARGET_EMPTY_FILTER -5 /**< A multi-filter (such as @all) had no targets */
8.21 + #define COMMAND_TARGET_NOT_HUMAN -6 /**< Target was not human */
8.22 + #define COMMAND_TARGET_AMBIGUOUS -7 /**< Partial name had too many targets */
8.23 +
8.24 + #define COMMAND_TARGETNAME_RAW 0 /**< Target name is a raw string */
8.25 + #define COMMAND_TARGETNAME_ML 1 /**< Target name is a multi-lingual phrase */
8.26 +
8.27 + /**
8.28 + * @brief Holds the many command target info parameters.
8.29 + */
8.30 + struct cmd_target_info_t
8.31 + {
8.32 + const char *pattern; /**< IN: Target pattern string. */
8.33 + int admin; /**< IN: Client admin index, or 0 if server .*/
8.34 + cell_t *targets; /**< IN: Array to store targets. */
8.35 + cell_t max_targets; /**< IN: Max targets (always >= 1) */
8.36 + int flags; /**< IN: COMMAND_FILTER flags. */
8.37 + char *target_name; /**< OUT: Buffer to store target name. */
8.38 + size_t target_name_maxlength; /**< IN: Maximum length of the target name buffer. */
8.39 + int target_name_style; /**< OUT: Target name style (COMMAND_TARGETNAME) */
8.40 + int reason; /**< OUT: COMMAND_TARGET reason. */
8.41 + unsigned int num_targets; /**< OUT: Number of targets. */
8.42 + };
8.43 +
8.44 + /**
8.45 + * @brief Intercepts a command target operation.
8.46 + */
8.47 + class ICommandTargetProcessor
8.48 + {
8.49 + public:
8.50 + /**
8.51 + * @brief Must process the command target and return a COMMAND_TARGET value.
8.52 + *
8.53 + * @param info Struct containing command target information.
8.54 + * Any members labelled OUT must be filled if processing
8.55 + * is to be completed (i.e. true returned).
8.56 + * @return True to end processing, false to let Core continue.
8.57 + */
8.58 + virtual bool ProcessCommandTarget(cmd_target_info_t *info) =0;
8.59 + };
8.60 +
8.61 class IPlayerManager : public SMInterface
8.62 {
8.63 public:
8.64 @@ -323,6 +377,30 @@
8.65 * @return Old reply source.
8.66 */
8.67 virtual unsigned int SetReplyTo(unsigned int reply) =0;
8.68 +
8.69 + /**
8.70 + * @brief Tests if a player meets command filtering rules.
8.71 + *
8.72 + * @param pAdmin IGamePlayer of the admin, or NULL if the server.
8.73 + * @param pTarget IGamePlayer of the player being targeted.
8.74 + * @param flags COMMAND_FILTER flags.
8.75 + * @return COMMAND_TARGET value.
8.76 + */
8.77 + virtual int FilterCommandTarget(IGamePlayer *pAdmin, IGamePlayer *pTarget, int flags) =0;
8.78 +
8.79 + /**
8.80 + * @brief Registers a command target processor.
8.81 + *
8.82 + * @param pHandler Pointer to an ICommandTargetProcessor instance.
8.83 + */
8.84 + virtual void RegisterCommandTargetProcessor(ICommandTargetProcessor *pHandler) =0;
8.85 +
8.86 + /**
8.87 + * @brief Removes a command target processor.
8.88 + *
8.89 + * @param pHandler Pointer to an ICommandTargetProcessor instance.
8.90 + */
8.91 + virtual void UnregisterCommandTargetProcessor(ICommandTargetProcessor *pHandler) =0;
8.92 };
8.93 }
8.94
9.1 --- a/translations/common.phrases.txt Sun Oct 21 20:09:28 2007 +0000
9.2 +++ b/translations/common.phrases.txt Sun Oct 21 20:35:15 2007 +0000
9.3 @@ -15,12 +15,22 @@
9.4 "en" "No matching client was found."
9.5 }
9.6
9.7 + "No matching clients"
9.8 + {
9.9 + "en" "No matching clients were found."
9.10 + }
9.11 +
9.12 "More than one client matches"
9.13 {
9.14 "#format" "{1:s}"
9.15 "en" "More than one client matches the pattern \"{1}\""
9.16 }
9.17
9.18 + "More than one client matched"
9.19 + {
9.20 + "en" "More than one client matched the given pattern."
9.21 + }
9.22 +
9.23 "Player no longer available"
9.24 {
9.25 "en" "The player you selected is no longer available."
9.26 @@ -90,6 +100,7 @@
9.27 "#format" "{1:s}"
9.28 "en" "Slapped player '{1}'"
9.29 }
9.30 +
9.31 "Slay player"
9.32 {
9.33 "en" "Slay player"
9.34 @@ -185,12 +196,12 @@
9.35 "Invalid Amount"
9.36 {
9.37 "en" "Invalid amount specified"
9.38 - }
9.39 + }
9.40
9.41 "Cannot be performed on dead"
9.42 {
9.43 "#format" "{1:s}"
9.44 - "en" "This action cannot be performed on a dead client \"{1}\""
9.45 + "en" "This action cannot be performed on dead client \"{1}\""
9.46 }
9.47
9.48 "Player has since died"
9.49 @@ -316,4 +327,19 @@
9.50 {
9.51 "en" "This command can only be used in-game."
9.52 }
9.53 +
9.54 + "Target must be dead"
9.55 + {
9.56 + "en" "This command can only be used on dead players."
9.57 + }
9.58 +
9.59 + "Target must be alive"
9.60 + {
9.61 + "en" "This command can only be used on alive players."
9.62 + }
9.63 +
9.64 + "Target is not in game"
9.65 + {
9.66 + "en" "The given player is not fully in-game yet."
9.67 + }
9.68 }
10.1 --- a/translations/plugin.basecommands.txt Sun Oct 21 20:09:28 2007 +0000
10.2 +++ b/translations/plugin.basecommands.txt Sun Oct 21 20:35:15 2007 +0000
10.3 @@ -112,4 +112,10 @@
10.4 {
10.5 "en" "Username"
10.6 }
10.7 +
10.8 + "Kicked target"
10.9 + {
10.10 + "#format" "{1:t}"
10.11 + "en" "Kicked {1}"
10.12 + }
10.13 }