skamonkey@3340: /**
skamonkey@3340: * vim: set ts=4 :
skamonkey@3340: * =============================================================================
skamonkey@3340: * SourceMod Basecomm
skamonkey@3340: * Part of Basecomm plugin, menu and other functionality.
skamonkey@3340: *
skamonkey@3340: * SourceMod (C)2004-2011 AlliedModders LLC. All rights reserved.
skamonkey@3340: * =============================================================================
skamonkey@3340: *
skamonkey@3340: * This program is free software; you can redistribute it and/or modify it under
skamonkey@3340: * the terms of the GNU General Public License, version 3.0, as published by the
skamonkey@3340: * Free Software Foundation.
skamonkey@3340: *
skamonkey@3340: * This program is distributed in the hope that it will be useful, but WITHOUT
skamonkey@3340: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
skamonkey@3340: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
skamonkey@3340: * details.
skamonkey@3340: *
skamonkey@3340: * You should have received a copy of the GNU General Public License along with
skamonkey@3340: * this program. If not, see .
skamonkey@3340: *
skamonkey@3340: * As a special exception, AlliedModders LLC gives you permission to link the
skamonkey@3340: * code of this program (as well as its derivative works) to "Half-Life 2," the
skamonkey@3340: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
skamonkey@3340: * by the Valve Corporation. You must obey the GNU General Public License in
skamonkey@3340: * all respects for all other code used. Additionally, AlliedModders LLC grants
skamonkey@3340: * this exception to all derivative works. AlliedModders LLC defines further
skamonkey@3340: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
skamonkey@3340: * or .
skamonkey@3340: *
skamonkey@3340: * Version: $Id$
skamonkey@3340: */
skamonkey@3340:
skamonkey@3340: public Native_IsClientGagged(Handle:hPlugin, numParams)
skamonkey@3340: {
skamonkey@3340: new client = GetNativeCell(1);
skamonkey@3340: if (client < 1 || client > MaxClients)
skamonkey@3340: {
skamonkey@3340: return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client);
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: if (!IsClientInGame(client))
skamonkey@3340: {
skamonkey@3340: return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client);
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: return g_Gagged[client];
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: public Native_IsClientMuted(Handle:hPlugin, numParams)
skamonkey@3340: {
skamonkey@3340: new client = GetNativeCell(1);
skamonkey@3340: if (client < 1 || client > MaxClients)
skamonkey@3340: {
skamonkey@3340: return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client);
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: if (!IsClientInGame(client))
skamonkey@3340: {
skamonkey@3340: return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client);
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: return g_Muted[client];
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: public Native_SetClientGag(Handle:hPlugin, numParams)
skamonkey@3340: {
skamonkey@3340: new client = GetNativeCell(1);
skamonkey@3340: if (client < 1 || client > MaxClients)
skamonkey@3340: {
skamonkey@3340: return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client);
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: if (!IsClientInGame(client))
skamonkey@3340: {
skamonkey@3340: return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client);
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: new bool:gagState = GetNativeCell(2);
skamonkey@3340:
skamonkey@3340: if (gagState)
skamonkey@3340: {
skamonkey@3340: if (g_Gagged[client])
skamonkey@3340: {
skamonkey@3340: return false;
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: PerformGag(-1, client, true);
skamonkey@3340: }
skamonkey@3340: else
skamonkey@3340: {
skamonkey@3340: if (!g_Gagged[client])
skamonkey@3340: {
skamonkey@3340: return false;
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: PerformUnGag(-1, client, true);
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: return true;
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: public Native_SetClientMute(Handle:hPlugin, numParams)
skamonkey@3340: {
skamonkey@3340: new client = GetNativeCell(1);
skamonkey@3340: if (client < 1 || client > MaxClients)
skamonkey@3340: {
skamonkey@3340: return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client);
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: if (!IsClientInGame(client))
skamonkey@3340: {
skamonkey@3340: return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client);
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: new bool:muteState = GetNativeCell(2);
skamonkey@3340:
skamonkey@3340: if (muteState)
skamonkey@3340: {
skamonkey@3340: if (g_Muted[client])
skamonkey@3340: {
skamonkey@3340: return false;
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: PerformMute(-1, client, true);
skamonkey@3340: }
skamonkey@3340: else
skamonkey@3340: {
skamonkey@3340: if (!g_Muted[client])
skamonkey@3340: {
skamonkey@3340: return false;
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: PerformUnMute(-1, client, true);
skamonkey@3340: }
skamonkey@3340:
skamonkey@3340: return true;
skamonkey@3340: }