//[Command("leaveroom")] public void LeaveRoomCommand(Client player, string name) { try { name = name.ToUpper(); if (name.Length != 0) { RoomController controller = RoomController.getInstance(); if (controller.HasRoom(name)) { VoiceMetaData voiceMeta = player.GetData("Voip"); if (name.Equals(voiceMeta.RadioRoom)) { controller.OnQuit(name, player); } player.SendChatMessage("You leave from room - " + name); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
//[Command("changeroom")] public void ChangeRoomCommand(Client player, string name) { try { name = name.ToUpper(); if (name.Length != 0) { RoomController controller = RoomController.getInstance(); VoiceMetaData voiceMeta = player.GetData("Voip"); if (controller.HasRoom(name)) { if (name.Equals(voiceMeta.RadioRoom)) { player.SendChatMessage("You are already on this room"); return; } controller.OnQuit(name, player); controller.OnJoin(name, player); } else { player.SendChatMessage("This room doesn't exist"); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public static void PlayerJoin(Client player) { try { VoiceMetaData DefaultVoiceMeta = new VoiceMetaData { IsEnabledMicrophone = false, RadioRoom = "", StateConnection = "closed", MicrophoneKey = 78 // N }; VoicePhoneMetaData DefaultVoicePhoneMeta = new VoicePhoneMetaData { CallingState = "nothing", Target = null }; player.SetData("Voip", DefaultVoiceMeta); player.SetData("PhoneVoip", DefaultVoicePhoneMeta); } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public void SetMicrophoneKey(Client player, int microphoneKey) { try { VoiceMetaData voiceMeta = player.GetData("Voip"); voiceMeta.MicrophoneKey = microphoneKey; Trigger.ClientEvent(player, "voice.changeMicrophoneActivationKey", microphoneKey); player.SetData("Voip", voiceMeta); } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public static void PlayerQuit(Client player, string reson) { try { RoomController controller = RoomController.getInstance(); VoiceMetaData voiceMeta = player.GetData("Voip"); if (controller.HasRoom(voiceMeta.RadioRoom)) { controller.OnQuit(voiceMeta.RadioRoom, player); } VoicePhoneMetaData playerPhoneMeta = player.GetData("PhoneVoip"); if (playerPhoneMeta.Target != null) { Client target = playerPhoneMeta.Target; VoicePhoneMetaData targetPhoneMeta = target.GetData("PhoneVoip"); var pSim = Main.Players[player].Sim; var playerName = (Main.Players[target].Contacts.ContainsKey(pSim)) ? Main.Players[target].Contacts[pSim] : pSim.ToString(); Notify.Send(target, NotifyType.Alert, NotifyPosition.BottomCenter, $"{playerName} завершил вызов", 3000); targetPhoneMeta.Target = null; targetPhoneMeta.CallingState = "nothing"; target.ResetData("AntiAnimDown"); if (!target.IsInVehicle) { target.StopAnimation(); } else { target.SetData("ToResetAnimPhone", true); } Core.BasicSync.DetachObject(target); Trigger.ClientEvent(target, "voice.phoneStop"); target.SetData("PhoneVoip", targetPhoneMeta); } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public int GetMicrophoneKey(Client player) { VoiceMetaData voiceMeta = player.GetData("Voip"); return(voiceMeta.MicrophoneKey); }
public bool IsMicrophoneEnabled(Client player) { VoiceMetaData voiceMeta = player.GetData("Voip"); return(voiceMeta.IsEnabledMicrophone); }