Пример #1
0
 public void OnIntercomSpeaking(IntercomSpeakingEventArgs ev)
 {
     if (ev.Player.Role == RoleType.Scp049)
     {
         ev.IsAllowed = true;
     }
 }
 public async void OnIntercomSpeaking(IntercomSpeakingEventArgs ev)
 {
     if (ev.Player != null && Instance.Config.EventsToLog.PlayerIntercomSpeaking && (!ev.Player.DoNotTrack || !Instance.Config.ShouldRespectDoNotTrack))
     {
         await Network.SendAsync(new RemoteCommand("log", "gameEvents", string.Format(Language.HasStartedUsingTheIntercom, ev.Player.Nickname, Instance.Config.ShouldLogUserIds ? ev.Player.UserId : Language.Redacted, ev.Player.Role))).ConfigureAwait(false);
     }
 }
Пример #3
0
 internal void OnIntercom(IntercomSpeakingEventArgs ev)
 {
     if ((IsLobby || Round.ElapsedTime.TotalSeconds <= 5) && !Config.AllowIntercom)
     {
         ev.IsAllowed = false;
     }
 }
Пример #4
0
 public void OnIntercomSpeaking(IntercomSpeakingEventArgs ev)
 {
     if (Instance.Config.GhostInteract || !GhostList.Contains(ev.Player))
     {
         return;
     }
     ev.IsAllowed = false;
 }
Пример #5
0
 public async void OnIntercomSpeaking(IntercomSpeakingEventArgs ev)
 {
     if (ev.IsAllowed)
     {
         await _privateWebhook.ExecuteWebhook(
             $"{ev.Player.Nickname} ({ev.Player.UserId}) is speaking on the intercom",
             "SCP-Bot",
             false
             );
     }
 }
Пример #6
0
        private static bool Prefix(Intercom __instance, bool player)
        {
            try
            {
                if (!__instance._interactRateLimit.CanExecute(true) || Intercom.AdminSpeaking)
                {
                    return(false);
                }

                var ev = new IntercomSpeakingEventArgs(player ? API.Features.Player.Get(__instance.gameObject) : null);

                if (player)
                {
                    if (!__instance.ServerAllowToSpeak())
                    {
                        return(false);
                    }

                    Player.OnIntercomSpeaking(ev);

                    if (ev.IsAllowed)
                    {
                        Intercom.host.RequestTransmission(__instance.gameObject);
                    }
                }
                else
                {
                    if (!(Intercom.host.Networkspeaker == __instance.gameObject))
                    {
                        return(false);
                    }

                    Player.OnIntercomSpeaking(ev);

                    if (ev.IsAllowed)
                    {
                        Intercom.host.RequestTransmission(null);
                    }
                }

                return(false);
            }
            catch (Exception e)
            {
                Exiled.API.Features.Log.Error($"Exiled.Events.Patches.Events.Player.IntercomSpeaking: {e}\n{e.StackTrace}");

                return(true);
            }
        }
Пример #7
0
        internal void IntercomSpeaking(IntercomSpeakingEventArgs ev)
        {
            if (Plugin.Instance.Config.IntercomSpeaking == "")
            {
                return;
            }
            string message = Plugin.Instance.Config.IntercomSpeaking.Replace("%player%", ev.Player.ToString());


            if (Plugin.Instance.Config.debug_to_console)
            {
                Log.Debug(message: "[ " + Plugin.Instance.Config.player_name + "] " + message);
            }
            Plugin.sendWebHook(Plugin.Instance.Config.player_url, message, Plugin.Instance.Config.player_name);
        }
Пример #8
0
        private static bool Prefix(Intercom __instance, bool player)
        {
            if (!__instance._interactRateLimit.CanExecute(true) || Intercom.AdminSpeaking)
            {
                return(false);
            }

            var ev = new IntercomSpeakingEventArgs(player ? API.Features.Player.Get(__instance.gameObject) : null);

            if (player)
            {
                if (!__instance.ServerAllowToSpeak())
                {
                    return(false);
                }

                Player.OnIntercomSpeaking(ev);

                if (ev.IsAllowed)
                {
                    Intercom.host.RequestTransmission(__instance.gameObject);
                }
            }
            else
            {
                if (!(Intercom.host.Networkspeaker == __instance.gameObject))
                {
                    return(false);
                }

                Player.OnIntercomSpeaking(ev);

                if (ev.IsAllowed)
                {
                    Intercom.host.RequestTransmission(null);
                }
            }

            return(false);
        }
Пример #9
0
 /// <summary>
 /// Invoked before speaking to the intercom.
 /// </summary>
 /// <param name="ev">The <see cref="IntercomSpeakingEventArgs"/> instance.</param>
 public static void OnIntercomSpeaking(IntercomSpeakingEventArgs ev) => IntercomSpeaking.InvokeSafely(ev);