private void CreateMenu() { //VehicleData vd = new VehicleData(); #region initial setup. // Create the menu. menu = new UIMenu("BigFam Crew", "Vehicle Spawner", true) { ScaleWithSafezone = false, MouseControlsEnabled = false, MouseEdgeEnabled = false, ControlDisablingEnabled = false }; // Create the buttons and checkboxes. UIMenuItem spawnByName = new UIMenuItem("Spawn Vehicle By Model Name", "Enter the name of a vehicle to spawn."); UIMenuCheckboxItem spawnInVeh = new UIMenuCheckboxItem("Spawn Inside Vehicle", SpawnInVehicle, "This will teleport you into the vehicle when you spawn it."); UIMenuCheckboxItem replacePrev = new UIMenuCheckboxItem("Replace Previous Vehicle", ReplaceVehicle, "This will automatically delete your previously spawned vehicle when you spawn a new vehicle."); // Add the items to the menu. if (cf.IsAllowed(Permission.VSSpawnByName)) { menu.AddItem(spawnByName); } //menu.AddItem(spawnInVeh); //menu.AddItem(replacePrev); #endregion #region addon cars menu // Vehicle Addons List UIMenu addonCarsMenu = new UIMenu("Addon Vehicles", "Spawn An Addon Vehicle", true) { MouseControlsEnabled = false, MouseEdgeEnabled = false, ControlDisablingEnabled = false, ScaleWithSafezone = false }; UIMenuItem addonCarsBtn = new UIMenuItem("Addon Vehicles", "A list of addon vehicles available on this server."); addonCarsBtn.SetRightLabel("→→→"); menu.AddItem(addonCarsBtn); if (cf.IsAllowed(Permission.VSAddon)) { if (AddonVehicles != null) { if (AddonVehicles.Count > 0) { menu.BindMenuToItem(addonCarsMenu, addonCarsBtn); MainMenu.Mp.Add(addonCarsMenu); foreach (KeyValuePair <string, uint> veh in AddonVehicles) { string localizedName = GetLabelText(GetDisplayNameFromVehicleModel(veh.Value)); string name = localizedName != "NULL" ? localizedName : GetDisplayNameFromVehicleModel(veh.Value); name = name != "CARNOTFOUND" ? name : veh.Key; UIMenuItem carBtn = new UIMenuItem(name, $"Click to spawn {name}."); carBtn.SetRightLabel($"({veh.Key.ToString()})"); if (!IsModelInCdimage(veh.Value)) { carBtn.Enabled = false; carBtn.Description = "This vehicle is not available. Please ask the server owner to check if the vehicle is being streamed correctly."; carBtn.SetLeftBadge(UIMenuItem.BadgeStyle.Lock); } addonCarsMenu.AddItem(carBtn); } /* * //AddonVehicles.ToList(); * List<UIMenuItem> buttonsList = new List<UIMenuItem> { }; * menu.BindMenuToItem(addonCarsMenu, addonCarsBtn); * MainMenu.Mp.Add(addonCarsMenu); * foreach (KeyValuePair<string, uint> veh in AddonVehicles) * { * string localizedName = GetLabelText(GetDisplayNameFromVehicleModel(veh.Value)); * string name = localizedName != "NULL" ? localizedName : GetDisplayNameFromVehicleModel(veh.Value); * name = name != "CARNOTFOUND" ? name : veh.Key; * UIMenuItem carBtn = new UIMenuItem(name, $"Click to spawn {name}."); * carBtn.SetRightLabel($"({veh.Key.ToString()})"); * if (!IsModelInCdimage(veh.Value)) * { * carBtn.Enabled = false; * carBtn.Description = "This vehicle is not available. Please ask the server owner to check if the vehicle is being streamed correctly."; * carBtn.SetLeftBadge(UIMenuItem.BadgeStyle.Lock); * } * * buttonsList.Add(carBtn); * } * * buttonsList.Sort((prev, next) => String.Compare(prev.Text, next.Text)); * * buttonsList.ForEach(carBtn => * { * addonCarsMenu.AddItem(carBtn); * }); */ addonCarsMenu.OnItemSelect += (sender, item, index) => { cf.SpawnVehicle(AddonVehicles.ElementAt(index).Key, SpawnInVehicle, ReplaceVehicle); }; addonCarsMenu.RefreshIndex(); addonCarsMenu.UpdateScaleform(); } else { addonCarsBtn.Enabled = false; addonCarsBtn.SetLeftBadge(UIMenuItem.BadgeStyle.Lock); addonCarsBtn.Description = "There are no addon vehicles available on this server."; } } else { addonCarsBtn.Enabled = false; addonCarsBtn.SetLeftBadge(UIMenuItem.BadgeStyle.Lock); addonCarsBtn.Description = "The list containing all addon cars could not be loaded, is it configured properly?"; } } else { addonCarsBtn.Enabled = false; addonCarsBtn.SetLeftBadge(UIMenuItem.BadgeStyle.Lock); addonCarsBtn.Description = "Access to this list has been restricted by the server owner."; } #endregion #region vehicle classes submenus // Create the submenus for each category. var vl = new Vehicles(); // Loop through all the vehicle classes. for (var vehClass = 0; vehClass < 22; vehClass++) { // Get the class name. string className = cf.GetLocalizedName($"VEH_CLASS_{vehClass.ToString()}"); // Create a button & a menu for it, add the menu to the menu pool and add & bind the button to the menu. UIMenuItem btn = new UIMenuItem(className, $"Spawn a vehicle from the ~o~{className} ~s~class."); btn.SetRightLabel("→→→"); UIMenu vehicleClassMenu = new UIMenu("Vehicle Spawner", className, true) { ScaleWithSafezone = false, MouseControlsEnabled = false, MouseEdgeEnabled = false, ControlDisablingEnabled = false }; /* * MainMenu.Mp.Add(vehicleClassMenu); * menu.AddItem(btn); * * if (allowedCategories[vehClass]) * { * menu.BindMenuToItem(vehicleClassMenu, btn); * } * else * { * btn.SetLeftBadge(UIMenuItem.BadgeStyle.Lock); * btn.Description = "This category has been disabled by the server owner."; * btn.Enabled = false; * } */ // Create a dictionary for the duplicate vehicle names (in this vehicle class). var duplicateVehNames = new Dictionary <string, int>(); #region Add vehicles per class // Loop through all the vehicles in the vehicle class. foreach (var veh in vl.VehicleClasses[className]) { // Convert the model name to start with a Capital letter, converting the other characters to lowercase. var properCasedModelName = veh[0].ToString().ToUpper() + veh.ToLower().Substring(1); // Get the localized vehicle name, if it's "NULL" (no label found) then use the "properCasedModelName" created above. var vehName = cf.GetVehDisplayNameFromModel(veh) != "NULL" ? cf.GetVehDisplayNameFromModel(veh) : properCasedModelName; // Loop through all the menu items and check each item's title/text and see if it matches the current vehicle (display) name. var duplicate = false; for (var itemIndex = 0; itemIndex < vehicleClassMenu.MenuItems.Count; itemIndex++) { // If it matches... if (vehicleClassMenu.MenuItems[itemIndex].Text.ToString() == vehName) { // Check if the model was marked as duplicate before. if (duplicateVehNames.Keys.Contains(vehName)) { // If so, add 1 to the duplicate counter for this model name. duplicateVehNames[vehName]++; } // If this is the first duplicate, then set it to 2. else { duplicateVehNames[vehName] = 2; } // The model name is a duplicate, so get the modelname and add the duplicate amount for this model name to the end of the vehicle name. vehName += $" ({duplicateVehNames[vehName].ToString()})"; // Then create and add a new button for this vehicle. if (cf.DoesModelExist(veh)) { var vehBtn = new UIMenuItem(vehName) { Enabled = true }; vehicleClassMenu.AddItem(vehBtn); } else { var vehBtn = new UIMenuItem(vehName, "This vehicle is not available because the model could not be found in your game files. If this is a DLC vehicle, make sure the server is streaming it.") { Enabled = false }; vehicleClassMenu.AddItem(vehBtn); vehBtn.SetRightBadge(UIMenuItem.BadgeStyle.Lock); } // Mark duplicate as true and break from the loop because we already found the duplicate. duplicate = true; break; } } // If it's not a duplicate, add the model name. if (!duplicate) { if (cf.DoesModelExist(veh)) { var vehBtn = new UIMenuItem(vehName) { Enabled = true }; vehicleClassMenu.AddItem(vehBtn); } else { var vehBtn = new UIMenuItem(vehName, "This vehicle is not available because the model could not be found in your game files. If this is a DLC vehicle, make sure the server is streaming it.") { Enabled = false }; vehicleClassMenu.AddItem(vehBtn); vehBtn.SetRightBadge(UIMenuItem.BadgeStyle.Lock); } } } #endregion // Handle button presses vehicleClassMenu.OnItemSelect += (sender2, item2, index2) => { cf.SpawnVehicle(vl.VehicleClasses[className][index2], SpawnInVehicle, ReplaceVehicle); }; } #endregion #region handle events // Handle button presses. menu.OnItemSelect += (sender, item, index) => { if (item == spawnByName) { // Passing "custom" as the vehicle name, will ask the user for input. cf.SpawnVehicle("custom", SpawnInVehicle, ReplaceVehicle); } }; // Handle checkbox changes. menu.OnCheckboxChange += (sender, item, _checked) => { if (item == spawnInVeh) { SpawnInVehicle = _checked; } else if (item == replacePrev) { ReplaceVehicle = _checked; } }; #endregion }
/// <summary> /// Creates all the submenus depending on the permissions of the user. /// </summary> private void CreateSubmenus() { // Add the online players menu. if (Cf.IsAllowed(Permission.OPMenu)) { OnlinePlayersMenu = new OnlinePlayers(); UIMenu menu = OnlinePlayersMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Online Players", "All currently connected players."); button.SetRightLabel("→→→"); AddMenu(menu, button); Menu.OnItemSelect += (sender, item, index) => { if (item == button) { OnlinePlayersMenu.UpdatePlayerlist(); menu.RefreshIndex(); menu.UpdateScaleform(); } }; } if (Cf.IsAllowed(Permission.OPUnban)) { TriggerServerEvent("vMenu:RequestBanList", PlayerId()); BannedPlayersMenu = new BannedPlayers(); UIMenu menu = BannedPlayersMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Banned Players", "View and manage all banned players in this menu."); button.SetRightLabel("→→→"); AddMenu(menu, button); Menu.OnItemSelect += (sender, item, index) => { if (item == button) { TriggerServerEvent("vMenu:RequestBanList", PlayerId()); menu.RefreshIndex(); menu.UpdateScaleform(); } }; } // Add the player options menu. if (Cf.IsAllowed(Permission.POMenu)) { PlayerOptionsMenu = new PlayerOptions(); UIMenu menu = PlayerOptionsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Player Options", "Common player options can be accessed here."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add the vehicle options Menu. if (Cf.IsAllowed(Permission.VOMenu)) { VehicleOptionsMenu = new VehicleOptions(); UIMenu menu = VehicleOptionsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Vehicle Options", "Here you can change common vehicle options, as well as tune & style your vehicle."); button.SetRightLabel("→→→"); AddMenu(menu, button); } var vl = new Vehicles().VehicleClasses; // Add the vehicle spawner menu. if (Cf.IsAllowed(Permission.VSMenu)) { VehicleSpawnerMenu = new VehicleSpawner(); UIMenu menu = VehicleSpawnerMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Vehicle Spawner", "Spawn a vehicle by name or choose one from a specific category."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add Saved Vehicles menu. if (Cf.IsAllowed(Permission.SVMenu)) { SavedVehiclesMenu = new SavedVehicles(); UIMenu menu = SavedVehiclesMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Saved Vehicles", "Save new vehicles, or spawn or delete already saved vehicles."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add the player appearance menu. if (Cf.IsAllowed(Permission.PAMenu)) { PlayerAppearanceMenu = new PlayerAppearance(); UIMenu menu = PlayerAppearanceMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Player Appearance", "Choose a ped model, customize it and save & load your customized characters."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add the time options menu. // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever. if (Cf.IsAllowed(Permission.TOMenu) && MenuOptions["disableSync"] != "true") { TimeOptionsMenu = new TimeOptions(); UIMenu menu = TimeOptionsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Time Options", "Change the time, and edit other time related options."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add the weather options menu. // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever. if (Cf.IsAllowed(Permission.WOMenu) && MenuOptions["disableSync"] != "true") { WeatherOptionsMenu = new WeatherOptions(); UIMenu menu = WeatherOptionsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Weather Options", "Change all weather related options here."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add the weapons menu. if (Cf.IsAllowed(Permission.WPMenu)) { WeaponOptionsMenu = new WeaponOptions(); UIMenu menu = WeaponOptionsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Weapon Options", "Add/remove weapons, modify weapons and set ammo options."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add misc settings menu. if (Cf.IsAllowed(Permission.MSMenu)) { MiscSettingsMenu = new MiscSettings(); UIMenu menu = MiscSettingsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Misc Settings", "Change general settings."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add Voice Chat Menu. if (Cf.IsAllowed(Permission.VCMenu)) { VoiceChatSettingsMenu = new VoiceChat(); UIMenu menu = VoiceChatSettingsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Voice Chat Settings", "Change Voice Chat options here."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add About Menu. AboutMenu = new About(); UIMenu sub = AboutMenu.GetMenu(); UIMenuItem btn = new UIMenuItem("About vMenu", "Information about this menu and it's creators."); btn.SetRightLabel("→→→"); AddMenu(sub, btn); // Refresh everything. Mp.RefreshIndex(); Menu.UpdateScaleform(); // Globally disable the native ui controls disabling. Mp.ControlDisablingEnabled = false; // Globally disable the "mouse edge" feature. Mp.MouseEdgeEnabled = false; }
private void CreateMenu() { VehicleData vd = new VehicleData(); allowedCategories = new List <bool>() { cf.IsAllowed(Permission.VSCompacts), cf.IsAllowed(Permission.VSSedans), cf.IsAllowed(Permission.VSSUVs), cf.IsAllowed(Permission.VSCoupes), cf.IsAllowed(Permission.VSMuscle), cf.IsAllowed(Permission.VSSportsClassic), cf.IsAllowed(Permission.VSSports), cf.IsAllowed(Permission.VSSuper), cf.IsAllowed(Permission.VSMotorcycles), cf.IsAllowed(Permission.VSOffRoad), cf.IsAllowed(Permission.VSIndustrial), cf.IsAllowed(Permission.VSUtility), cf.IsAllowed(Permission.VSVans), cf.IsAllowed(Permission.VSCycles), cf.IsAllowed(Permission.VSBoats), cf.IsAllowed(Permission.VSHelicopters), cf.IsAllowed(Permission.VSPlanes), cf.IsAllowed(Permission.VSService), cf.IsAllowed(Permission.VSEmergency), cf.IsAllowed(Permission.VSMilitary), cf.IsAllowed(Permission.VSCommercial), cf.IsAllowed(Permission.VSTrains), }; // Create the menu. menu = new UIMenu(GetPlayerName(PlayerId()), "Vehicle Spawner", true) { ScaleWithSafezone = false, MouseControlsEnabled = false, MouseEdgeEnabled = false, ControlDisablingEnabled = false }; // Create the buttons and checkboxes. UIMenuItem spawnByName = new UIMenuItem("Spawn Vehicle By Model Name", "Enter the name of a vehicle to spawn."); UIMenuCheckboxItem spawnInVeh = new UIMenuCheckboxItem("Spawn Inside Vehicle", SpawnInVehicle, "This will teleport you into the vehicle when you spawn it."); UIMenuCheckboxItem replacePrev = new UIMenuCheckboxItem("Replace Previous Vehicle", SpawnInVehicle, "This will automatically delete your previously spawned vehicle when you spawn a new vehicle."); // Add the items to the menu. if (cf.IsAllowed(Permission.VSSpawnByName)) { menu.AddItem(spawnByName); } menu.AddItem(spawnInVeh); menu.AddItem(replacePrev); // Create the submenus for each category. var vl = new Vehicles(); // Loop through all the vehicle classes. for (var vehClass = 0; vehClass < 22; vehClass++) { // Get the class name. string className = cf.GetLocalizedName($"VEH_CLASS_{vehClass.ToString()}"); // Create a button & a menu for it, add the menu to the menu pool and add & bind the button to the menu. UIMenuItem btn = new UIMenuItem(className, $"Spawn a vehicle from the ~o~{className} ~s~class."); btn.SetRightLabel("→→→"); UIMenu vehicleClassMenu = new UIMenu("Vehicle Spawner", className, true) { ScaleWithSafezone = false, MouseControlsEnabled = false, MouseEdgeEnabled = false, ControlDisablingEnabled = false }; MainMenu.Mp.Add(vehicleClassMenu); menu.AddItem(btn); if (allowedCategories[vehClass]) { menu.BindMenuToItem(vehicleClassMenu, btn); } else { btn.SetLeftBadge(UIMenuItem.BadgeStyle.Lock); btn.Description = "This category has been disabled by the server owner."; btn.Enabled = false; } // Create a dictionary for the duplicate vehicle names (in this vehicle class). var duplicateVehNames = new Dictionary <string, int>(); // Loop through all the vehicles in the vehicle class. foreach (var veh in vl.VehicleClasses[className]) { // Convert the model name to start with a Capital letter, converting the other characters to lowercase. var properCasedModelName = veh[0].ToString().ToUpper() + veh.ToLower().Substring(1); // Get the localized vehicle name, if it's "NULL" (no label found) then use the "properCasedModelName" created above. var vehName = cf.GetVehDisplayNameFromModel(veh) != "NULL" ? cf.GetVehDisplayNameFromModel(veh) : properCasedModelName; // Loop through all the menu items and check each item's title/text and see if it matches the current vehicle (display) name. var duplicate = false; for (var itemIndex = 0; itemIndex < vehicleClassMenu.MenuItems.Count; itemIndex++) { // If it matches... if (vehicleClassMenu.MenuItems[itemIndex].Text.ToString() == vehName) { // Check if the model was marked as duplicate before. if (duplicateVehNames.Keys.Contains(vehName)) { // If so, add 1 to the duplicate counter for this model name. duplicateVehNames[vehName]++; } // If this is the first duplicate, then set it to 2. else { duplicateVehNames[vehName] = 2; } // The model name is a duplicate, so get the modelname and add the duplicate amount for this model name to the end of the vehicle name. vehName += $" ({duplicateVehNames[vehName].ToString()})"; // Then create and add a new button for this vehicle. if (cf.DoesModelExist(veh)) { var vehBtn = new UIMenuItem(vehName) { Enabled = true }; vehicleClassMenu.AddItem(vehBtn); } else { var vehBtn = new UIMenuItem(vehName, "This vehicle is not available because the model could not be found in your game files. If this is a DLC vehicle, make sure the server is streaming it.") { Enabled = false }; vehicleClassMenu.AddItem(vehBtn); vehBtn.SetRightBadge(UIMenuItem.BadgeStyle.Lock); } // Mark duplicate as true and break from the loop because we already found the duplicate. duplicate = true; break; } } // If it's not a duplicate, add the model name. if (!duplicate) { if (cf.DoesModelExist(veh)) { var vehBtn = new UIMenuItem(vehName) { Enabled = true }; vehicleClassMenu.AddItem(vehBtn); } else { var vehBtn = new UIMenuItem(vehName, "This vehicle is not available because the model could not be found in your game files. If this is a DLC vehicle, make sure the server is streaming it.") { Enabled = false }; vehicleClassMenu.AddItem(vehBtn); vehBtn.SetRightBadge(UIMenuItem.BadgeStyle.Lock); } } } vehicleClassMenu.OnItemSelect += (sender2, item2, index2) => { cf.SpawnVehicle(vl.VehicleClasses[className][index2], SpawnInVehicle, ReplaceVehicle); }; } // Handle button presses. menu.OnItemSelect += (sender, item, index) => { if (item == spawnByName) { // Passing "custom" as the vehicle name, will ask the user for input. cf.SpawnVehicle("custom", SpawnInVehicle, ReplaceVehicle); } }; // Handle checkbox changes. menu.OnCheckboxChange += (sender, item, _checked) => { if (item == spawnInVeh) { SpawnInVehicle = _checked; } else if (item == replacePrev) { ReplaceVehicle = _checked; } }; }
/// <summary> /// Creates all the submenus depending on the permissions of the user. /// </summary> private void CreateSubmenus() { // Add the online players menu. if (Cf.IsAllowed(Permission.OPMenu)) { OnlinePlayersMenu = new OnlinePlayers(); UIMenu menu = OnlinePlayersMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Online Players", "All currently connected players."); button.SetRightLabel("→→→"); AddMenu(menu, button); Menu.OnItemSelect += (sender, item, index) => { if (item == button) { OnlinePlayersMenu.UpdatePlayerlist(); menu.RefreshIndex(); menu.UpdateScaleform(); } }; } if (Cf.IsAllowed(Permission.OPUnban)) { //TriggerServerEvent("vMenu:RequestBanList", PlayerId()); BannedPlayersMenu = new BannedPlayers(); UIMenu menu = BannedPlayersMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Banned Players", "View and manage all banned players in this menu."); button.SetRightLabel("→→→"); AddMenu(menu, button); Menu.OnItemSelect += (sender, item, index) => { if (item == button) { TriggerServerEvent("vMenu:RequestBanList", PlayerId()); menu.RefreshIndex(); menu.UpdateScaleform(); } }; } // Add the player options menu. if (Cf.IsAllowed(Permission.POMenu)) { PlayerOptionsMenu = new PlayerOptions(); UIMenu menu = PlayerOptionsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Player Options", "Common player options can be accessed here."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add the vehicle options Menu. if (Cf.IsAllowed(Permission.VOMenu)) { VehicleOptionsMenu = new VehicleOptions(); UIMenu menu = VehicleOptionsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Vehicle Options", "Here you can change common vehicle options, as well as tune & style your vehicle."); button.SetRightLabel("→→→"); AddMenu(menu, button); } var vl = new Vehicles().VehicleClasses; // Add the vehicle spawner menu. if (Cf.IsAllowed(Permission.VSMenu)) { VehicleSpawnerMenu = new VehicleSpawner(); UIMenu menu = VehicleSpawnerMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Vehicle Spawner", "Spawn a vehicle by name or choose one from a specific category."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add Saved Vehicles menu. if (Cf.IsAllowed(Permission.SVMenu)) { SavedVehiclesMenu = new SavedVehicles(); UIMenu menu = SavedVehiclesMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Saved Vehicles", "Save new vehicles, or spawn or delete already saved vehicles."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add the player appearance menu. if (Cf.IsAllowed(Permission.PAMenu)) { PlayerAppearanceMenu = new PlayerAppearance(); UIMenu menu = PlayerAppearanceMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Player Appearance", "Choose a ped model, customize it and save & load your customized characters."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add the time options menu. // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever. if (Cf.IsAllowed(Permission.TOMenu) && GetSettingsBool(Setting.vmenu_enable_time_sync)) { TimeOptionsMenu = new TimeOptions(); UIMenu menu = TimeOptionsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Time Options", "Change the time, and edit other time related options."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add the weather options menu. // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever. if (Cf.IsAllowed(Permission.WOMenu) && GetSettingsBool(Setting.vmenu_enable_weather_sync)) { WeatherOptionsMenu = new WeatherOptions(); UIMenu menu = WeatherOptionsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Weather Options", "Change all weather related options here."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add the weapons menu. if (Cf.IsAllowed(Permission.WPMenu)) { WeaponOptionsMenu = new WeaponOptions(); UIMenu menu = WeaponOptionsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Weapon Options", "Add/remove weapons, modify weapons and set ammo options."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add Voice Chat Menu. if (Cf.IsAllowed(Permission.VCMenu)) { VoiceChatSettingsMenu = new VoiceChat(); UIMenu menu = VoiceChatSettingsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Voice Chat Settings", "Change Voice Chat options here."); button.SetRightLabel("→→→"); AddMenu(menu, button); } { RecordingMenu = new Recording(); UIMenu menu = RecordingMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Recording Options", "In-game recording options."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add misc settings menu. //if (Cf.IsAllowed(Permission.MSMenu)) // removed the permissions check, because the misc menu should've never been restricted in the first place. // not sure why I even added this before... saving of preferences and similar functions should always be allowed. // no matter what. { MiscSettingsMenu = new MiscSettings(); UIMenu menu = MiscSettingsMenu.GetMenu(); UIMenuItem button = new UIMenuItem("Misc Settings", "Miscellaneous vMenu options/settings can be configured here. You can also save your settings in this menu."); button.SetRightLabel("→→→"); AddMenu(menu, button); } // Add About Menu. AboutMenu = new About(); UIMenu sub = AboutMenu.GetMenu(); UIMenuItem btn = new UIMenuItem("About vMenu", "Information about vMenu."); btn.SetRightLabel("→→→"); AddMenu(sub, btn); // Refresh everything. Mp.RefreshIndex(); Menu.UpdateScaleform(); // Globally disable the native ui controls disabling. Mp.ControlDisablingEnabled = false; // Globally disable the "mouse edge" feature. Mp.MouseEdgeEnabled = false; if (!GetSettingsBool(Setting.vmenu_use_permissions)) { Notify.Info("vMenu is set up to ignore permissions."); } }
/// <summary> /// Creates all the submenus depending on the permissions of the user. /// </summary> private void CreateSubmenus() { // Add the online players menu. if (IsAllowed(Permission.OPMenu)) { OnlinePlayersMenu = new OnlinePlayers(); Menu menu = OnlinePlayersMenu.GetMenu(); MenuItem button = new MenuItem("Online Players", "All currently connected players.") { Label = "→→→" }; AddMenu(menu, button); Menu.OnItemSelect += (sender, item, index) => { if (item == button) { OnlinePlayersMenu.UpdatePlayerlist(); menu.RefreshIndex(); //menu.UpdateScaleform(); } }; } if (IsAllowed(Permission.OPUnban) || IsAllowed(Permission.OPViewBannedPlayers)) { BannedPlayersMenu = new BannedPlayers(); Menu menu = BannedPlayersMenu.GetMenu(); MenuItem button = new MenuItem("Banned Players", "View and manage all banned players in this menu.") { Label = "→→→" }; AddMenu(menu, button); Menu.OnItemSelect += (sender, item, index) => { if (item == button) { TriggerServerEvent("vMenu:RequestBanList", Game.Player.Handle); menu.RefreshIndex(); //menu.UpdateScaleform(); } }; } // Add the player options menu. if (IsAllowed(Permission.POMenu)) { PlayerOptionsMenu = new PlayerOptions(); Menu menu = PlayerOptionsMenu.GetMenu(); MenuItem button = new MenuItem("Player Options", "Common player options can be accessed here.") { Label = "→→→" }; AddMenu(menu, button); } // Add the vehicle options Menu. if (IsAllowed(Permission.VOMenu)) { VehicleOptionsMenu = new VehicleOptions(); Menu menu = VehicleOptionsMenu.GetMenu(); MenuItem button = new MenuItem("Vehicle Options", "Here you can change common vehicle options, as well as tune & style your vehicle.") { Label = "→→→" }; AddMenu(menu, button); } var vl = new Vehicles().VehicleClasses; // Add the vehicle spawner menu. if (IsAllowed(Permission.VSMenu)) { VehicleSpawnerMenu = new VehicleSpawner(); Menu menu = VehicleSpawnerMenu.GetMenu(); MenuItem button = new MenuItem("Vehicle Spawner", "Spawn a vehicle by name or choose one from a specific category.") { Label = "→→→" }; AddMenu(menu, button); } // Add Saved Vehicles menu. if (IsAllowed(Permission.SVMenu)) { SavedVehiclesMenu = new SavedVehicles(); Menu menu = SavedVehiclesMenu.GetMenu(); MenuItem button = new MenuItem("Saved Vehicles", "Save new vehicles, or spawn or delete already saved vehicles.") { Label = "→→→" }; AddMenu(menu, button); Menu.OnItemSelect += (sender, item, index) => { if (item == button) { SavedVehiclesMenu.UpdateMenuAvailableCategories(); } }; } // Add the Personal Vehicle menu. if (IsAllowed(Permission.PVMenu)) { PersonalVehicleMenu = new PersonalVehicle(); Menu menu = PersonalVehicleMenu.GetMenu(); MenuItem button = new MenuItem("Personal Vehicle", "Set a vehicle as your personal vehicle, and control some things about that vehicle when you're not inside.") { Label = "→→→" }; AddMenu(menu, button); } // Add the player appearance menu. if (IsAllowed(Permission.PAMenu)) { PlayerAppearanceMenu = new PlayerAppearance(); Menu menu = PlayerAppearanceMenu.GetMenu(); MenuItem button = new MenuItem("Player Appearance", "Choose a ped model, customize it and save & load your customized characters.") { Label = "→→→" }; AddMenu(menu, button); MpPedCustomizationMenu = new MpPedCustomization(); Menu menu2 = MpPedCustomizationMenu.GetMenu(); MenuItem button2 = new MenuItem("MP Ped Customization", "Create, edit, save and load multiplayer peds. ~r~Note, you can only save peds created in this submenu. vMenu can NOT detect peds created outside of this submenu. Simply due to GTA limitations.") { Label = "→→→" }; AddMenu(menu2, button2); } // Add the time options menu. // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever. if (IsAllowed(Permission.TOMenu) && GetSettingsBool(Setting.vmenu_enable_time_sync)) { TimeOptionsMenu = new TimeOptions(); Menu menu = TimeOptionsMenu.GetMenu(); MenuItem button = new MenuItem("Time Options", "Change the time, and edit other time related options.") { Label = "→→→" }; AddMenu(menu, button); } // Add the weather options menu. // check for 'not true' to make sure that it _ONLY_ gets disabled if the owner _REALLY_ wants it disabled, not if they accidentally spelled "false" wrong or whatever. if (IsAllowed(Permission.WOMenu) && GetSettingsBool(Setting.vmenu_enable_weather_sync)) { WeatherOptionsMenu = new WeatherOptions(); Menu menu = WeatherOptionsMenu.GetMenu(); MenuItem button = new MenuItem("Weather Options", "Change all weather related options here.") { Label = "→→→" }; AddMenu(menu, button); } // Add the weapons menu. if (IsAllowed(Permission.WPMenu)) { WeaponOptionsMenu = new WeaponOptions(); Menu menu = WeaponOptionsMenu.GetMenu(); MenuItem button = new MenuItem("Weapon Options", "Add/remove weapons, modify weapons and set ammo options.") { Label = "→→→" }; AddMenu(menu, button); } // Add Weapon Loadouts menu. if (IsAllowed(Permission.WLMenu)) { WeaponLoadoutsMenu = new WeaponLoadouts(); Menu menu = WeaponLoadoutsMenu.GetMenu(); MenuItem button = new MenuItem("Weapon Loadouts", "Mange, and spawn saved weapon loadouts.") { Label = "→→→" }; AddMenu(menu, button); } // Add Voice Chat Menu. if (IsAllowed(Permission.VCMenu)) { VoiceChatSettingsMenu = new VoiceChat(); Menu menu = VoiceChatSettingsMenu.GetMenu(); MenuItem button = new MenuItem("Voice Chat Settings", "Change Voice Chat options here.") { Label = "→→→" }; AddMenu(menu, button); } { RecordingMenu = new Recording(); Menu menu = RecordingMenu.GetMenu(); MenuItem button = new MenuItem("Recording Options", "In-game recording options.") { Label = "→→→" }; AddMenu(menu, button); } // Add misc settings menu. //if (CommonFunctions.IsAllowed(Permission.MSMenu)) // removed the permissions check, because the misc menu should've never been restricted in the first place. // not sure why I even added this before... saving of preferences and similar functions should always be allowed. // no matter what. { MiscSettingsMenu = new MiscSettings(); Menu menu = MiscSettingsMenu.GetMenu(); MenuItem button = new MenuItem("Misc Settings", "Miscellaneous vMenu options/settings can be configured here. You can also save your settings in this menu.") { Label = "→→→" }; AddMenu(menu, button); } // Add About Menu. AboutMenu = new About(); Menu sub = AboutMenu.GetMenu(); MenuItem btn = new MenuItem("About vMenu", "Information about vMenu.") { Label = "→→→" }; AddMenu(sub, btn); // Refresh everything. MenuController.Menus.ForEach((m) => m.RefreshIndex()); if (!GetSettingsBool(Setting.vmenu_use_permissions)) { Notify.Alert("vMenu is set up to ignore permissions, default permissions will be used."); } }