bool CVoiceGameMgr::ClientCommand(CBasePlayer *pPlayer, const char *cmd)
{
	int playerClientIndex = pPlayer->entindex() - 1;
	if(playerClientIndex < 0 || playerClientIndex >= m_nMaxPlayers)
	{
		VoiceServerDebug( "CVoiceGameMgr::ClientCommand: cmd %s from invalid client (%d)\n", cmd, playerClientIndex );
		return true;
	}

	bool bBan = stricmp(cmd, "vban") == 0;
	if(bBan && CMD_ARGC() >= 2)
	{
		for(int i=1; i < CMD_ARGC(); i++)
		{
			unsigned long mask = 0;
			sscanf(CMD_ARGV(i), "%x", &mask);

			if(i <= VOICE_MAX_PLAYERS_DW)
			{
				VoiceServerDebug( "CVoiceGameMgr::ClientCommand: vban (0x%x) from %d\n", mask, playerClientIndex );
				g_BanMasks[playerClientIndex].SetDWord(i-1, mask);
			}
			else
			{
				VoiceServerDebug( "CVoiceGameMgr::ClientCommand: invalid index (%d)\n", i );
			}
		}

		// Commented out UpdateMasks() because Mugsy said it was causing overflows in DOD 4/22
		// Force it to update the masks now.
		//UpdateMasks();		
		return true;
	}
	else if(stricmp(cmd, "VModEnable") == 0 && CMD_ARGC() >= 2)
	{
		VoiceServerDebug( "CVoiceGameMgr::ClientCommand: VModEnable (%d)\n", !!atoi(CMD_ARGV(1)) );
		g_PlayerModEnable[playerClientIndex] = !!atoi(CMD_ARGV(1));
		g_bWantModEnable[playerClientIndex] = false;
		// Commented out UpdateMasks() because Mugsy said it was causing overflows in DOD 4/22
		//UpdateMasks();		
		return true;
	}
	else
	{
		return false;
	}
}
bool CVoiceGameMgr::ClientCommand( CBasePlayer *pPlayer, const CCommand &args )
{
	int playerClientIndex = pPlayer->entindex() - 1;
	if(playerClientIndex < 0 || playerClientIndex >= m_nMaxPlayers)
	{
		VoiceServerDebug( "CVoiceGameMgr::ClientCommand: cmd %s from invalid client (%d)\n", args[0], playerClientIndex );
		return true;
	}

	bool bBan = stricmp( args[0], "vban" ) == 0;
	if( bBan && args.ArgC() >= 2 )
	{
		for(int i=1; i < args.ArgC(); i++)
		{
			unsigned long mask = 0;
			sscanf( args[i], "%p", (void**)&mask);

			if( i <= VOICE_MAX_PLAYERS_DW )
			{
				VoiceServerDebug( "CVoiceGameMgr::ClientCommand: vban (0x%x) from %d\n", mask, playerClientIndex );
				g_BanMasks[playerClientIndex].SetDWord(i-1, mask);
			}
			else
			{
				VoiceServerDebug( "CVoiceGameMgr::ClientCommand: invalid index (%d)\n", i );
			}
		}

		// Force it to update the masks now.
		//UpdateMasks();		
		return true;
	}
	else if(stricmp( args[0], "VModEnable") == 0 && args.ArgC() >= 2)
	{
		VoiceServerDebug( "CVoiceGameMgr::ClientCommand: VModEnable (%d)\n", !!atoi( args[1] ) );
		g_PlayerModEnable[playerClientIndex] = !!atoi( args[1] );
		g_bWantModEnable[playerClientIndex] = false;
		//UpdateMasks();		
		return true;
	}
	else
	{
		return false;
	}
}
Example #3
0
bool CVoiceGameMgr::ClientCommand(CBasePlayer *pPlayer, const char *cmd)
{
	int playerClientIndex = pPlayer->entindex() - 1;
	if (playerClientIndex < 0 || playerClientIndex >= m_nMaxPlayers)
	{
		VoiceServerDebug("CVoiceGameMgr::ClientCommand: cmd %s from invalid client (%d)\n", cmd, playerClientIndex);
		return true;
	}

	bool bBan = Q_stricmp(cmd, "vban") == 0;
	if (bBan && CMD_ARGC() >= 2)
	{
		for (int i = 1; i < CMD_ARGC(); ++i)
		{
			uint32 mask = 0;
			Q_sscanf(CMD_ARGV(i), "%x", &mask);

			if (i <= VOICE_MAX_PLAYERS_DW)
			{
				VoiceServerDebug("CVoiceGameMgr::ClientCommand: vban (0x%x) from %d\n", mask, playerClientIndex);
				g_BanMasks[ playerClientIndex ].SetDWord(i - 1, mask);
			}
			else
				VoiceServerDebug("CVoiceGameMgr::ClientCommand: invalid index (%d)\n", i);
		}

		// Force it to update the masks now.
		//UpdateMasks();
		return true;
	}
	else if (Q_stricmp(cmd, "VModEnable") == 0 && CMD_ARGC() >= 2)
	{
		VoiceServerDebug("CVoiceGameMgr::ClientCommand: VModEnable (%d)\n", !!Q_atoi(CMD_ARGV(1)));

		g_PlayerModEnable[ playerClientIndex ] = !!Q_atoi(CMD_ARGV(1));
		g_bWantModEnable[ playerClientIndex ] = false;
		//UpdateMasks();
		return true;
	}

	return false;
}