Added forwards to basecomm plugin (bug 5466, r=asherkin).
authorDrifter <drifter01620@gmail.com>
Mon Sep 03 20:45:11 2012 +0100 (2012-09-03)
changeset 364580c9ae186971
parent 3644 a946cd617550
child 3646 c9fecc8a9868
Added forwards to basecomm plugin (bug 5466, r=asherkin).
plugins/basecomm.sp
plugins/basecomm/forwards.sp
plugins/basecomm/gag.sp
plugins/include/basecomm.inc
     1.1 --- a/plugins/basecomm.sp	Mon Sep 03 14:46:05 2012 +0100
     1.2 +++ b/plugins/basecomm.sp	Mon Sep 03 20:45:11 2012 +0100
     1.3 @@ -60,6 +60,7 @@
     1.4  
     1.5  #include "basecomm/gag.sp"
     1.6  #include "basecomm/natives.sp"
     1.7 +#include "basecomm/forwards.sp"
     1.8  
     1.9  public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
    1.10  {
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/plugins/basecomm/forwards.sp	Mon Sep 03 20:45:11 2012 +0100
     2.3 @@ -0,0 +1,62 @@
     2.4 +/**
     2.5 + * vim: set ts=4 :
     2.6 + * =============================================================================
     2.7 + * SourceMod Basecomm
     2.8 + * Part of Basecomm plugin, menu and other functionality.
     2.9 + *
    2.10 + * SourceMod (C)2004-2011 AlliedModders LLC.  All rights reserved.
    2.11 + * =============================================================================
    2.12 + *
    2.13 + * This program is free software; you can redistribute it and/or modify it under
    2.14 + * the terms of the GNU General Public License, version 3.0, as published by the
    2.15 + * Free Software Foundation.
    2.16 + * 
    2.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
    2.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    2.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    2.20 + * details.
    2.21 + *
    2.22 + * You should have received a copy of the GNU General Public License along with
    2.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
    2.24 + *
    2.25 + * As a special exception, AlliedModders LLC gives you permission to link the
    2.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
    2.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    2.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
    2.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
    2.30 + * this exception to all derivative works.  AlliedModders LLC defines further
    2.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    2.32 + * or <http://www.sourcemod.net/license.php>.
    2.33 + *
    2.34 + * Version: $Id$
    2.35 + */
    2.36 + 
    2.37 + FireOnClientMute(client, bool:muteState)
    2.38 + {
    2.39 + 	static Handle:hForward;
    2.40 +	
    2.41 +	if(hForward == INVALID_HANDLE)
    2.42 +	{
    2.43 +		hForward = CreateGlobalForward("BaseComm_OnClientMute", ET_Ignore, Param_Cell, Param_Cell);
    2.44 +	}
    2.45 +	
    2.46 +	Call_StartForward(hForward);
    2.47 +	Call_PushCell(client);
    2.48 +	Call_PushCell(muteState);
    2.49 +	Call_Finish();
    2.50 + }
    2.51 + 
    2.52 + FireOnClientGag(client, bool:gagState)
    2.53 + {
    2.54 + 	static Handle:hForward;
    2.55 +	
    2.56 +	if(hForward == INVALID_HANDLE)
    2.57 +	{
    2.58 +		hForward = CreateGlobalForward("BaseComm_OnClientGag", ET_Ignore, Param_Cell, Param_Cell);
    2.59 +	}
    2.60 +	
    2.61 +	Call_StartForward(hForward);
    2.62 +	Call_PushCell(client);
    2.63 +	Call_PushCell(gagState);
    2.64 +	Call_Finish();
    2.65 + }
    2.66 \ No newline at end of file
     3.1 --- a/plugins/basecomm/gag.sp	Mon Sep 03 14:46:05 2012 +0100
     3.2 +++ b/plugins/basecomm/gag.sp	Mon Sep 03 20:45:11 2012 +0100
     3.3 @@ -213,7 +213,9 @@
     3.4  PerformMute(client, target, bool:silent=false)
     3.5  {
     3.6  	g_Muted[target] = true;
     3.7 -	SetClientListeningFlags(target, VOICE_MUTED);	
     3.8 +	SetClientListeningFlags(target, VOICE_MUTED);
     3.9 +	
    3.10 +	FireOnClientMute(client, true);
    3.11  	
    3.12  	if (!silent)
    3.13  	{
    3.14 @@ -237,6 +239,8 @@
    3.15  		SetClientListeningFlags(target, VOICE_NORMAL);
    3.16  	}
    3.17  	
    3.18 +	FireOnClientMute(client, false);
    3.19 +	
    3.20  	if (!silent)
    3.21  	{
    3.22  		LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
    3.23 @@ -246,6 +250,7 @@
    3.24  PerformGag(client, target, bool:silent=false)
    3.25  {
    3.26  	g_Gagged[target] = true;
    3.27 +	FireOnClientGag(client, true);
    3.28  	
    3.29  	if (!silent)
    3.30  	{
    3.31 @@ -256,6 +261,7 @@
    3.32  PerformUnGag(client, target, bool:silent=false)
    3.33  {
    3.34  	g_Gagged[target] = false;
    3.35 +	FireOnClientGag(client, false);
    3.36  	
    3.37  	if (!silent)
    3.38  	{
    3.39 @@ -268,12 +274,14 @@
    3.40  	if (!g_Gagged[target])
    3.41  	{
    3.42  		g_Gagged[target] = true;
    3.43 +		FireOnClientGag(client, true);
    3.44  	}
    3.45  	
    3.46  	if (!g_Muted[target])
    3.47  	{
    3.48  		g_Muted[target] = true;
    3.49  		SetClientListeningFlags(target, VOICE_MUTED);
    3.50 +		FireOnClientMute(client, true);
    3.51  	}
    3.52  	
    3.53  	LogAction(client, target, "\"%L\" silenced \"%L\"", client, target);
    3.54 @@ -284,6 +292,7 @@
    3.55  	if (g_Gagged[target])
    3.56  	{
    3.57  		g_Gagged[target] = false;
    3.58 +		FireOnClientGag(client, false);
    3.59  	}
    3.60  	
    3.61  	if (g_Muted[target])
    3.62 @@ -301,7 +310,8 @@
    3.63  		else
    3.64  		{
    3.65  			SetClientListeningFlags(target, VOICE_NORMAL);
    3.66 -		}	
    3.67 +		}
    3.68 +		FireOnClientMute(client, false);
    3.69  	}
    3.70  	
    3.71  	LogAction(client, target, "\"%L\" unsilenced \"%L\"", client, target);
     4.1 --- a/plugins/include/basecomm.inc	Mon Sep 03 14:46:05 2012 +0100
     4.2 +++ b/plugins/include/basecomm.inc	Mon Sep 03 20:45:11 2012 +0100
     4.3 @@ -36,6 +36,22 @@
     4.4  #define _basecomm_included
     4.5  
     4.6  /**
     4.7 + * Called when a client is muted or unmuted
     4.8 + * 
     4.9 + * @param	client		Client index
    4.10 + * @param	muteState	True if client was muted, false otherwise
    4.11 + */
    4.12 + forward BaseComm_OnClientMute(client, bool:muteState);
    4.13 + 
    4.14 + /**
    4.15 + * Called when a client is gagged or ungagged
    4.16 + * 
    4.17 + * @param	client		Client index
    4.18 + * @param	gagState	True if client was gaged, false otherwise
    4.19 + */
    4.20 + forward BaseComm_OnClientGag(client, bool:gagState);
    4.21 + 
    4.22 +/**
    4.23   * Returns whether or not a client is gagged
    4.24   *
    4.25   * @param client		Client index.