/// <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, menu, button); Menu.OnItemSelect += (sender, item, index) => { if (item == button) { OnlinePlayersMenu.UpdatePlayerlist(); menu.RefreshIndex(); } }; } 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, menu, button); Menu.OnItemSelect += (sender, item, index) => { if (item == button) { TriggerServerEvent("vMenu:RequestBanList", Game.Player.Handle); menu.RefreshIndex(); } }; } MenuItem playerSubmenuBtn = new MenuItem("Player Related Options", "Open this submenu for player related subcategories.") { Label = "→→→" }; Menu.AddMenuItem(playerSubmenuBtn); // 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(PlayerSubmenu, menu, button); } MenuItem vehicleSubmenuBtn = new MenuItem("Vehicle Related Options", "Open this submenu for vehicle related subcategories.") { Label = "→→→" }; Menu.AddMenuItem(vehicleSubmenuBtn); // 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(VehicleSubmenu, menu, button); } // 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(VehicleSubmenu, 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(VehicleSubmenu, menu, button); VehicleSubmenu.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(VehicleSubmenu, 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(PlayerSubmenu, 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(PlayerSubmenu, menu2, button2); } MenuItem worldSubmenuBtn = new MenuItem("World Related Options", "Open this submenu for world related subcategories.") { Label = "→→→" }; Menu.AddMenuItem(worldSubmenuBtn); // 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(WorldSubmenu, menu, button); } // Patched by dotexe for client-side time & weather { PlayerTimeWeatherOptionsMenu = new PlayerTimeWeatherOptions(); Menu menu2 = PlayerTimeWeatherOptionsMenu.GetMenu(); MenuItem button2 = new MenuItem("Time & Weather Options", "Change all time & weather related options here.") { Label = "→→→" }; AddMenu(Menu, menu2, button2); } // 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(WorldSubmenu, 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(PlayerSubmenu, 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(PlayerSubmenu, menu, button); } if (IsAllowed(Permission.NoClip)) { MenuItem toggleNoclip = new MenuItem("Toggle NoClip", "Toggle NoClip on or off."); PlayerSubmenu.AddMenuItem(toggleNoclip); PlayerSubmenu.OnItemSelect += (sender, item, index) => { if (item == toggleNoclip) { NoClipEnabled = !NoClipEnabled; } }; } // 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, menu, button); } { RecordingMenu = new Recording(); Menu menu = RecordingMenu.GetMenu(); MenuItem button = new MenuItem("Recording Options", "In-game recording options.") { Label = "→→→" }; AddMenu(Menu, menu, button); } // Add misc settings menu. { MiscSettingsMenu = new MiscSettings(); Menu menu = MiscSettingsMenu.GetMenu(); MenuItem button = new MenuItem("Settings", "Various vMenu options/settings can be configured here. You can also save your settings in this menu.") { Label = "→→→" }; AddMenu(Menu, menu, button); } // Add About Menu. AboutMenu = new About(); Menu sub = AboutMenu.GetMenu(); MenuItem btn = new MenuItem("About vMenu", "Information about vMenu.") { Label = "→→→" }; AddMenu(Menu, 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."); } if (PlayerSubmenu.Size > 0) { MenuController.BindMenuItem(Menu, PlayerSubmenu, playerSubmenuBtn); } else { Menu.RemoveMenuItem(playerSubmenuBtn); } if (VehicleSubmenu.Size > 0) { MenuController.BindMenuItem(Menu, VehicleSubmenu, vehicleSubmenuBtn); } else { Menu.RemoveMenuItem(vehicleSubmenuBtn); } if (WorldSubmenu.Size > 0) { MenuController.BindMenuItem(Menu, WorldSubmenu, worldSubmenuBtn); } else { Menu.RemoveMenuItem(worldSubmenuBtn); } if (MiscSettingsMenu != null) { MenuController.EnableMenuToggleKeyOnController = !MiscSettingsMenu.MiscDisableControllerSupport; } }
/// <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."); button.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."); button.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."); button.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."); button.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."); button.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."); button.Label = "→→→"; AddMenu(menu, button); Menu.OnItemSelect += (sender, item, index) => { if (item == button) { SavedVehiclesMenu.UpdateMenuAvailableCategories(); } }; } // 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."); button.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."); button2.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."); button.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."); button.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."); button.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."); button.Label = "→→→"; AddMenu(menu, button); } { RecordingMenu = new Recording(); Menu menu = RecordingMenu.GetMenu(); MenuItem button = new MenuItem("Recording Options", "In-game recording options."); button.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."); button.Label = "→→→"; AddMenu(menu, button); } // Add About Menu. AboutMenu = new About(); Menu sub = AboutMenu.GetMenu(); MenuItem btn = new MenuItem("About vMenu", "Information about vMenu."); btn.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."); } }