Changed the convar change hook for sv_alltalk to enforce sm_deadtalk correctly
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401824
This commit is contained in:
		
							parent
							
								
									e1748d9814
								
							
						
					
					
						commit
						c02dc7f71d
					
				@ -156,46 +156,31 @@ public Action:Command_Say(client, args)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public ConVarChange_Alltalk(Handle:convar, const String:oldValue[], const String:newValue[])
 | 
					public ConVarChange_Alltalk(Handle:convar, const String:oldValue[], const String:newValue[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (StringToInt(newValue) != 0
 | 
						new mode = GetConVarInt(g_Cvar_Deadtalk);
 | 
				
			||||||
		|| StringToInt(oldValue) == 0)
 | 
						new maxClients = GetMaxClients();
 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		return;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	new dt_val = GetConVarInt(g_Cvar_Deadtalk);
 | 
						for (new i = 1; i <= maxClients; i++)
 | 
				
			||||||
	new max_clients = GetMaxClients();
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	for (new i = 1; i <= max_clients; i++)
 | 
					 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (!IsClientInGame(i))
 | 
							if (!IsClientInGame(i))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		PrintToServer("STAT (i %d) (g_Muted[%d] %d) (dt_val %d)", i, i, g_Muted[i], dt_val);
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if (IsPlayerAlive(i))
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
		if (g_Muted[i])
 | 
							if (g_Muted[i])
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			SetClientListeningFlags(i, VOICE_MUTED);
 | 
								SetClientListeningFlags(i, VOICE_MUTED);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
			else
 | 
							else if (GetConVarBool(g_Cvar_Alltalk))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			SetClientListeningFlags(i, VOICE_NORMAL);
 | 
								SetClientListeningFlags(i, VOICE_NORMAL);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (g_Muted[i])
 | 
								if (mode == 1)
 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
				SetClientListeningFlags(i, VOICE_MUTED);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			else if (dt_val == 1)
 | 
					 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				SetClientListeningFlags(i, VOICE_LISTENALL);
 | 
									SetClientListeningFlags(i, VOICE_LISTENALL);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else if (dt_val == 2)
 | 
								else if (mode == 2)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				SetClientListeningFlags(i, VOICE_TEAM);
 | 
									SetClientListeningFlags(i, VOICE_TEAM);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@ -233,12 +218,12 @@ public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
 | 
				
			|||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	new dt_val = GetConVarInt(g_Cvar_Deadtalk);
 | 
						new mode = GetConVarInt(g_Cvar_Deadtalk);
 | 
				
			||||||
	if (dt_val == 1)
 | 
						if (mode == 1)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		SetClientListeningFlags(client, VOICE_LISTENALL);
 | 
							SetClientListeningFlags(client, VOICE_LISTENALL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (dt_val == 2)
 | 
						else if (mode == 2)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		SetClientListeningFlags(client, VOICE_TEAM);
 | 
							SetClientListeningFlags(client, VOICE_TEAM);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user