Exemplo n.º 1
0
        public static void SetRadioSpeaker(IPlayer player, bool toggle)
        {
            if (!VoiceManager.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            voiceClient.RadioSpeaker = toggle;
        }
Exemplo n.º 2
0
        public static void LeaveRadioChannel(IPlayer player)
        {
            if (!VoiceManager.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            foreach (RadioChannel radioChannel in VoiceManager.RadioChannels.Where(r => r.IsMember(voiceClient)))
            {
                VoiceManager.LeaveRadioChannel(player, radioChannel.Name);
            }
        }
Exemplo n.º 3
0
        public void OnIsTalking(IPlayer player, bool isTalking)
        {
            if (!VoiceManager.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            foreach (VoiceClient client in VoiceManager.VoiceClients)
            {
                client.Player.Emit(Event.SaltyChat_IsTalking, player.Id, isTalking);
            }
        }
Exemplo n.º 4
0
        public static void SendingOnRadio(IPlayer player, string radioChannelName, bool isSending)
        {
            if (!VoiceManager.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            RadioChannel radioChannel = VoiceManager.GetRadioChannel(radioChannelName, false);

            if (radioChannel == null || !radioChannel.IsMember(voiceClient))
            {
                return;
            }

            radioChannel.Send(voiceClient, isSending);
        }
Exemplo n.º 5
0
        public static void LeaveRadioChannel(IPlayer player, string radioChannelName)
        {
            if (!VoiceManager.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            RadioChannel radioChannel = VoiceManager.GetRadioChannel(radioChannelName, false);

            if (radioChannel != null)
            {
                radioChannel.RemoveMember(voiceClient);

                if (radioChannel.Members.Length == 0)
                {
                    VoiceManager._radioChannels.Remove(radioChannel);
                }
            }
        }
Exemplo n.º 6
0
        public static void JoinRadioChannel(IPlayer player, string radioChannelName)
        {
            if (!VoiceManager.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            foreach (RadioChannel channel in VoiceManager.RadioChannels)
            {
                if (channel.IsMember(voiceClient))
                {
                    return;
                }
            }

            RadioChannel radioChannel = VoiceManager.GetRadioChannel(radioChannelName, true);

            radioChannel.AddMember(voiceClient);
        }
Exemplo n.º 7
0
        public void OnSetVoiceRange(IPlayer player, int range)
        {
            float voiceRange = (float)range;

            if (!VoiceManager.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }

            //Console.WriteLine("Set Voice Range for Player");

            if (Array.IndexOf(SharedData.VoiceRanges, voiceRange) >= 0)
            {
                voiceClient.VoiceRange = voiceRange;

                foreach (VoiceClient client in VoiceManager.VoiceClients)
                {
                    client.Player.Emit(Event.SaltyChat_UpdateClient, player.Id, voiceClient.TeamSpeakName, voiceClient.VoiceRange);
                }
            }
        }
Exemplo n.º 8
0
        public void OnCheckVersion(IPlayer player, string branch, string version)
        {
            Console.WriteLine($"Checked Version for Player #{player.Id}");

            if (!VoiceManager.TryGetVoiceClient(player, out VoiceClient voiceClient))
            {
                return;
            }


            if (!VoiceManager.IsVersionAccepted(branch, version))
            {
                player.Kick($"[Salty Chat] Required Branch: {VoiceManager.RequiredUpdateBranch} | Required Version: {VoiceManager.MinimumPluginVersion}");
                return;
            }

            foreach (VoiceClient cl in VoiceManager.VoiceClients)
            {
                player.Emit(Event.SaltyChat_UpdateClient, cl.Player.Id, cl.TeamSpeakName, cl.VoiceRange);
            }

            Alt.EmitAllClients(Event.SaltyChat_UpdateClient, voiceClient.Player.Id, voiceClient.TeamSpeakName, voiceClient.VoiceRange);
        }