diff --git a/CELT_VOICE/scripting/nosteam_celt_audio.sp b/CELT_VOICE/scripting/nosteam_celt_audio.sp index 640aca7..4d185aa 100644 --- a/CELT_VOICE/scripting/nosteam_celt_audio.sp +++ b/CELT_VOICE/scripting/nosteam_celt_audio.sp @@ -11,6 +11,8 @@ Handle g_hCheckMutes = null; Handle g_hCookieTorchMuted = null; +bool g_bWasChecked[MAXPLAYERS + 1]; + public Plugin myinfo = { name = "NoSteam CELT Voice override", @@ -20,7 +22,7 @@ public Plugin myinfo = public void OnPluginStart() { - g_hCheckMutes = CreateTimer(5.0, check_mutes, _, TIMER_REPEAT); + g_hCheckMutes = CreateTimer(2.0, check_mutes, _, TIMER_REPEAT); g_hCookieTorchMuted = RegClientCookie("torch_muted", "is torch muted", CookieAccess_Protected); } @@ -40,6 +42,12 @@ public Action check_mutes(Handle timer, any data) { continue; } + if (!g_bWasChecked[i]) + { + char dummy[64]; + OnClientAuthorized(i, dummy); + g_bWasChecked[i] = true; + } for (int j = 1; j <= MaxClients; j++) { if (!IsValidClient(j) || i == j || IsFakeClient(j)) @@ -80,8 +88,14 @@ public Action check_mutes(Handle timer, any data) return Plugin_Continue; } +public void OnClientDisconnect(int client) +{ + g_bWasChecked[client] = false; +} + public void OnClientAuthorized(int client, const char[] auth) { + g_bWasChecked[client] = true; if (IsFakeClient(client)) { return; @@ -90,6 +104,7 @@ public void OnClientAuthorized(int client, const char[] auth) if (!PM_IsPlayerSteam(client)) { SetClientNoSteam(client, true); + //LogMessage("here in onauthorized client: %N", client); //setting it too early does not work, so some delay needed. CreateTimer(10.0, Timer_SendVoiceInit, GetClientSerial(client)); CreateTimer(20.0, Timer_SendVoiceInit, GetClientSerial(client));