/// <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(); } }; } // 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; }
/// <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."); } }