Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix vehicule customization menu crashing in builds < 2372 #425

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions vMenu/menus/VehicleOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1892,8 +1892,7 @@ public void UpdateMods(int selectedIndex = 0)
var xenonHeadlights = new MenuCheckboxItem("Xenon Headlights", "Enable or disable ~b~xenon ~s~headlights.", IsToggleModOn(veh.Handle, 22));
var turbo = new MenuCheckboxItem("Turbo", "Enable or disable the ~y~turbo~s~ for this vehicle.", IsToggleModOn(veh.Handle, 18));
var bulletProofTires = new MenuCheckboxItem("Bullet Proof Tires", "Enable or disable ~y~bullet proof tires~s~ for this vehicle.", !GetVehicleTyresCanBurst(veh.Handle));
var lowGripTires = new MenuCheckboxItem("Low Grip Tires", "Enable or disable ~y~low grip tires~s~ for this vehicle.", GetDriftTyresEnabled(veh.Handle));


// Add the checkboxes to the menu.
VehicleModMenu.AddMenuItem(toggleCustomWheels);
VehicleModMenu.AddMenuItem(xenonHeadlights);
Expand All @@ -1906,7 +1905,14 @@ public void UpdateMods(int selectedIndex = 0)
VehicleModMenu.AddMenuItem(headlightColor);
VehicleModMenu.AddMenuItem(turbo);
VehicleModMenu.AddMenuItem(bulletProofTires);
VehicleModMenu.AddMenuItem(lowGripTires);

bool isLowGripAvailable = GetGameBuildNumber() >= 2372;
var lowGripTires = new MenuCheckboxItem("Low Grip Tires", "Enable or disable ~y~low grip tires~s~ for this vehicle.", isLowGripAvailable ? GetDriftTyresEnabled(veh.Handle) : false);
if (isLowGripAvailable)
{
VehicleModMenu.AddMenuItem(lowGripTires);
}

// Create a list of tire smoke options.
var tireSmokes = new List<string>() { "Red", "Orange", "Yellow", "Gold", "Light Green", "Dark Green", "Light Blue", "Dark Blue", "Purple", "Pink", "Black" };
var tireSmokeColors = new Dictionary<string, int[]>()
Expand Down