//---------------------------------------------------------------------------------------------------- // Leader3 chat: `title listener, force-mute while a leader talks. //---------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------- // ` in chat sets the title of the leader's last marker. '`' alone clears it. //---------------------------------------------------------------------------------------------------- public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs) { if (client == 0 || sArgs[0] != '`' || !IsLeader(client)) return Plugin_Continue; char text[128]; strcopy(text, sizeof(text), sArgs[1]); TrimString(text); Marker_SetTitle(client, text); return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Force-mute: while any leader is talking, mute everyone without admin access. //---------------------------------------------------------------------------------------------------- public Action Cmd_ForceLeader(int client, int args) { if (g_alLeaders.Length == 0) { ReplyToCommand(client, "%s Cannot use this when there is no leader at the moment.", PREFIX_PLAIN); return Plugin_Handled; } // Enabling is reserved for whitelisted leaders (server console excepted); disabling is not. if (!g_bForceLeaderMute && client != 0 && !Whitelist_IsWhitelisted(client)) { ReplyToCommand(client, "%s Only players on the leader whitelist can enable force mute.", PREFIX_PLAIN); return Plugin_Handled; } g_bForceLeaderMute = !g_bForceLeaderMute; if (g_bForceLeaderMute) PrintToChatAll("%s\x04%N\x01 activated force mute while a leader is speaking!", PREFIX, client); else PrintToChatAll("%s\x04%N\x01 deactivated force mute while a leader is speaking!", PREFIX, client); return Plugin_Handled; } bool IsAnyLeaderTalking() { for (int i = 0; i < g_alLeaders.Length; i++) { int leader = GetClientOfUserId(g_alLeaders.Get(i)); if (leader > 0 && IsClientTalking(leader)) return true; } return false; } public Action Chat_CheckLeaderVoice(Handle timer) { if (!g_bForceLeaderMute || g_alLeaders.Length == 0) { if (!g_bForceLeaderMute) Chat_UnmuteForced(); return Plugin_Continue; } if (IsAnyLeaderTalking()) { for (int i = 1; i <= MaxClients; i++) { if (IsClientInGame(i) && !g_bIsLeader[i] && !BaseComm_IsClientMuted(i) && !CheckCommandAccess(i, "sm_admin", ADMFLAG_GENERIC, false)) { BaseComm_SetClientMute(i, true); g_bForceMuted[i] = true; } } for (int i = 1; i <= MaxClients; i++) { if (g_bForceMuted[i] && IsClientInGame(i) && IsClientTalking(i)) PrintHintText(i, "You are muted right now because a leader is talking!"); } } else { Chat_UnmuteForced(); } return Plugin_Continue; } void Chat_UnmuteForced() { for (int i = 1; i <= MaxClients; i++) { if (g_bForceMuted[i] && IsClientInGame(i)) { BaseComm_SetClientMute(i, false); g_bForceMuted[i] = false; } } }