- improved comments on ShowActivity() natives

- switched to ShowActivity2() in basecommands
- added lifestates offsets to core gamedata file
- added a few translation phrases that were missing
- added new API calls to IPlayerHelpers for extending target processing

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401629
This commit is contained in:
David Anderson
2007-10-21 20:35:15 +00:00
parent f5370eb171
commit 04b2845b0d
10 changed files with 194 additions and 37 deletions
+4 -2
View File
@@ -300,8 +300,10 @@ public Action:Command_Cvar(client, args)
if ((GetConVarFlags(hndl) & FCVAR_PROTECTED) != FCVAR_PROTECTED)
{
ShowActivity(client, "%t", "Cvar changed", cvarname, value);
} else {
ShowActivity2(client, "[SM] ", "%t", "Cvar changed", cvarname, value);
}
else
{
ReplyToCommand(client, "[SM] %t", "Cvar changed", cvarname, value);
}
+1 -1
View File
@@ -7,7 +7,7 @@ PerformCancelVote(client)
return;
}
ShowActivity(client, "%t", "Cancelled Vote");
ShowActivity2(client, "[SM] ", "%t", "Cancelled Vote");
CancelVote();
}
+1 -1
View File
@@ -8,7 +8,7 @@ PerformExec(client, String:path[])
return;
}
ShowActivity(client, "%t", "Executed config", path[4]);
ShowActivity2(client, "[SM] ", "%t", "Executed config", path[4]);
LogAction(client, -1, "\"%L\" executed config (file \"%s\")", client, path[4]);
+47 -13
View File
@@ -1,11 +1,6 @@
PerformKick(client, target, const String:reason[])
{
decl String:name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
ShowActivity(client, "%t", "Kicked player", name);
LogAction(client, target, "\"%L\" kicked \"%L\" (reason \"%s\")", client, target, reason);
if (reason[0] == '\0')
@@ -80,6 +75,9 @@ public MenuHandler_Kick(Handle:menu, MenuAction:action, param1, param2)
}
else
{
decl String:name[MAX_NAME_LENGTH];
GetClientName(target, name, sizeof(name));
ShowActivity2(param1, "[SM] ", "%t", "Kicked target", "_S", name);
PerformKick(param1, target, "");
}
@@ -104,13 +102,7 @@ public Action:Command_Kick(client, args)
decl String:arg[65];
new len = BreakString(Arguments, arg, sizeof(arg));
new target = FindTarget(client, arg);
if (target == -1)
{
return Plugin_Handled;
}
if (len == -1)
{
/* Safely null terminate */
@@ -118,7 +110,49 @@ public Action:Command_Kick(client, args)
Arguments[0] = '\0';
}
PerformKick(client, target, Arguments[len]);
decl String:target_name[MAX_TARGET_LENGTH];
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
if ((target_count = ProcessTargetString(
arg,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_CONNECTED,
target_name,
sizeof(target_name),
tn_is_ml)) > 0)
{
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Kicked target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Kicked target", "_S", target_name);
}
new kick_self = 0;
for (new i = 0; i < target_count; i++)
{
/* Kick everyone else first */
if (target_list[i] == client)
{
kick_self = client;
}
PerformKick(client, target_list[i], Arguments[len]);
}
if (kick_self)
{
PerformKick(client, client, Arguments[len]);
}
}
else
{
ReplyToTargetError(client, target_count);
}
return Plugin_Handled;
}
+2 -2
View File
@@ -14,7 +14,7 @@ public MenuHandler_ChangeMap(Handle:menu, MenuAction:action, param1, param2)
GetMenuItem(menu, param2, map, sizeof(map));
ShowActivity(param1, "%t", "Changing map", map);
ShowActivity2(param1, "[SM] ", "%t", "Changing map", map);
LogAction(param1, -1, "\"%L\" changed map to \"%s\"", param1, map);
@@ -59,7 +59,7 @@ public Action:Command_Map(client, args)
return Plugin_Handled;
}
ShowActivity(client, "%t", "Changing map", map);
ShowActivity2(client, "[SM] ", "%t", "Changing map", map);
LogAction(client, -1, "\"%L\" changed map to \"%s\"", client, map);
+21 -16
View File
@@ -241,10 +241,28 @@ native bool:IsChatTrigger();
/**
* Displays usage of an admin command to users depending on the
* setting of the sm_show_activity cvar.
* setting of the sm_show_activity cvar. All users receive a message
* in their chat text, except for the originating client, who receives
* the message based on the current ReplySource.
*
* If the original client did not use a console command, they will
* not see the public display in their chat.
* @param client Client index doing the action, or 0 for server.
* @param tag Tag to display before the message string. For example,
* "[SM] " would show "[SM] <message>".
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
* @error
*/
native ShowActivity2(client, const String:tag[], const String:format[], any:...);
/**
* Displays usage of an admin command to users depending on the
* setting of the sm_show_activity cvar.
*
* This version does not display a message to the originating client
* if used from chat triggers or menus. If manual replies are used
* for these cases, then this function will suffice. Otherwise,
* ShowActivity2() is slightly more useful.
*
* @param client Client index doing the action, or 0 for server.
* @param format Formatting rules.
@@ -267,19 +285,6 @@ native ShowActivity(client, const String:format[], any:...);
*/
native ShowActivityEx(client, const String:tag[], const String:format[], any:...);
/**
* Same as ShowActivityEx(), except the text will always be mirrored to the
* client's chat (and console, if the reply source specifies as such).
*
* @param client Client index doing the action, or 0 for server.
* @param tag Tag to display with.
* @param format Formatting rules.
* @param ... Variable number of format parameters.
* @noreturn
* @error
*/
native ShowActivity2(client, const String:tag[], const String:format[], any:...);
/**
* Called when a server-only command is invoked.
*