- updated basecommands and basefuncommands to use ProcessTargetString() and ShowActivity2()

- moved a bunch of translation phrases around
- ShowActivity2() no longer prints to console
- fixed a memory corruption bug in the translation parser

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401630
This commit is contained in:
David Anderson
2007-10-21 23:50:37 +00:00
parent 04b2845b0d
commit 53156446d4
15 changed files with 362 additions and 137 deletions
+34 -19
View File
@@ -1,16 +1,5 @@
PerformBurn(client, target, Float:seconds)
{
new String:name[32];
GetClientName(target, name, sizeof(name));
if (!IsPlayerAlive(target))
{
ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
return;
}
ShowActivity(client, "%t", "Ignited player", name);
LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
IgniteEntity(target, seconds);
}
@@ -77,7 +66,10 @@ public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
}
else
{
new String:name[32];
GetClientName(target, name, sizeof(name));
PerformBurn(param1, target, 20.0);
ShowActivity2(param1, "[SM] ", "%t", "Set target on fire", "_s", name);
}
/* Re-draw the menu if they're still valid */
@@ -99,12 +91,6 @@ public Action:Command_Burn(client, args)
decl String:arg[65];
GetCmdArg(1, arg, sizeof(arg));
new target = FindTarget(client, arg);
if (target == -1)
{
return Plugin_Handled;
}
new Float:seconds = 20.0;
if (args > 1)
@@ -118,7 +104,36 @@ public Action:Command_Burn(client, args)
}
}
PerformBurn(client, target, seconds);
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_NO_BOTS,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (new i = 0; i < target_count; i++)
{
PerformBurn(client, target_list[i], seconds);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Set target on fire", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Set target on fire", "_s", target_name);
}
return Plugin_Handled;
}
}
+39 -24
View File
@@ -1,16 +1,5 @@
PerformSlap(client, target, damage)
{
new String:name[32];
GetClientName(target, name, sizeof(name));
if (!IsPlayerAlive(target))
{
ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
return;
}
ShowActivity(client, "%t", "Slapped player", name);
LogAction(client, target, "\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
SlapPlayer(target, damage, true);
}
@@ -119,16 +108,19 @@ public MenuHandler_Slap(Handle:menu, MenuAction:action, param1, param2)
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else if (!IsPlayerAlive(target))
{
ReplyToCommand(param1, "[SM] %t", "Player has since died");
}
else
{
decl String:name[32];
GetClientName(target, name, sizeof(name));
PerformSlap(param1, target, g_SlapDamage[param1]);
ShowActivity2(param1, "[SM] ", "%t", "Slapped target", "_s", name);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplaySlapTargetMenu(param1);
}
DisplaySlapTargetMenu(param1);
}
}
@@ -143,12 +135,6 @@ public Action:Command_Slap(client, args)
decl String:arg[65];
GetCmdArg(1, arg, sizeof(arg));
new target = FindTarget(client, arg);
if (target == -1)
{
return Plugin_Handled;
}
new damage = 0;
if (args > 1)
{
@@ -160,8 +146,37 @@ public Action:Command_Slap(client, args)
return Plugin_Handled;
}
}
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_NO_BOTS,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (new i = 0; i < target_count; i++)
{
PerformSlap(client, target_list[i], damage);
}
PerformSlap(client, target, damage);
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Slapped target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Slapped target", "_s", target_name);
}
return Plugin_Handled;
}
}
+34 -19
View File
@@ -1,17 +1,6 @@
PerformSlay(client, target)
{
decl String:name[32];
GetClientName(target, name, sizeof(name));
if (!IsPlayerAlive(target))
{
ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
return;
}
ShowActivity(client, "%t", "Slayed player", name);
LogAction(client, target, "\"%L\" slayed \"%L\"", client, target);
ForcePlayerSuicide(target);
}
@@ -76,16 +65,19 @@ public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else if (!IsPlayerAlive(target))
{
ReplyToCommand(param1, "[SM] %t", "Player has since died");
}
else
{
decl String:name[32];
GetClientName(target, name, sizeof(name));
PerformSlay(param1, target);
ShowActivity2(param1, "[SM] ", "%t", "Slayed target", "_s", name);
}
/* Re-draw the menu if they're still valid */
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
{
DisplaySlayMenu(param1);
}
DisplaySlayMenu(param1);
}
}
@@ -100,13 +92,36 @@ public Action:Command_Slay(client, args)
decl String:arg[65];
GetCmdArg(1, arg, sizeof(arg));
new target = FindTarget(client, arg);
if (target == -1)
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_NO_BOTS,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
PerformSlay(client, target);
for (new i = 0; i < target_count; i++)
{
PerformSlay(client, target_list[i]);
}
if (tn_is_ml)
{
ShowActivity2(client, "[SM] ", "%t", "Slayed target", target_name);
}
else
{
ShowActivity2(client, "[SM] ", "%t", "Slayed target", "_s", target_name);
}
return Plugin_Handled;
}