diff --git a/plugins/basecomm.sp b/plugins/basecomm.sp
index 8497d615..5e43d7c8 100644
--- a/plugins/basecomm.sp
+++ b/plugins/basecomm.sp
@@ -60,6 +60,7 @@ new g_GagTarget[MAXPLAYERS+1];
#include "basecomm/gag.sp"
#include "basecomm/natives.sp"
+#include "basecomm/forwards.sp"
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
{
diff --git a/plugins/basecomm/forwards.sp b/plugins/basecomm/forwards.sp
new file mode 100644
index 00000000..3df76416
--- /dev/null
+++ b/plugins/basecomm/forwards.sp
@@ -0,0 +1,62 @@
+/**
+ * vim: set ts=4 :
+ * =============================================================================
+ * SourceMod Basecomm
+ * Part of Basecomm plugin, menu and other functionality.
+ *
+ * SourceMod (C)2004-2011 AlliedModders LLC. All rights reserved.
+ * =============================================================================
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 3.0, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ *
+ * As a special exception, AlliedModders LLC gives you permission to link the
+ * code of this program (as well as its derivative works) to "Half-Life 2," the
+ * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
+ * by the Valve Corporation. You must obey the GNU General Public License in
+ * all respects for all other code used. Additionally, AlliedModders LLC grants
+ * this exception to all derivative works. AlliedModders LLC defines further
+ * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
+ * or .
+ *
+ * Version: $Id$
+ */
+
+ FireOnClientMute(client, bool:muteState)
+ {
+ static Handle:hForward;
+
+ if(hForward == INVALID_HANDLE)
+ {
+ hForward = CreateGlobalForward("BaseComm_OnClientMute", ET_Ignore, Param_Cell, Param_Cell);
+ }
+
+ Call_StartForward(hForward);
+ Call_PushCell(client);
+ Call_PushCell(muteState);
+ Call_Finish();
+ }
+
+ FireOnClientGag(client, bool:gagState)
+ {
+ static Handle:hForward;
+
+ if(hForward == INVALID_HANDLE)
+ {
+ hForward = CreateGlobalForward("BaseComm_OnClientGag", ET_Ignore, Param_Cell, Param_Cell);
+ }
+
+ Call_StartForward(hForward);
+ Call_PushCell(client);
+ Call_PushCell(gagState);
+ Call_Finish();
+ }
\ No newline at end of file
diff --git a/plugins/basecomm/gag.sp b/plugins/basecomm/gag.sp
index 5f36ba51..b319438e 100644
--- a/plugins/basecomm/gag.sp
+++ b/plugins/basecomm/gag.sp
@@ -213,7 +213,9 @@ public MenuHandler_GagTypes(Handle:menu, MenuAction:action, param1, param2)
PerformMute(client, target, bool:silent=false)
{
g_Muted[target] = true;
- SetClientListeningFlags(target, VOICE_MUTED);
+ SetClientListeningFlags(target, VOICE_MUTED);
+
+ FireOnClientMute(client, true);
if (!silent)
{
@@ -237,6 +239,8 @@ PerformUnMute(client, target, bool:silent=false)
SetClientListeningFlags(target, VOICE_NORMAL);
}
+ FireOnClientMute(client, false);
+
if (!silent)
{
LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
@@ -246,6 +250,7 @@ PerformUnMute(client, target, bool:silent=false)
PerformGag(client, target, bool:silent=false)
{
g_Gagged[target] = true;
+ FireOnClientGag(client, true);
if (!silent)
{
@@ -256,6 +261,7 @@ PerformGag(client, target, bool:silent=false)
PerformUnGag(client, target, bool:silent=false)
{
g_Gagged[target] = false;
+ FireOnClientGag(client, false);
if (!silent)
{
@@ -268,12 +274,14 @@ PerformSilence(client, target)
if (!g_Gagged[target])
{
g_Gagged[target] = true;
+ FireOnClientGag(client, true);
}
if (!g_Muted[target])
{
g_Muted[target] = true;
SetClientListeningFlags(target, VOICE_MUTED);
+ FireOnClientMute(client, true);
}
LogAction(client, target, "\"%L\" silenced \"%L\"", client, target);
@@ -284,6 +292,7 @@ PerformUnSilence(client, target)
if (g_Gagged[target])
{
g_Gagged[target] = false;
+ FireOnClientGag(client, false);
}
if (g_Muted[target])
@@ -301,7 +310,8 @@ PerformUnSilence(client, target)
else
{
SetClientListeningFlags(target, VOICE_NORMAL);
- }
+ }
+ FireOnClientMute(client, false);
}
LogAction(client, target, "\"%L\" unsilenced \"%L\"", client, target);
diff --git a/plugins/include/basecomm.inc b/plugins/include/basecomm.inc
index 785a13e9..4f9c6bb1 100644
--- a/plugins/include/basecomm.inc
+++ b/plugins/include/basecomm.inc
@@ -35,6 +35,22 @@
#endif
#define _basecomm_included
+/**
+ * Called when a client is muted or unmuted
+ *
+ * @param client Client index
+ * @param muteState True if client was muted, false otherwise
+ */
+ forward BaseComm_OnClientMute(client, bool:muteState);
+
+ /**
+ * Called when a client is gagged or ungagged
+ *
+ * @param client Client index
+ * @param gagState True if client was gaged, false otherwise
+ */
+ forward BaseComm_OnClientGag(client, bool:gagState);
+
/**
* Returns whether or not a client is gagged
*