fixed
amb1076 - potential issues with deadtalk+alltalk I guess, I don't know
1.1 --- a/plugins/basecomm.sp Wed Oct 31 06:22:36 2007 +0000
1.2 +++ b/plugins/basecomm.sp Wed Oct 31 06:37:21 2007 +0000
1.3 @@ -80,6 +80,7 @@
1.4 RegAdminCmd("sm_unsilence", Command_Unsilence, ADMFLAG_CHAT, "sm_unsilence <player> - Restores a player's ability to use voice and chat.");
1.5
1.6 HookConVarChange(g_Cvar_Deadtalk, ConVarChange_Deadtalk);
1.7 + HookConVarChange(g_Cvar_Alltalk, ConVarChange_Alltalk);
1.8
1.9 /* Account for late loading */
1.10 new Handle:topmenu;
1.11 @@ -153,6 +154,55 @@
1.12 return Plugin_Continue;
1.13 }
1.14
1.15 +public ConVarChange_Alltalk(Handle:convar, const String:oldValue[], const String:newValue[])
1.16 +{
1.17 + if (StringToInt(newValue) != 0
1.18 + || StringToInt(oldValue) == 0)
1.19 + {
1.20 + return;
1.21 + }
1.22 +
1.23 + new dt_val = GetConVarInt(g_Cvar_Deadtalk);
1.24 + new max_clients = GetMaxClients();
1.25 +
1.26 + for (new i = 1; i <= max_clients; i++)
1.27 + {
1.28 + if (!IsClientInGame(i))
1.29 + {
1.30 + continue;
1.31 + }
1.32 +
1.33 + PrintToServer("STAT (i %d) (g_Muted[%d] %d) (dt_val %d)", i, i, g_Muted[i], dt_val);
1.34 +
1.35 + if (IsPlayerAlive(i))
1.36 + {
1.37 + if (g_Muted[i])
1.38 + {
1.39 + SetClientListeningFlags(i, VOICE_MUTED);
1.40 + }
1.41 + else
1.42 + {
1.43 + SetClientListeningFlags(i, VOICE_NORMAL);
1.44 + }
1.45 + }
1.46 + else
1.47 + {
1.48 + if (g_Muted[i])
1.49 + {
1.50 + SetClientListeningFlags(i, VOICE_MUTED);
1.51 + }
1.52 + else if (dt_val == 1)
1.53 + {
1.54 + SetClientListeningFlags(i, VOICE_LISTENALL);
1.55 + }
1.56 + else if (dt_val == 2)
1.57 + {
1.58 + SetClientListeningFlags(i, VOICE_TEAM);
1.59 + }
1.60 + }
1.61 + }
1.62 +}
1.63 +
1.64 public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
1.65 {
1.66 new client = GetClientOfUserId(GetEventInt(event, "userid"));
1.67 @@ -183,11 +233,12 @@
1.68 return;
1.69 }
1.70
1.71 - if (GetConVarInt(g_Cvar_Deadtalk) == 1)
1.72 + new dt_val = GetConVarInt(g_Cvar_Deadtalk);
1.73 + if (dt_val == 1)
1.74 {
1.75 SetClientListeningFlags(client, VOICE_LISTENALL);
1.76 }
1.77 - else if (GetConVarInt(g_Cvar_Deadtalk) == 2)
1.78 + else if (dt_val == 2)
1.79 {
1.80 SetClientListeningFlags(client, VOICE_TEAM);
1.81 }