Fix regressions in b2f7d97b1ea7 and update plugins for OnClientSayCommand changes (bug 5986, r=psychonic).

This commit is contained in:
SystematicMania
2014-02-28 10:38:36 -05:00
parent 8987a34078
commit 10f878d8c7
4 changed files with 38 additions and 73 deletions
+4 -9
View File
@@ -398,14 +398,9 @@ public Action:OnClientSayCommand(client, const String:command[], const String:sA
if(g_IsWaitingForChatReason[client])
{
g_IsWaitingForChatReason[client] = false;
decl String:message[192];
GetCmdArgString(message, sizeof(message));
StripQuotes(message);
PrepareBan(client, g_BanTarget[client], g_BanTime[client], message);
return Plugin_Handled;
PrepareBan(client, g_BanTarget[client], g_BanTime[client], sArgs);
return Plugin_Stop;
}
return Plugin_Continue;
}
}
+3 -22
View File
@@ -98,22 +98,6 @@ public OnPluginStart()
{
OnAdminMenuReady(topmenu);
}
// Normally, OnClientSayCommand would be aqequate and more appropirate here, but it does
// not catch attempted chat triggers, which we also want to be blocked if a player is gagged.
AddCommandListener(Command_Say, "say");
AddCommandListener(Command_Say, "say_team");
new String:gameDir[64];
GetGameFolderName(gameDir, sizeof(gameDir));
if (StrEqual(gameDir, "insurgency", false))
{
AddCommandListener(Command_Say, "say2");
}
else if (StrEqual(gameDir, "nucleardawn", false))
{
AddCommandListener(Command_Say, "say_squad");
}
}
public OnAdminMenuReady(Handle:topmenu)
@@ -167,14 +151,11 @@ public bool:OnClientConnect(client, String:rejectmsg[], maxlen)
return true;
}
public Action:Command_Say(client, const String:command[], argc)
public Action:OnClientSayCommand(client, const String:command[], const String:sArgs[])
{
if (client)
if (client && g_Gagged[client])
{
if (g_Gagged[client])
{
return Plugin_Stop;
}
return Plugin_Stop;
}
return Plugin_Continue;
+6 -22
View File
@@ -251,27 +251,11 @@ public Action:Command_FriendlyFire(client, args)
public OnClientSayCommand_Post(client, const String:command[], const String:sArgs[])
{
decl String:text[192];
new startidx = 0;
if (strcopy(text, sizeof(text), sArgs) < 1)
{
return;
}
if (text[0] == '"')
{
startidx = 1;
}
if ((strcmp(command, "say2", false) == 0) && strlen(sArgs) >= 4)
startidx += 4;
if (strcmp(text[startidx], "timeleft", false) == 0)
if (strcmp(sArgs, "timeleft", false) == 0)
{
ShowTimeLeft(client, TIMELEFT_ALL_MAYBE);
}
else if (strcmp(text[startidx], "thetime", false) == 0)
else if (strcmp(sArgs, "thetime", false) == 0)
{
decl String:ctime[64];
FormatTime(ctime, 64, NULL_STRING);
@@ -285,11 +269,11 @@ public OnClientSayCommand_Post(client, const String:command[], const String:sArg
PrintToChat(client,"[SM] %t", "Thetime", ctime);
}
}
else if (strcmp(text[startidx], "ff", false) == 0)
else if (strcmp(sArgs, "ff", false) == 0)
{
ShowFriendlyFire(client);
}
else if (strcmp(text[startidx], "currentmap", false) == 0)
else if (strcmp(sArgs, "currentmap", false) == 0)
{
decl String:map[64];
GetCurrentMap(map, sizeof(map));
@@ -303,7 +287,7 @@ public OnClientSayCommand_Post(client, const String:command[], const String:sArg
PrintToChat(client,"[SM] %t", "Current Map", map);
}
}
else if (strcmp(text[startidx], "nextmap", false) == 0)
else if (strcmp(sArgs, "nextmap", false) == 0)
{
decl String:map[32];
GetNextMap(map, sizeof(map));
@@ -331,7 +315,7 @@ public OnClientSayCommand_Post(client, const String:command[], const String:sArg
}
}
}
else if (strcmp(text[startidx], "motd", false) == 0)
else if (strcmp(sArgs, "motd", false) == 0)
{
ShowMOTDPanel(client, "Message Of The Day", "motd", MOTDPANEL_TYPE_INDEX);
}