Ejemplo n.º 1
0
        /// <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.");
            }
        }