diff --git a/CommunityRaces.cs b/CommunityRaces.cs index ae29f5b..3733654 100644 --- a/CommunityRaces.cs +++ b/CommunityRaces.cs @@ -109,14 +109,16 @@ public CommunityRaces() private void AddRacesBlips() { - foreach (RaceBlip race in _races) - race.Add(); + if (Config.RacesBlips) + foreach (RaceBlip race in _races) + race.Add(); } private void RemoveRacesBlips() { - foreach (RaceBlip race in _races) - race.Remove(); + if (Config.RacesBlips) + foreach (RaceBlip race in _races) + race.Remove(); } /// @@ -243,6 +245,11 @@ private void StartRace(Race race) _currentVehicle.IsPersistent = false; _currentVehicle.FreezePosition = true; + if (Config.Radio == "RadioOff") + Function.Call(Hash.SET_VEH_RADIO_STATION, _currentVehicle.Handle, "OFF"); + else + SetRadioStation(); + int spawnlen = 0; switch (Config.Opponents) { @@ -792,6 +799,19 @@ public void BuildMenu(Race race) Config.SecondaryColor = item.Items[index].ToString(); }; + SetRadioStation(); + var radioList = new List { "Random" }; + Enum.GetValues(typeof(RadioStation)).Cast().ToList().ForEach(r => { if (r != RadioStation.Unknown) radioList.Add(r); }); + int selectedRadio = 0; + if (Enum.TryParse(Config.Radio, out RadioStation radio)) + selectedRadio = radioList.IndexOf(radio); + var radioItem = new UIMenuListItem("Radio", radioList, selectedRadio); + radioItem.OnListChanged += (item, index) => + { + Config.Radio = item.Items[index].ToString(); + SetRadioStation(); + }; + var confimItem = new UIMenuItem("Start Race"); confimItem.Activated += (item, index) => { @@ -819,6 +839,7 @@ public void BuildMenu(Race race) GUI.MainMenu.AddItem(carItem); GUI.MainMenu.AddItem(primaryColorItem); GUI.MainMenu.AddItem(secondaryColorItem); + GUI.MainMenu.AddItem(radioItem); GUI.MainMenu.AddItem(opponentsItem); if (race.LapsAvailable) { @@ -833,7 +854,7 @@ public void BuildMenu(Race race) } GUI.MainMenu.AddItem(confimItem); GUI.MainMenu.RefreshIndex(); - GUI.MainMenu.CurrentSelection = race.LapsAvailable ? 10 : 9; + GUI.MainMenu.CurrentSelection = race.LapsAvailable ? 11 : 10; } private void SetVehicleColors() @@ -854,5 +875,11 @@ private void SetVehicleColors() } else _vehicleSecondaryColor = _previewVehicle.SecondaryColor; } + + private void SetRadioStation() + { + if (Enum.TryParse(Config.Radio, out RadioStation radio)) + Game.RadioStation = radio; + } } } diff --git a/CommunityRaces.ini b/CommunityRaces.ini index 52a8fe0..4321876 100644 --- a/CommunityRaces.ini +++ b/CommunityRaces.ini @@ -6,9 +6,11 @@ TRAFFIC = True PEDS = True PRIMARYCOLOR = Random SECONDARYCOLOR = Random +RADIO = Random OPPONENTS = Random LAPS = 1 CAYOPERICOLOADER = True +RACESBLIPS = True TELEPORTKEY = F8 [GHOST] diff --git a/Config.cs b/Config.cs index 8a60089..603e546 100644 --- a/Config.cs +++ b/Config.cs @@ -10,6 +10,7 @@ public static class Config public static int Opacity; public static bool Collision; public static bool CayoPericoLoader; + public static bool RacesBlips; public static Keys TeleportKey; static Config() @@ -21,6 +22,7 @@ static Config() Opacity = o * 51; Collision = _settings.GetValue("Ghost", "Collision", false); CayoPericoLoader = _settings.GetValue("Main", "CayoPericoLoader", true); + RacesBlips = _settings.GetValue("Main", "RacesBlips", true); TeleportKey = (Keys)Enum.Parse(typeof(Keys), _settings.GetValue("Main", "TeleportKey", "F8"), true); } @@ -102,6 +104,19 @@ public static string SecondaryColor } } + public static string Radio + { + get + { + return _settings.GetValue("Main", "Radio", "Random"); + } + set + { + _settings.SetValue("Main", "Radio", value); + _settings.Save(); + } + } + public static string Opponents { get