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

Added a 'destroy engine' button to Vehicle Options. #246

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions SharedClasses/PermissionsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public enum Permission
VOInfiniteFuel,
VOFlares,
VOPlaneBombs,
VODestroyEngine,
#endregion

// Vehicle Spawner
Expand Down
12 changes: 12 additions & 0 deletions vMenu/menus/VehicleOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ private void CreateMenu()
LeftIcon = MenuItem.Icon.WARNING
};

MenuItem destroyEngine = new MenuItem("Destroy Engine", "Destroy the vehicle's engine.");

// Create lists.
var dirtlevel = new List<string> { "No Dirt", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };
MenuListItem setDirtLevel = new MenuListItem("Set Dirt Level", dirtlevel, 0, "Select how much dirt should be visible on your vehicle, press ~r~enter~s~ " +
Expand Down Expand Up @@ -407,6 +409,11 @@ private void CreateMenu()
{
menu.AddMenuItem(deleteBtn);
}

if (IsAllowed(Permission.VODestroyEngine)) // DESTROY ENGINE
{
menu.AddMenuItem(destroyEngine);
}
#endregion

#region delete vehicle handle stuff
Expand Down Expand Up @@ -497,6 +504,11 @@ private void CreateMenu()
{
SetVehicleEngineOn(vehicle.Handle, !vehicle.IsEngineRunning, false, true);
}
// Destroy engine
else if (item == destroyEngine)
{
SetVehicleEngineHealth(vehicle.Handle, -4000);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting it to 0 should also kill it afaik, or maybe -1 should be good enough. I haven't tested it completely but let me know. Other than that this PR looks good.

}
// Set license plate text
else if (item == setLicensePlateText)
{
Expand Down