From 48703ea2f6277e303cb374e0d9b8ea9ecc337af2 Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Tue, 6 Mar 2018 23:11:14 +0100 Subject: [PATCH 01/21] Everything now has permissions support built in --- vMenu/CommonFunctions.cs | 4 +- vMenu/menus/MiscSettings.cs | 30 +++++++-- vMenu/menus/PlayerAppearance.cs | 37 ++++++++++- vMenu/menus/SavedVehicles.cs | 11 +++- vMenu/menus/TimeOptions.cs | 37 +++++++---- vMenu/menus/VehicleSpawner.cs | 5 +- vMenu/menus/VoiceChat.cs | 17 ++++-- vMenu/menus/WeatherOptions.cs | 98 ++++++++++++++++++------------ vMenuServer/config/permissions.cfg | 90 ++++++++++++++------------- 9 files changed, 219 insertions(+), 110 deletions(-) diff --git a/vMenu/CommonFunctions.cs b/vMenu/CommonFunctions.cs index 85053d7b..28b52776 100644 --- a/vMenu/CommonFunctions.cs +++ b/vMenu/CommonFunctions.cs @@ -1029,10 +1029,10 @@ public string ToProperString(string inputString) /// /// /// - public bool IsAllowed(Permission perm) + public bool IsAllowed(Permission permission) { // Get the permissions. - return PermissionsManager.IsAllowed(perm); + return PermissionsManager.IsAllowed(permission); } #endregion diff --git a/vMenu/menus/MiscSettings.cs b/vMenu/menus/MiscSettings.cs index 02ab422f..e400dffd 100644 --- a/vMenu/menus/MiscSettings.cs +++ b/vMenu/menus/MiscSettings.cs @@ -54,15 +54,35 @@ private void CreateMenu() UIMenuCheckboxItem deathNotifs = new UIMenuCheckboxItem("Death Notifications", DeathNotifications, "Receive notifications when someone dies or gets killed."); // Add menu items to the menu. - menu.AddItem(tptowp); + if (cf.IsAllowed(Permission.MSTeleportToWp)) + { + menu.AddItem(tptowp); + } + + // Always allowed menu.AddItem(speedKmh); menu.AddItem(speedMph); - menu.AddItem(coords); + + if (cf.IsAllowed(Permission.MSShowCoordinates)) + { + menu.AddItem(coords); + } + if (cf.IsAllowed(Permission.MSShowLocation)) + { + menu.AddItem(showLocation); + } + if (cf.IsAllowed(Permission.MSJoinQuitNotifs)) + { + menu.AddItem(deathNotifs); + } + if (cf.IsAllowed(Permission.MSDeathNotifs)) + { + menu.AddItem(joinQuitNotifs); + } + + // Always allowed menu.AddItem(hideRadar); menu.AddItem(hideHud); - menu.AddItem(showLocation); - menu.AddItem(joinQuitNotifs); - menu.AddItem(deathNotifs); menu.AddItem(saveSettings); // Handle checkbox changes. diff --git a/vMenu/menus/PlayerAppearance.cs b/vMenu/menus/PlayerAppearance.cs index 8f8a5757..27a7691e 100644 --- a/vMenu/menus/PlayerAppearance.cs +++ b/vMenu/menus/PlayerAppearance.cs @@ -83,8 +83,29 @@ private void CreateMenu() menu.AddItem(deleteSavedPed); // Bind items to the submenus. - menu.BindMenuToItem(pedTextures, pedCustomization); - menu.BindMenuToItem(spawnSavedPedMenu, spawnSavedPed); + if (cf.IsAllowed(Permission.PACustomize)) + { + menu.BindMenuToItem(pedTextures, pedCustomization); + } + else + { + pedCustomization.Enabled = false; + pedCustomization.SetLeftBadge(UIMenuItem.BadgeStyle.Lock); + pedCustomization.Description = "This option has been disabled by the server owner."; + } + + + if (cf.IsAllowed(Permission.PASpawnSaved)) + { + menu.BindMenuToItem(spawnSavedPedMenu, spawnSavedPed); + } + else + { + spawnSavedPed.Enabled = false; + spawnSavedPed.SetLeftBadge(UIMenuItem.BadgeStyle.Lock); + spawnSavedPed.Description = "This option has been disabled by the server owner."; + } + menu.BindMenuToItem(deleteSavedPedMenu, deleteSavedPed); // Handle button presses. @@ -123,7 +144,14 @@ private void CreateMenu() pedList.Add(modelNames[index] + $" ({(ii + 1).ToString()}/{max.ToString()})"); } UIMenuListItem pedl = new UIMenuListItem("Peds #" + (i + 1).ToString(), pedList, 0); + menu.AddItem(pedl); + if (!cf.IsAllowed(Permission.PASpawnNew)) + { + pedl.Enabled = false; + pedl.SetLeftBadge(UIMenuItem.BadgeStyle.Lock); + pedl.Description = "This option has been disabled by the server owner."; + } } // Handle list selections. @@ -131,7 +159,10 @@ private void CreateMenu() { int i = ((sender.CurrentSelection - 4) * 50) + index; string modelName = modelNames[i]; - cf.SetPlayerSkin(modelName); + if (cf.IsAllowed(Permission.PASpawnNew)) + { + cf.SetPlayerSkin(modelName); + } }; } diff --git a/vMenu/menus/SavedVehicles.cs b/vMenu/menus/SavedVehicles.cs index 2727429b..897b5c71 100644 --- a/vMenu/menus/SavedVehicles.cs +++ b/vMenu/menus/SavedVehicles.cs @@ -67,7 +67,16 @@ private void CreateMenu() menu.AddItem(deleteSavedVehiclesBtn); // Bind submenus to menu items. - menu.BindMenuToItem(savedVehicles, savedVehiclesBtn); + if (cf.IsAllowed(Permission.SVSpawn)) + { + menu.BindMenuToItem(savedVehicles, savedVehiclesBtn); + } + else + { + savedVehiclesBtn.Enabled = false; + savedVehiclesBtn.SetLeftBadge(UIMenuItem.BadgeStyle.Lock); + savedVehiclesBtn.Description = "This option has been disabled by the server owner."; + } menu.BindMenuToItem(deleteSavedVehicles, deleteSavedVehiclesBtn); #endregion diff --git a/vMenu/menus/TimeOptions.cs b/vMenu/menus/TimeOptions.cs index 93226f0c..3c77930b 100644 --- a/vMenu/menus/TimeOptions.cs +++ b/vMenu/menus/TimeOptions.cs @@ -52,16 +52,22 @@ private void CreateMenu() night.SetRightLabel("03:00"); // Add all menu items to the menu. - menu.AddItem(freezeTimeToggle); - menu.AddItem(earlymorning); - menu.AddItem(morning); - menu.AddItem(noon); - menu.AddItem(earlyafternoon); - menu.AddItem(afternoon); - menu.AddItem(evening); - menu.AddItem(midnight); - menu.AddItem(night); - + if (cf.IsAllowed(Permission.TOFreezeTime)) + { + menu.AddItem(freezeTimeToggle); + } + if (cf.IsAllowed(Permission.TOSetTime)) + { + menu.AddItem(earlymorning); + menu.AddItem(morning); + menu.AddItem(noon); + menu.AddItem(earlyafternoon); + menu.AddItem(afternoon); + menu.AddItem(evening); + menu.AddItem(midnight); + menu.AddItem(night); + } + // Handle button presses. menu.OnItemSelect += (sender, item, index) => { @@ -76,7 +82,16 @@ private void CreateMenu() // Set the time using the index and some math :) // eg: index = 3 (12:00) ---> 3 * 3 (=9) + 3 [= 12] ---> 12:00 // eg: index = 8 (03:00) ---> 8 * 3 (=24) + 3 (=27, >23 so 27-24) [=3] ---> 03:00 - var newHour = (((index * 3) + 3 < 23) ? (index * 3) + 3 : ((index * 3) + 3) - 24); + var newHour = 0; + if (cf.IsAllowed(Permission.TOFreezeTime)) + { + newHour = (((index * 3) + 3 < 23) ? (index * 3) + 3 : ((index * 3) + 3) - 24); + } + else + { + newHour = ((((index + 1) * 3) + 3 < 23) ? ((index + 1) * 3) + 3 : (((index + 1) * 3) + 3) - 24); + } + var newMinute = 0; Subtitle.Info($"Time set to ~y~{(newHour < 10 ? $"0{newHour.ToString()}" : newHour.ToString())}~w~:~y~" + $"{(newMinute < 10 ? $"0{newMinute.ToString()}" : newMinute.ToString())}~w~.", prefix: "Info:"); diff --git a/vMenu/menus/VehicleSpawner.cs b/vMenu/menus/VehicleSpawner.cs index 9042c2a0..5c702584 100644 --- a/vMenu/menus/VehicleSpawner.cs +++ b/vMenu/menus/VehicleSpawner.cs @@ -67,7 +67,10 @@ private void CreateMenu() "This will automatically delete your previously spawned vehicle when you spawn a new vehicle."); // Add the items to the menu. - menu.AddItem(spawnByName); + if (cf.IsAllowed(Permission.VSSpawnByName)) + { + menu.AddItem(spawnByName); + } menu.AddItem(spawnInVeh); menu.AddItem(replacePrev); diff --git a/vMenu/menus/VoiceChat.cs b/vMenu/menus/VoiceChat.cs index 64c5d14f..d777a075 100644 --- a/vMenu/menus/VoiceChat.cs +++ b/vMenu/menus/VoiceChat.cs @@ -77,10 +77,19 @@ private void CreateMenu() UIMenuListItem voiceChatProximity = new UIMenuListItem("Voice Chat Proximity", proximity, proximityRange.IndexOf(currentProximity), "Set the voice chat receiving proximity in meters."); UIMenuListItem voiceChatChannel = new UIMenuListItem("Voice Chat Channel", channels, channels.IndexOf(currentChannel), "Set the voice chat channel."); - menu.AddItem(voiceChatEnabled); - menu.AddItem(showCurrentSpeaker); - menu.AddItem(voiceChatProximity); - menu.AddItem(voiceChatChannel); + if (cf.IsAllowed(Permission.VCEnable)) + { + menu.AddItem(voiceChatEnabled); + + // Nested permissions because without voice chat enabled, you wouldn't be able to use these settings anyway. + if (cf.IsAllowed(Permission.VCShowSpeaker)) + { + menu.AddItem(showCurrentSpeaker); + } + + menu.AddItem(voiceChatProximity); + menu.AddItem(voiceChatChannel); + } menu.OnCheckboxChange += (sender, item, _checked) => { diff --git a/vMenu/menus/WeatherOptions.cs b/vMenu/menus/WeatherOptions.cs index de07d7de..8df7b98d 100644 --- a/vMenu/menus/WeatherOptions.cs +++ b/vMenu/menus/WeatherOptions.cs @@ -50,25 +50,44 @@ private void CreateMenu() UIMenuItem removeclouds = new UIMenuItem("Remove All Clouds", "Remove all clouds from the sky!"); UIMenuItem randomizeclouds = new UIMenuItem("Randomize Clouds", "Add random clouds to the sky!"); - menu.AddItem(dynamicWeatherEnabled); - menu.AddItem(blackout); - menu.AddItem(extrasunny); - menu.AddItem(clear); - menu.AddItem(neutral); - menu.AddItem(smog); - menu.AddItem(foggy); - menu.AddItem(clouds); - menu.AddItem(overcast); - menu.AddItem(clearing); - menu.AddItem(rain); - menu.AddItem(thunder); - menu.AddItem(blizzard); - menu.AddItem(snow); - menu.AddItem(snowlight); - menu.AddItem(xmas); - menu.AddItem(halloween); - menu.AddItem(removeclouds); - menu.AddItem(randomizeclouds); + var indexOffset = 2; + if (cf.IsAllowed(Permission.WODynamic)) + { + menu.AddItem(dynamicWeatherEnabled); + indexOffset--; + } + if (cf.IsAllowed(Permission.WOBlackout)) + { + menu.AddItem(blackout); + indexOffset--; + } + if (cf.IsAllowed(Permission.WOSetWeather)) + { + menu.AddItem(extrasunny); + menu.AddItem(clear); + menu.AddItem(neutral); + menu.AddItem(smog); + menu.AddItem(foggy); + menu.AddItem(clouds); + menu.AddItem(overcast); + menu.AddItem(clearing); + menu.AddItem(rain); + menu.AddItem(thunder); + menu.AddItem(blizzard); + menu.AddItem(snow); + menu.AddItem(snowlight); + menu.AddItem(xmas); + menu.AddItem(halloween); + } + if (cf.IsAllowed(Permission.WORandomizeClouds)) + { + menu.AddItem(removeclouds); + } + + if (cf.IsAllowed(Permission.WORemoveClouds)) + { + menu.AddItem(randomizeclouds); + } List weatherTypes = new List() { @@ -89,36 +108,35 @@ private void CreateMenu() "HALLOWEEN" }; - menu.OnItemSelect += (sender, item, index) => + menu.OnItemSelect += (sender, item, index2) => { + var index = index2 + indexOffset; // A weather type is selected. if (index >= 2 && index <= 16) { Notify.Custom($"The almighty ~g~Snail~w~ will change the weather to ~y~{weatherTypes[index - 2]}~w~."); cf.UpdateServerWeather(weatherTypes[index - 2], EventManager.blackoutMode, EventManager.dynamicWeather); } - // Another button was pressed. - else + + if (item == blackout) { - if (item == blackout) - { - Notify.Custom($"The almighty ~g~Snail~w~ will ~y~{(!EventManager.blackoutMode ? "enable" : "disable")}~w~ blackout mode."); - cf.UpdateServerWeather(EventManager.currentWeatherType, !EventManager.blackoutMode, EventManager.dynamicWeather); - } - else if (item == dynamicWeatherEnabled) - { - Notify.Custom($"The almighty ~g~Snail~w~ will ~y~{(!EventManager.dynamicWeather ? "enable" : "disable")}~w~ dynamic weather changes."); - cf.UpdateServerWeather(EventManager.currentWeatherType, EventManager.blackoutMode, !EventManager.dynamicWeather); - } - else if (item == removeclouds) - { - cf.ModifyClouds(true); - } - else if (item == randomizeclouds) - { - cf.ModifyClouds(false); - } + Notify.Custom($"The almighty ~g~Snail~w~ will ~y~{(!EventManager.blackoutMode ? "enable" : "disable")}~w~ blackout mode."); + cf.UpdateServerWeather(EventManager.currentWeatherType, !EventManager.blackoutMode, EventManager.dynamicWeather); } + else if (item == dynamicWeatherEnabled) + { + Notify.Custom($"The almighty ~g~Snail~w~ will ~y~{(!EventManager.dynamicWeather ? "enable" : "disable")}~w~ dynamic weather changes."); + cf.UpdateServerWeather(EventManager.currentWeatherType, EventManager.blackoutMode, !EventManager.dynamicWeather); + } + else if (item == removeclouds) + { + cf.ModifyClouds(true); + } + else if (item == randomizeclouds) + { + cf.ModifyClouds(false); + } + }; } diff --git a/vMenuServer/config/permissions.cfg b/vMenuServer/config/permissions.cfg index 9fbc9e7e..c4d5fcac 100644 --- a/vMenuServer/config/permissions.cfg +++ b/vMenuServer/config/permissions.cfg @@ -1,14 +1,12 @@ -#################################################################################################### -# This is the default permissions file used by vMenu. # -# Example groups include: moderator, admin # -# You can add your own groups or use the example groups and add players to those groups # -# The add permissions to "builtin.everyone" to allow anyone to use those features. # -# If you add permissions like this: "vMenu.onlinePlayers.*" that means that ALL options in the # -# "Online Players" menu will be available, regardless of any other permissions you set after that. # -# # -# FOR A LIST OF ALL PERMISSIONS, CHECK https://github.com/TomGrobbe/vMenu/wiki/permissions # -# # -#################################################################################################### +############################################################################################# +# This is the default permissions file used by vMenu. # +# Example groups include: moderator, admin # +# You can add your own groups or use the example groups and add players to those groups # +# The add permissions to "builtin.everyone" to allow anyone to use those features. # +# # +# FOR A LIST OF ALL PERMISSIONS, CHECK https://github.com/TomGrobbe/vMenu/wiki/permissions # +############################################################################################# + ######## Groups inheritance setup ######## @@ -18,30 +16,35 @@ add_principal group.admin group.moderator ######## Add players to groups ######## # Admin group players: -add_principal identifier.steam:110000105959047 group.admin - +#add_principal identifier.steam:110000105959047 group.admin # Moderator group players: -add_principal identifier.license:4510587c13e0b645eb8d24bc104601792277ab98 group.moderator +#add_principal identifier.license:4510587c13e0b645eb8d24bc104601792277ab98 group.moderator + + + +## Setup Permissions # Global -#add_ace builtin.everyone "vMenu.Everything" allow -add_ace builtin.everyone "vMenu.DontKickMe" allow +add_ace builtin.everyone "vMenu.Everything" deny # (Don't set this to allow, or bad things will happen) +# Admins can't be kicked from the server, everyone else can be kicked though. +add_ace group.admin "vMenu.DontKickMe" allow # Online Players add_ace builtin.everyone "vMenu.OnlinePlayers.Menu" allow -#add_ace builtin.everyone "vMenu.OnlinePlayers.All" allow +add_ace builtin.everyone "vMenu.OnlinePlayers.All" deny add_ace builtin.everyone "vMenu.OnlinePlayers.Teleport" allow add_ace builtin.everyone "vMenu.OnlinePlayers.Waypoint" allow add_ace builtin.everyone "vMenu.OnlinePlayers.Spectate" allow -add_ace builtin.everyone "vMenu.OnlinePlayers.Summon" allow -add_ace builtin.everyone "vMenu.OnlinePlayers.Kill" allow -add_ace builtin.everyone "vMenu.OnlinePlayers.Kick" allow +# only allow moderators + admins to use these: +add_ace group.moderator "vMenu.OnlinePlayers.Summon" allow +add_ace group.moderator "vMenu.OnlinePlayers.Kill" allow +add_ace group.moderator "vMenu.OnlinePlayers.Kick" allow # Player Options add_ace builtin.everyone "vMenu.PlayerOptions.Menu" allow -#add_ace builtin.everyone "vMenu.PlayerOptions.All" allow +add_ace builtin.everyone "vMenu.PlayerOptions.All" deny add_ace builtin.everyone "vMenu.PlayerOptions.God" allow add_ace builtin.everyone "vMenu.PlayerOptions.Invisible" allow add_ace builtin.everyone "vMenu.PlayerOptions.FastRun" allow @@ -57,7 +60,7 @@ add_ace builtin.everyone "vMenu.PlayerOptions.Scenarios" allow # Vehicle Options add_ace builtin.everyone "vMenu.VehicleOptions.Menu" allow -#add_ace builtin.everyone "vMenu.VehicleOptions.All" allow +add_ace builtin.everyone "vMenu.VehicleOptions.All" deny add_ace builtin.everyone "vMenu.VehicleOptions.God" allow add_ace builtin.everyone "vMenu.VehicleOptions.Repair" allow add_ace builtin.everyone "vMenu.VehicleOptions.Wash" allow @@ -83,7 +86,7 @@ add_ace builtin.everyone "vMenu.VehicleOptions.Delete" allow # Vehicle Spawner add_ace builtin.everyone "vMenu.VehicleSpawner.Menu" allow -#add_ace builtin.everyone "vMenu.VehicleSpawner.All" allow +add_ace builtin.everyone "vMenu.VehicleSpawner.All" deny add_ace builtin.everyone "vMenu.VehicleSpawner.SpawnByName" allow add_ace builtin.everyone "vMenu.VehicleSpawner.Compacts" allow add_ace builtin.everyone "vMenu.VehicleSpawner.Sedans" allow @@ -110,34 +113,34 @@ add_ace builtin.everyone "vMenu.VehicleSpawner.Trains" allow # Saved Vehicles add_ace builtin.everyone "vMenu.SavedVehicles.Menu" allow -#add_ace builtin.everyone "vMenu.SavedVehicles.All" allow +add_ace builtin.everyone "vMenu.SavedVehicles.All" deny add_ace builtin.everyone "vMenu.SavedVehicles.Spawn" allow # Player Appearance add_ace builtin.everyone "vMenu.PlayerAppearance.Menu" allow -#add_ace builtin.everyone "vMenu.PlayerAppearance.All" allow +add_ace builtin.everyone "vMenu.PlayerAppearance.All" deny add_ace builtin.everyone "vMenu.PlayerAppearance.Customize" allow add_ace builtin.everyone "vMenu.PlayerAppearance.SpawnSaved" allow add_ace builtin.everyone "vMenu.PlayerAppearance.SpawnNew" allow -# Time Options -add_ace builtin.everyone "vMenu.TimeOptions.Menu" allow -#add_ace builtin.everyone "vMenu.TimeOptions.All" allow -add_ace builtin.everyone "vMenu.TimeOptions.FreezeTime" allow -add_ace builtin.everyone "vMenu.TimeOptions.SetTime" allow - -# Weather Options -add_ace builtin.everyone "vMenu.WeatherOptions.Menu" allow -#add_ace builtin.everyone "vMenu.WeatherOptions.All" allow -add_ace builtin.everyone "vMenu.WeatherOptions.Dynamic" allow -add_ace builtin.everyone "vMenu.WeatherOptions.Blackout" allow -add_ace builtin.everyone "vMenu.WeatherOptions.SetWeather" allow -add_ace builtin.everyone "vMenu.WeatherOptions.RemoveClouds" allow -add_ace builtin.everyone "vMenu.WeatherOptions.RandomizeClouds" allow +# Time Options (restricted to moderators & admins only) +add_ace group.moderator "vMenu.TimeOptions.Menu" allow +add_ace builtin.everyone "vMenu.TimeOptions.All" deny +add_ace group.moderator "vMenu.TimeOptions.FreezeTime" allow +add_ace group.moderator "vMenu.TimeOptions.SetTime" allow + +# Weather Options (restricted to moderators & admins only) +add_ace group.moderator "vMenu.WeatherOptions.Menu" allow +add_ace builtin.everyone "vMenu.WeatherOptions.All" deny +add_ace group.moderator "vMenu.WeatherOptions.Dynamic" allow +add_ace group.moderator "vMenu.WeatherOptions.Blackout" allow +add_ace group.moderator "vMenu.WeatherOptions.SetWeather" allow +add_ace group.moderator "vMenu.WeatherOptions.RemoveClouds" allow +add_ace group.moderator "vMenu.WeatherOptions.RandomizeClouds" allow # Weapon Options add_ace builtin.everyone "vMenu.WeaponOptions.Menu" allow -#add_ace builtin.everyone "vMenu.WeaponOptions.All" allow +add_ace builtin.everyone "vMenu.WeaponOptions.All" deny add_ace builtin.everyone "vMenu.WeaponOptions.GetAll" allow add_ace builtin.everyone "vMenu.WeaponOptions.RemoveAll" allow add_ace builtin.everyone "vMenu.WeaponOptions.UnlimitedAmmo" allow @@ -145,7 +148,7 @@ add_ace builtin.everyone "vMenu.WeaponOptions.NoReload" allow # Misc Settings add_ace builtin.everyone "vMenu.MiscSettings.Menu" allow -#add_ace builtin.everyone "vMenu.MiscSettings.All" allow +add_ace builtin.everyone "vMenu.MiscSettings.All" deny add_ace builtin.everyone "vMenu.MiscSettings.TeleportToWp" allow add_ace builtin.everyone "vMenu.MiscSettings.ShowCoordinates" allow add_ace builtin.everyone "vMenu.MiscSettings.ShowLocation" allow @@ -154,7 +157,8 @@ add_ace builtin.everyone "vMenu.MiscSettings.DeathNotifs" allow # Voice Chat add_ace builtin.everyone "vMenu.VoiceChat.Menu" allow -#add_ace builtin.everyone "vMenu.VoiceChat.All" allow +add_ace builtin.everyone "vMenu.VoiceChat.All" deny add_ace builtin.everyone "vMenu.VoiceChat.Enable" allow add_ace builtin.everyone "vMenu.VoiceChat.ShowSpeaker" allow -add_ace builtin.everyone "vMenu.VoiceChat.StaffChannel" allow +# Restrict the voice chat to moderators and admins only +add_ace group.moderator "vMenu.VoiceChat.StaffChannel" allow From bba846ec39e6a7a500430e3b60c3c4573c9351b3 Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Tue, 6 Mar 2018 23:42:52 +0100 Subject: [PATCH 02/21] Caught unimplemented function errors --- vMenu/menus/PlayerOptions.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/vMenu/menus/PlayerOptions.cs b/vMenu/menus/PlayerOptions.cs index 34e673c5..b7516117 100644 --- a/vMenu/menus/PlayerOptions.cs +++ b/vMenu/menus/PlayerOptions.cs @@ -234,7 +234,15 @@ private void CreateMenu() } else if (IsPedInAnyVehicle(PlayerPedId(), false)) { - cf.DriveToWp(); + try + { + cf.DriveToWp(); + } + catch (NotImplementedException e) + { + Debug.Write("\n\r[vMenu] Exception: " + e.Message + "\r\n"); + Notify.Error(CommonErrors.UnknownError, placeholderValue: "This function is not implemented yet."); + } } else { @@ -245,7 +253,16 @@ private void CreateMenu() case 7: if (IsPedInAnyVehicle(PlayerPedId(), false)) { - cf.DriveWander(); + try + { + cf.DriveWander(); + } + catch (NotImplementedException e) + { + Debug.Write("\n\r[vMenu] Exception: " + e.Message + "\r\n"); + Notify.Error(CommonErrors.UnknownError, placeholderValue: "This function is not implemented yet."); + } + } else { From 6767468ef36f496192f17c76a7d8bdc8781da965 Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Tue, 6 Mar 2018 23:43:34 +0100 Subject: [PATCH 03/21] Added resource name check & exceptions The name needs to be vMenu otherwise this script won't work. The reason for this is also because we NEED it to be called vMenu so all stats are shared across all servers. --- vMenu/MainMenu.cs | 19 ++++++++++++++++++- vMenuServer/EventManager.cs | 38 +++++++++++++++++++++++++------------ 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/vMenu/MainMenu.cs b/vMenu/MainMenu.cs index b6286fb3..82871470 100644 --- a/vMenu/MainMenu.cs +++ b/vMenu/MainMenu.cs @@ -52,7 +52,24 @@ public MainMenu() { // Set discord rich precense once, allowing it to be overruled by other resources once those load. SetRichPresence($"{(DebugMode ? "Debugging" : "Enjoying")} vMenu {Version}!"); - Tick += OnTick; + if (GetCurrentResourceName() != "vMenu") + { + Exception InvalidNameException = new Exception("\r\n\r\n[vMenu] INSTALLATION ERROR!\r\nThe name of the resource is not valid. Please change the folder name from '" + GetCurrentResourceName() + "' to 'vMenu' (case sensitive) instead!\r\n\r\n\r\n"); + try + { + throw InvalidNameException; + } + catch (Exception e) + { + Debug.Write(e.Message); + } + TriggerEvent("chatMessage", "^3IMPORTANT: vMenu IS NOT SETUP CORRECTLY. PLEASE CHECK THE SERVER LOG FOR MORE INFO."); + } + else + { + Tick += OnTick; + } + } #region Set Permissions function diff --git a/vMenuServer/EventManager.cs b/vMenuServer/EventManager.cs index c16ea84f..aaf3f331 100644 --- a/vMenuServer/EventManager.cs +++ b/vMenuServer/EventManager.cs @@ -11,7 +11,6 @@ namespace vMenuServer { public class EventManager : BaseScript { - // Debug shows more information when doing certain things. Leave it off to improve performance! private bool debug = GetResourceMetadata(GetCurrentResourceName(), "server_debug_mode", 0) == "true" ? true : false; @@ -190,17 +189,32 @@ public class EventManager : BaseScript /// public EventManager() { - // Add event handlers. - EventHandlers.Add("vMenu:SummonPlayer", new Action(SummonPlayer)); - EventHandlers.Add("vMenu:KillPlayer", new Action(KillPlayer)); - EventHandlers.Add("vMenu:KickPlayer", new Action(KickPlayer)); - EventHandlers.Add("vMenu:RequestPermissions", new Action(SendPermissionsAsync)); - EventHandlers.Add("vMenu:UpdateServerWeather", new Action(UpdateWeather)); - EventHandlers.Add("vMenu:UpdateServerWeatherCloudsType", new Action(UpdateWeatherCloudsType)); - EventHandlers.Add("vMenu:UpdateServerTime", new Action(UpdateTime)); - - Tick += WeatherLoop; - Tick += TimeLoop; + if (GetCurrentResourceName() != "vMenu") + { + Exception InvalidNameException = new Exception("\r\n\r\n[vMenu] INSTALLATION ERROR!\r\nThe name of the resource is not valid. Please change the folder name from '" + GetCurrentResourceName() + "' to 'vMenu' (case sensitive) instead!\r\n\r\n\r\n"); + try + { + throw InvalidNameException; + } + catch (Exception e) + { + Debug.Write(e.Message); + } + } + else + { + // Add event handlers. + EventHandlers.Add("vMenu:SummonPlayer", new Action(SummonPlayer)); + EventHandlers.Add("vMenu:KillPlayer", new Action(KillPlayer)); + EventHandlers.Add("vMenu:KickPlayer", new Action(KickPlayer)); + EventHandlers.Add("vMenu:RequestPermissions", new Action(SendPermissionsAsync)); + EventHandlers.Add("vMenu:UpdateServerWeather", new Action(UpdateWeather)); + EventHandlers.Add("vMenu:UpdateServerWeatherCloudsType", new Action(UpdateWeatherCloudsType)); + EventHandlers.Add("vMenu:UpdateServerTime", new Action(UpdateTime)); + + Tick += WeatherLoop; + Tick += TimeLoop; + } } #endregion From a01941a0011634dafd2b2492a3c071862eb56ef2 Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 01:15:26 +0100 Subject: [PATCH 04/21] Fixed permissions issues and engine always on is now fixed --- vMenu/FunctionsController.cs | 58 ++++++++++++++++++++++-------------- vMenu/menus/WeaponOptions.cs | 8 ++++- vMenuServer/EventManager.cs | 2 +- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/vMenu/FunctionsController.cs b/vMenu/FunctionsController.cs index 08432624..a6d9864c 100644 --- a/vMenu/FunctionsController.cs +++ b/vMenu/FunctionsController.cs @@ -84,10 +84,10 @@ private async Task PlayerOptions() if (MainMenu.PlayerOptionsMenu != null) { // Manage Player God Mode - SetEntityInvincible(PlayerPedId(), MainMenu.PlayerOptionsMenu.PlayerGodMode); + SetEntityInvincible(PlayerPedId(), MainMenu.PlayerOptionsMenu.PlayerGodMode && cf.IsAllowed(Permission.POGod)); // Manage invisibility. - SetEntityVisible(PlayerPedId(), !MainMenu.PlayerOptionsMenu.PlayerInvisible, false); + SetEntityVisible(PlayerPedId(), !MainMenu.PlayerOptionsMenu.PlayerInvisible && cf.IsAllowed(Permission.POInvisible), false); // Manage Stamina if (MainMenu.PlayerOptionsMenu.PlayerStamina) @@ -96,42 +96,51 @@ private async Task PlayerOptions() } // Manage Super jump. - if (MainMenu.PlayerOptionsMenu.PlayerSuperJump) + if (MainMenu.PlayerOptionsMenu.PlayerSuperJump && cf.IsAllowed(Permission.POSuperjump)) { SetSuperJumpThisFrame(PlayerId()); } // Manage PlayerNoRagdoll - SetPedCanRagdoll(PlayerPedId(), !MainMenu.PlayerOptionsMenu.PlayerNoRagdoll); + SetPedCanRagdoll(PlayerPedId(), !MainMenu.PlayerOptionsMenu.PlayerNoRagdoll && cf.IsAllowed(Permission.PONoRagdoll)); // Fall off bike / dragged out of car. if (MainMenu.VehicleOptionsMenu != null) { - SetPedCanBeKnockedOffVehicle(PlayerPedId(), ((MainMenu.PlayerOptionsMenu.PlayerNoRagdoll || MainMenu.VehicleOptionsMenu.VehicleGodMode) ? 1 : 0)); - SetPedCanBeDraggedOut(PlayerPedId(), (MainMenu.PlayerOptionsMenu.PlayerIsIgnored || MainMenu.VehicleOptionsMenu.VehicleGodMode || MainMenu.PlayerOptionsMenu.PlayerGodMode)); - SetPedCanBeShotInVehicle(PlayerPedId(), !(MainMenu.PlayerOptionsMenu.PlayerGodMode || MainMenu.VehicleOptionsMenu.VehicleGodMode)); + SetPedCanBeKnockedOffVehicle(PlayerPedId(), (((MainMenu.PlayerOptionsMenu.PlayerNoRagdoll && cf.IsAllowed(Permission.PONoRagdoll)) + || (MainMenu.VehicleOptionsMenu.VehicleGodMode) && cf.IsAllowed(Permission.VOGod)) ? 1 : 0)); + + SetPedCanBeDraggedOut(PlayerPedId(), ((MainMenu.PlayerOptionsMenu.PlayerIsIgnored && cf.IsAllowed(Permission.POIgnored)) || + (MainMenu.VehicleOptionsMenu.VehicleGodMode && cf.IsAllowed(Permission.VOGod)) || + (MainMenu.PlayerOptionsMenu.PlayerGodMode && cf.IsAllowed(Permission.POGod)))); + + SetPedCanBeShotInVehicle(PlayerPedId(), !((MainMenu.PlayerOptionsMenu.PlayerGodMode && cf.IsAllowed(Permission.POGod)) || + (MainMenu.VehicleOptionsMenu.VehicleGodMode && cf.IsAllowed(Permission.VOGod)))); } else { - SetPedCanBeKnockedOffVehicle(PlayerPedId(), ((MainMenu.PlayerOptionsMenu.PlayerNoRagdoll) ? 1 : 0)); - SetPedCanBeDraggedOut(PlayerPedId(), (MainMenu.PlayerOptionsMenu.PlayerIsIgnored)); - SetPedCanBeShotInVehicle(PlayerPedId(), !(MainMenu.PlayerOptionsMenu.PlayerGodMode)); + SetPedCanBeKnockedOffVehicle(PlayerPedId(), ((MainMenu.PlayerOptionsMenu.PlayerNoRagdoll && cf.IsAllowed(Permission.PONoRagdoll)) ? 1 : 0)); + SetPedCanBeDraggedOut(PlayerPedId(), (MainMenu.PlayerOptionsMenu.PlayerIsIgnored && cf.IsAllowed(Permission.POIgnored))); + SetPedCanBeShotInVehicle(PlayerPedId(), !(MainMenu.PlayerOptionsMenu.PlayerGodMode && cf.IsAllowed(Permission.POGod))); } // Manage never wanted. - if (MainMenu.PlayerOptionsMenu.PlayerNeverWanted && GetPlayerWantedLevel(PlayerId()) > 0) + if (MainMenu.PlayerOptionsMenu.PlayerNeverWanted && GetPlayerWantedLevel(PlayerId()) > 0 && cf.IsAllowed(Permission.PONeverWanted)) { ClearPlayerWantedLevel(PlayerId()); } // Manage player is ignored by everyone. - SetEveryoneIgnorePlayer(PlayerId(), MainMenu.PlayerOptionsMenu.PlayerIsIgnored); - SetPoliceIgnorePlayer(PlayerId(), MainMenu.PlayerOptionsMenu.PlayerIsIgnored); - SetPlayerCanBeHassledByGangs(PlayerId(), !(MainMenu.PlayerOptionsMenu.PlayerIsIgnored || MainMenu.PlayerOptionsMenu.PlayerGodMode)); + SetEveryoneIgnorePlayer(PlayerId(), MainMenu.PlayerOptionsMenu.PlayerIsIgnored && cf.IsAllowed(Permission.POIgnored)); + + SetPoliceIgnorePlayer(PlayerId(), MainMenu.PlayerOptionsMenu.PlayerIsIgnored && cf.IsAllowed(Permission.POIgnored)); + + SetPlayerCanBeHassledByGangs(PlayerId(), !((MainMenu.PlayerOptionsMenu.PlayerIsIgnored && cf.IsAllowed(Permission.POIgnored)) || + (MainMenu.PlayerOptionsMenu.PlayerGodMode && cf.IsAllowed(Permission.POGod)))); // Manage player frozen. - FreezeEntityPosition(PlayerPedId(), MainMenu.PlayerOptionsMenu.PlayerFrozen); + FreezeEntityPosition(PlayerPedId(), MainMenu.PlayerOptionsMenu.PlayerFrozen && cf.IsAllowed(Permission.POFreeze)); } else { @@ -157,7 +166,7 @@ private async Task VehicleOptions() Vehicle vehicle = new Vehicle(cf.GetVehicle()); // God mode - bool god = MainMenu.VehicleOptionsMenu.VehicleGodMode; + bool god = MainMenu.VehicleOptionsMenu.VehicleGodMode && cf.IsAllowed(Permission.VOGod); vehicle.CanBeVisiblyDamaged = !god; vehicle.CanEngineDegrade = !god; vehicle.CanTiresBurst = !god; @@ -203,11 +212,7 @@ private async Task VehicleOptions() vehicle.IsSirenSilent = MainMenu.VehicleOptionsMenu.VehicleNoSiren; } - // Manage vehicle engine always on. - if (MainMenu.VehicleOptionsMenu.VehicleEngineAlwaysOn && DoesEntityExist(cf.GetVehicle(lastVehicle: true)) && !DoesEntityExist(cf.GetVehicle(lastVehicle: false))) - { - SetVehicleEngineOn(cf.GetVehicle(lastVehicle: true), true, true, true); - } + // Manage "no helmet" var ped = new Ped(PlayerPedId()); @@ -228,6 +233,8 @@ private async Task VehicleOptions() } } + + // When the player is not inside a vehicle: else { @@ -291,6 +298,13 @@ private async Task VehicleOptions() // Notify.Error("You have to be the driver of a vehicle to access this menu."); //} } + + // Manage vehicle engine always on. + if (MainMenu.VehicleOptionsMenu.VehicleEngineAlwaysOn && DoesEntityExist(cf.GetVehicle(lastVehicle: true)) && !IsPedInAnyVehicle(PlayerPedId(), false) && cf.IsAllowed(Permission.VOEngineAlwaysOn)) + { + await Delay(100); + SetVehicleEngineOn(cf.GetVehicle(lastVehicle: true), true, true, true); + } } else { @@ -657,7 +671,7 @@ private async Task SpectateHandling() else { await Delay(0); - } + } } #endregion diff --git a/vMenu/menus/WeaponOptions.cs b/vMenu/menus/WeaponOptions.cs index bd556eb0..0454c7cb 100644 --- a/vMenu/menus/WeaponOptions.cs +++ b/vMenu/menus/WeaponOptions.cs @@ -191,7 +191,13 @@ private void CreateMenu() Ped ped = new Ped(PlayerPedId()); if (item == getAllWeapons) { - ped.Weapons.Give(WeaponHash.Unarmed, 0, true, true); + foreach (var weapon in ValidWeapons.Weapons) + { + var ammo = 255; + GetMaxAmmo(PlayerPedId(), weapon.Value, ref ammo); + ped.Weapons.Give((WeaponHash)weapon.Value, ammo, weapon.Key == "Unarmed", true); + } + //ped.Weapons.Give(WeaponHash.Unarmed, 0, true, true); } else if (item == removeAllWeapons) { diff --git a/vMenuServer/EventManager.cs b/vMenuServer/EventManager.cs index aaf3f331..a214a77c 100644 --- a/vMenuServer/EventManager.cs +++ b/vMenuServer/EventManager.cs @@ -461,7 +461,7 @@ private string GetRealAceName(string inputString) } else if (prefix == "SV") { - outputString = "vMenu.VehicleSpawner." + inputString.Substring(2); + outputString = "vMenu.SavedVehicles." + inputString.Substring(2); } else if (prefix == "PA") { From 7c24532993f6b601d8a16e31de3e5ad73787a22e Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 01:15:48 +0100 Subject: [PATCH 05/21] Cleaned up --- vMenu/FunctionsController.cs | 48 ------------------------------------ 1 file changed, 48 deletions(-) diff --git a/vMenu/FunctionsController.cs b/vMenu/FunctionsController.cs index a6d9864c..8aecea48 100644 --- a/vMenu/FunctionsController.cs +++ b/vMenu/FunctionsController.cs @@ -212,8 +212,6 @@ private async Task VehicleOptions() vehicle.IsSirenSilent = MainMenu.VehicleOptionsMenu.VehicleNoSiren; } - - // Manage "no helmet" var ped = new Ped(PlayerPedId()); // If the no helmet feature is turned on, disalbe "ped can wear helmet" @@ -232,9 +230,6 @@ private async Task VehicleOptions() ped.RemoveHelmet(true); } } - - - // When the player is not inside a vehicle: else { @@ -254,49 +249,6 @@ private async Task VehicleOptions() Notify.Error("You need to be inside a vehicle to access this menu."); } } - - //// If the vehicle mod submenu is open, close it. - //if (MainMenu.VehicleOptionsMenu.VehicleModMenu.Visible) - //{ - // MainMenu.VehicleOptionsMenu.GetMenu().Visible = true; - // MainMenu.VehicleOptionsMenu.VehicleModMenu.Visible = false; - // Notify.Error("You have to be the driver of a vehicle to access this menu."); - //} - //// If the vehicle liveries submenu is open, close it. - //if (MainMenu.VehicleOptionsMenu.VehicleLiveriesMenu.Visible) - //{ - // MainMenu.VehicleOptionsMenu.GetMenu().Visible = true; - // MainMenu.VehicleOptionsMenu.VehicleLiveriesMenu.Visible = false; - // Notify.Error("You have to be the driver of a vehicle to access this menu."); - //} - //// If the vehicle colors submenu is open, close it. - //if (MainMenu.VehicleOptionsMenu.VehicleColorsMenu.Visible) - //{ - // MainMenu.VehicleOptionsMenu.GetMenu().Visible = true; - // MainMenu.VehicleOptionsMenu.VehicleColorsMenu.Visible = false; - // Notify.Error("You have to be the driver of a vehicle to access this menu."); - //} - //// If the vehicle doors submenu is open, close it. - //if (MainMenu.VehicleOptionsMenu.VehicleDoorsMenu.Visible) - //{ - // MainMenu.VehicleOptionsMenu.GetMenu().Visible = true; - // MainMenu.VehicleOptionsMenu.VehicleDoorsMenu.Visible = false; - // Notify.Error("You have to be the driver of a vehicle to access this menu."); - //} - //// If the vehicle windows submenu is open, close it. - //if (MainMenu.VehicleOptionsMenu.VehicleWindowsMenu.Visible) - //{ - // MainMenu.VehicleOptionsMenu.GetMenu().Visible = true; - // MainMenu.VehicleOptionsMenu.VehicleWindowsMenu.Visible = false; - // Notify.Error("You have to be the driver of a vehicle to access this menu."); - //} - //// If the vehicle extras submenu is open, close it. - //if (MainMenu.VehicleOptionsMenu.VehicleComponentsMenu.Visible) - //{ - // MainMenu.VehicleOptionsMenu.GetMenu().Visible = true; - // MainMenu.VehicleOptionsMenu.VehicleComponentsMenu.Visible = false; - // Notify.Error("You have to be the driver of a vehicle to access this menu."); - //} } // Manage vehicle engine always on. From f5efa52ec9042a13d863fe0e92f85038fd6d160b Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:20:21 +0100 Subject: [PATCH 06/21] Fixed a ton of bugs --- vMenu/CommonFunctions.cs | 240 ++++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 103 deletions(-) diff --git a/vMenu/CommonFunctions.cs b/vMenu/CommonFunctions.cs index 28b52776..9c0d10b8 100644 --- a/vMenu/CommonFunctions.cs +++ b/vMenu/CommonFunctions.cs @@ -127,7 +127,7 @@ public async void TeleportToPlayerAsync(int playerId, bool inVehicle = false) int playerPed = GetPlayerPed(playerId); if (PlayerPedId() == playerPed) { - Notify.Error("Sorry, you can ~r~~h~not~h~ ~w~teleport to yourself!"); + Notify.Error("Sorry, you can ~r~~h~not~h~ ~s~teleport to yourself!"); return; } @@ -155,7 +155,7 @@ public async void TeleportToPlayerAsync(int playerId, bool inVehicle = false) if (DoesEntityExist(vehicle) && !IsEntityDead(vehicle) && IsAnyVehicleSeatEmpty(vehicle)) { TaskWarpPedIntoVehicle(PlayerPedId(), vehicle, (int)VehicleSeat.Any); - Notify.Success("Teleported into ~g~" + GetPlayerName(playerId) + "'s ~w~vehicle."); + Notify.Success("Teleported into ~g~" + GetPlayerName(playerId) + "'s ~s~vehicle."); } // If there are not enough empty vehicle seats or the vehicle doesn't exist/is dead then notify the user. else @@ -610,11 +610,18 @@ public async void SpawnVehicle(uint vehicleHash, bool spawnInside, bool replaceP int pearlescentColor = int.Parse(vehicleInfo["pearlescentColor"].ToString()); int wheelColor = int.Parse(vehicleInfo["wheelsColor"].ToString()); + int.TryParse(vehicleInfo["interiorColor"], out int interiorcolor); + int.TryParse(vehicleInfo["dashboardColor"], out int dashboardcolor); + + SetVehicleInteriorColour(vehicle.Handle, interiorcolor); + SetVehicleDashboardColour(vehicle.Handle, dashboardcolor); + SetVehicleNumberPlateText(vehicle.Handle, vehicleInfo["plate"]); SetVehicleNumberPlateTextIndex(vehicle.Handle, int.Parse(vehicleInfo["plateStyle"])); + // Skip all non-vehicle "mod" options and loop through the remaining mods and apply them to the vehicle. - var skip = 8 + 24; + var skip = 8 + 24 + 2; foreach (var mod in vehicleInfo) { skip--; @@ -707,6 +714,12 @@ public async void SaveVehicle() dict.Add("secondaryColor", secondaryColor.ToString()); dict.Add("wheelsColor", wheelColor.ToString()); dict.Add("pearlescentColor", pearlescentColor.ToString()); + var interiorColor = 0; + var dashboardColor = 0; + GetVehicleInteriorColour(veh, ref interiorColor); + GetVehicleDashboardColour(veh, ref dashboardColor); + dict.Add("interiorColor", interiorColor.ToString()); + dict.Add("dashboardColor", dashboardColor.ToString()); dict.Add("plate", GetVehicleNumberPlateText(veh).ToString()); dict.Add("plateStyle", GetVehicleNumberPlateTextIndex(veh).ToString()); @@ -854,36 +867,22 @@ private async Task LoadModel(uint modelHash) public async Task GetUserInputAsync(string windowTitle = null, string defaultText = null, int maxInputLength = 20) { - MainMenu.DontOpenMenus = true; UIMenu openMenu = null; // Check for any open menus, then go through all of them and save the state if they're open so we can reopen them later. if (MainMenu.Mp.IsAnyMenuOpen()) { - if (MainMenu.VehicleOptionsMenu.GetMenu().Visible) - { - openMenu = MainMenu.VehicleOptionsMenu.GetMenu(); - } - else if (MainMenu.OnlinePlayersMenu.GetMenu().Visible) - { - openMenu = MainMenu.OnlinePlayersMenu.GetMenu(); - } - else if (MainMenu.PlayerOptionsMenu.GetMenu().Visible) - { - openMenu = MainMenu.PlayerOptionsMenu.GetMenu(); - } - else if (MainMenu.VehicleSpawnerMenu.GetMenu().Visible) - { - openMenu = MainMenu.VehicleSpawnerMenu.GetMenu(); - } - else if (MainMenu.SavedVehiclesMenu.GetMenu().Visible) + foreach (UIMenu m in MainMenu.Mp.ToList()) { - openMenu = MainMenu.SavedVehiclesMenu.GetMenu(); + if (m.Visible) + { + openMenu = m; + } } - - // Then close all menus. MainMenu.Mp.CloseAllMenus(); } + await Delay(1); + MainMenu.DontOpenMenus = true; // Create the window title string. AddTextEntry("FMMC_KEY_TIP1", $"{windowTitle ?? "Enter"}: (MAX {maxInputLength.ToString()} CHARACTERS)"); @@ -919,28 +918,31 @@ public async Task GetUserInputAsync(string windowTitle = null, string de int status = UpdateOnscreenKeyboard(); string result = GetOnscreenKeyboardResult(); + // Allow menus to be opened again. + MainMenu.DontOpenMenus = false; + // Reopen any menus if they were open. + await Delay(4); + if (openMenu != null) + { + openMenu.Visible = true; + } + // If the result is not empty or null if (result != "" && result != null && status == 1) { - // Reopen any menus if they were open. - if (openMenu != null) - { - openMenu.Visible = true; - } - // Allow menus to be opened again. - MainMenu.DontOpenMenus = false; + // Return result. return result.ToString(); } else { - // Reopen any menus if they were open. - if (openMenu != null) - { - openMenu.Visible = true; - } - // Allow menus to be opened again. - MainMenu.DontOpenMenus = false; + //// Allow menus to be opened again. + //MainMenu.DontOpenMenus = false; + //// Reopen any menus if they were open. + //if (openMenu != null) + //{ + // openMenu.Visible = true; + //} // Return result. return "NULL"; } @@ -977,7 +979,7 @@ public async void SetLicensePlateTextAsync() else { Notify.Error(CommonErrors.InvalidInput); - //Notify.Error($"License plate text ~r~{(text == "NULL" ? "(empty input)" : text)} ~w~can not be used on a license plate!"); + //Notify.Error($"License plate text ~r~{(text == "NULL" ? "(empty input)" : text)} ~s~can not be used on a license plate!"); } } @@ -1182,7 +1184,7 @@ public Dictionary JsonToDictionary(string json) } //foreach (KeyValuePair t in dict) //{ - // Notify.Custom($"Key: ~r~{t.Key} ~w~value: ~g~{t.Value}"); + // Notify.Custom($"Key: ~r~{t.Key} ~s~value: ~g~{t.Value}"); //} } @@ -1246,18 +1248,52 @@ public void UpdateServerTime(int hours, int minutes, bool freezeTime) /// String[] containing 1, 2 or 3 strings. public string[] StringToArray(string inputString) { - var size = (inputString.Length > 99 ? (inputString.Length > 198 ? 3 : 2) : 1); - string[] outputString = new string[size]; - int length = inputString.Length; - for (var x = 0; x < size; x++) - { - var tmplength = (length >= 99 ? 99 : length); + string[] outputString = new string[3]; - var tmpstring = inputString.Substring(99 * x, tmplength); - outputString[x] = tmpstring; + var lastSpaceIndex = 0; + var newStartIndex = 0; + outputString[0] = inputString; - length -= tmplength; + if (inputString.Length > 99) + { + for (int i = 0; i < inputString.Length; i++) + { + if (inputString.Substring(i, 1) == " ") + { + lastSpaceIndex = i; + } + + if (inputString.Length > 99 && i >= 98) + { + if (i == 98) + { + outputString[0] = inputString.Substring(0, lastSpaceIndex); + newStartIndex = lastSpaceIndex + 1; + } + if (i > 98 && i < 198) + { + if (i == 197) + { + outputString[1] = inputString.Substring(newStartIndex, (lastSpaceIndex - (outputString[0].Length - 1)) - (inputString.Length - 1 > 197 ? 1 : -1)); + newStartIndex = lastSpaceIndex + 1; + } + else if (i == inputString.Length - 1 && inputString.Length < 198) + { + outputString[1] = inputString.Substring(newStartIndex, ((inputString.Length - 1) - outputString[0].Length)); + newStartIndex = lastSpaceIndex + 1; + } + } + if (i > 197) + { + if (i == inputString.Length - 1 || i == 296) + { + outputString[2] = inputString.Substring(newStartIndex, ((inputString.Length - 1) - outputString[0].Length) - outputString[1].Length); + } + } + } + } } + return outputString; } #endregion @@ -1326,7 +1362,7 @@ public void DrawTextOnScreen(string text, float xPosition, float yPosition, floa /// Disables the default text outline. public void DrawTextOnScreen(string text, float xPosition, float yPosition, float size, CitizenFX.Core.UI.Alignment justification, int font, bool disableTextOutline) { - if (IsHudPreferenceSwitchedOn() && !IsHudHidden()) + if (IsHudPreferenceSwitchedOn() && CitizenFX.Core.UI.Screen.Hud.IsVisible && !MainMenu.MiscSettingsMenu.HideHud) { SetTextFont(font); SetTextScale(1.0f, size); @@ -1500,59 +1536,47 @@ public async void LoadSavedPed(string savedName) #region Save and restore weapon loadouts when changing models - //private struct WeaponInfo - //{ - // public int Ammo; - // public bool Equipped; - // public uint Hash; - // public uint[] Components; - // public int Tint; - //} - + private struct WeaponInfo + { + public int Ammo; + public uint Hash; + public List Components; + public int Tint; + } + private List weaponsList = new List(); /// /// Saves all current weapons and components. /// public async Task SaveWeaponLoadout() { - await Delay(0); - int weaponCount = Enum.GetValues(typeof(WeaponHash)).Length; - //weaponList = null; - //weaponList = new WeaponInfo[weaponCount]; - Ped ped = Game.PlayerPed; - //var iterator = 0; - - /* - foreach (var weapon in WeaponOptions.ValidWeapons) + await Delay(1); + weaponsList.Clear(); + await Delay(1); + foreach (var vw in ValidWeapons.Weapons) { - uint modelHash = weapon.Value; - - bool inInventory = HasPedGotWeapon(PlayerPedId(), modelHash, false); - if (inInventory) + if (HasPedGotWeapon(PlayerPedId(), vw.Value, false)) { - int ammo = GetAmmoInPedWeapon(PlayerPedId(), modelHash); - WeaponInfo wi = new WeaponInfo { }; - wi.Ammo = ammo; - wi.Hash = modelHash; - wi.Equipped = Game.PlayerPed.Weapons.Current.Hash == (WeaponHash)modelHash; - - var componentlist = new uint[50]; - var it = 0; - foreach (var wc in Enum.GetValues(typeof(WeaponComponentHash))) + List components = new List(); + foreach (var wc in ValidWeapons.weaponComponents) { - if (DoesWeaponTakeWeaponComponent(modelHash, (uint)wc) && HasPedGotWeaponComponent(PlayerPedId(), modelHash, (uint)wc)) + if (DoesWeaponTakeWeaponComponent(vw.Value, wc.Value)) { - componentlist[it] = (uint)wc; - it++; + if (HasPedGotWeaponComponent(PlayerPedId(), vw.Value, wc.Value)) + { + components.Add(wc.Value); + } } } - wi.Components = componentlist; - wi.Tint = GetPedWeaponTintIndex(PlayerPedId(), modelHash); - weaponList[iterator] = wi; - iterator++; - + weaponsList.Add(new WeaponInfo() + { + Ammo = GetAmmoInPedWeapon(PlayerPedId(), vw.Value), + Hash = vw.Value, + Components = components, + Tint = GetPedWeaponTintIndex(PlayerPedId(), vw.Value) + }); } } - */ + await Delay(1); } /// @@ -1560,19 +1584,22 @@ public async Task SaveWeaponLoadout() /// public async void RestoreWeaponLoadout() { - await Delay(100); - //foreach (WeaponInfo wi in weaponList) - //{ - // GiveWeaponToPed(PlayerPedId(), wi.Hash, wi.Ammo, false, wi.Equipped); - // if (wi.Components != null) - // { - // foreach (uint comphash in wi.Components) - // { - // GiveWeaponComponentToPed(PlayerPedId(), wi.Hash, comphash); - // } - // } - // SetPedWeaponTintIndex(PlayerPedId(), wi.Hash, wi.Tint); - //} + await Delay(0); + if (weaponsList.Count > 0) + { + foreach (WeaponInfo wi in weaponsList) + { + GiveWeaponToPed(PlayerPedId(), wi.Hash, wi.Ammo, false, false); + if (wi.Components.Count > 0) + { + foreach (var wc in wi.Components) + { + GiveWeaponComponentToPed(PlayerPedId(), wi.Hash, wc); + } + } + SetPedWeaponTintIndex(PlayerPedId(), wi.Hash, wi.Tint); + } + } } #endregion @@ -1602,5 +1629,12 @@ public UIMenuItem GetSpacerMenuItem(string title, string description = null) } #endregion + #region Log Function + public void Log(string data) + { + Debug.WriteLine(data, ""); + } + #endregion + } } From 51739614f92e2969ca716e5dd4e0a1674b2ec4b3 Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:21:19 +0100 Subject: [PATCH 07/21] Some debug testing (commented out) --- vMenu/EventManager.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vMenu/EventManager.cs b/vMenu/EventManager.cs index 97de5004..fff7e716 100644 --- a/vMenu/EventManager.cs +++ b/vMenu/EventManager.cs @@ -34,11 +34,27 @@ public EventManager() EventHandlers.Add("vMenu:SetWeather", new Action(SetWeather)); EventHandlers.Add("vMenu:SetClouds", new Action(SetClouds)); EventHandlers.Add("vMenu:SetTime", new Action(SetTime)); + //RegisterCommand("test", new Action>(Test), false); Tick += WeatherSync; Tick += TimeSync; } + //private void Test(int test, List t) + //{ + // string output = ""; + // var first = true; + // foreach (string x in t) + // { + // if (x != null) + // { + // output += (!first ? " " : "") + x; + // first = false; + // } + // } + // MainMenu.Notify.Error(CommonErrors.UnknownError, placeholderValue: output); + //} + private void UpdatePermissions(dynamic permissions) { MainMenu.SetPermissions(permissions); From 1912ab179ecbe47f3db71e2e2cb3065aef863f99 Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:21:40 +0100 Subject: [PATCH 08/21] Added permission checks to looped functions --- vMenu/FunctionsController.cs | 85 ++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 48 deletions(-) diff --git a/vMenu/FunctionsController.cs b/vMenu/FunctionsController.cs index 8aecea48..0a889c72 100644 --- a/vMenu/FunctionsController.cs +++ b/vMenu/FunctionsController.cs @@ -81,7 +81,7 @@ private async Task GeneralTasks() private async Task PlayerOptions() { // Player options. Only run player options if the player options menu has actually been created. - if (MainMenu.PlayerOptionsMenu != null) + if (MainMenu.PlayerOptionsMenu != null && cf.IsAllowed(Permission.POMenu)) { // Manage Player God Mode SetEntityInvincible(PlayerPedId(), MainMenu.PlayerOptionsMenu.PlayerGodMode && cf.IsAllowed(Permission.POGod)); @@ -157,7 +157,7 @@ private async Task VehicleOptions() { // Vehicle options. Only run vehicle options if the vehicle options menu has actually been created. - if (MainMenu.VehicleOptionsMenu != null) + if (MainMenu.VehicleOptionsMenu != null && cf.IsAllowed(Permission.VOMenu)) { // When the player is in a valid vehicle: if (DoesEntityExist(cf.GetVehicle())) @@ -184,10 +184,10 @@ private async Task VehicleOptions() } // Freeze Vehicle Position (if enabled). - FreezeEntityPosition(vehicle.Handle, MainMenu.VehicleOptionsMenu.VehicleFrozen); + FreezeEntityPosition(vehicle.Handle, MainMenu.VehicleOptionsMenu.VehicleFrozen && cf.IsAllowed(Permission.VOFreeze)); // If the torque multiplier is enabled. - if (MainMenu.VehicleOptionsMenu.VehicleTorqueMultiplier) + if (MainMenu.VehicleOptionsMenu.VehicleTorqueMultiplier && cf.IsAllowed(Permission.VOTorqueMultiplier)) { // Set the torque multiplier to the selected value by the player. // no need for an "else" to reset this value, because when it's not called every frame, nothing happens. @@ -200,7 +200,7 @@ private async Task VehicleOptions() SwitchedVehicle = false; // Vehicle engine power multiplier. - if (MainMenu.VehicleOptionsMenu.VehiclePowerMultiplier) + if (MainMenu.VehicleOptionsMenu.VehiclePowerMultiplier && cf.IsAllowed(Permission.VOPowerMultiplier)) { SetVehicleEnginePowerMultiplier(vehicle.Handle, MainMenu.VehicleOptionsMenu.VehiclePowerMultiplierAmount); } @@ -209,23 +209,23 @@ private async Task VehicleOptions() SetVehicleEnginePowerMultiplier(vehicle.Handle, 1f); } // No Siren Toggle - vehicle.IsSirenSilent = MainMenu.VehicleOptionsMenu.VehicleNoSiren; + vehicle.IsSirenSilent = MainMenu.VehicleOptionsMenu.VehicleNoSiren && cf.IsAllowed(Permission.VONoSiren); } // Manage "no helmet" var ped = new Ped(PlayerPedId()); // If the no helmet feature is turned on, disalbe "ped can wear helmet" - if (MainMenu.VehicleOptionsMenu.VehicleNoBikeHelemet) + if (MainMenu.VehicleOptionsMenu.VehicleNoBikeHelemet && cf.IsAllowed(Permission.VONoHelmet)) { ped.CanWearHelmet = false; } // otherwise, allow helmets. - else if (!MainMenu.VehicleOptionsMenu.VehicleNoBikeHelemet) + else if (!MainMenu.VehicleOptionsMenu.VehicleNoBikeHelemet || !cf.IsAllowed(Permission.VONoHelmet)) { ped.CanWearHelmet = true; } // If the player is still wearing a helmet, even if the option is set to: no helmet, then remove the helmet. - if (ped.IsWearingHelmet && MainMenu.VehicleOptionsMenu.VehicleNoBikeHelemet) + if (ped.IsWearingHelmet && MainMenu.VehicleOptionsMenu.VehicleNoBikeHelemet && cf.IsAllowed(Permission.VONoHelmet)) { ped.RemoveHelmet(true); } @@ -246,13 +246,14 @@ private async Task VehicleOptions() { MainMenu.VehicleOptionsMenu.GetMenu().Visible = true; m.Visible = false; - Notify.Error("You need to be inside a vehicle to access this menu."); + Notify.Error(CommonErrors.NoVehicle, placeholderValue: "to access this menu"); } } } // Manage vehicle engine always on. - if (MainMenu.VehicleOptionsMenu.VehicleEngineAlwaysOn && DoesEntityExist(cf.GetVehicle(lastVehicle: true)) && !IsPedInAnyVehicle(PlayerPedId(), false) && cf.IsAllowed(Permission.VOEngineAlwaysOn)) + if ((MainMenu.VehicleOptionsMenu.VehicleEngineAlwaysOn && DoesEntityExist(cf.GetVehicle(lastVehicle: true)) && !IsPedInAnyVehicle(PlayerPedId(), false)) && + (cf.IsAllowed(Permission.VOEngineAlwaysOn))) { await Delay(100); SetVehicleEngineOn(cf.GetVehicle(lastVehicle: true), true, true, true); @@ -271,7 +272,7 @@ private async Task VehicleOptions() /// private async Task MiscSettings() { - if (MainMenu.MiscSettingsMenu != null) + if (MainMenu.MiscSettingsMenu != null && cf.IsAllowed(Permission.MSMenu)) { #region Misc Settings // Show speedometer km/h @@ -287,7 +288,7 @@ private async Task MiscSettings() } // Show coordinates. - if (MainMenu.MiscSettingsMenu.ShowCoordinates) + if (MainMenu.MiscSettingsMenu.ShowCoordinates && cf.IsAllowed(Permission.MSShowCoordinates)) { var pos = GetEntityCoords(PlayerPedId(), true); cf.DrawTextOnScreen($"~r~X~t~: {Math.Round(pos.X, 2)}" + @@ -316,7 +317,7 @@ private async Task MiscSettings() #region Show Location // Show location & time. - if (MainMenu.MiscSettingsMenu.ShowLocation) + if (MainMenu.MiscSettingsMenu.ShowLocation && cf.IsAllowed(Permission.MSShowLocation)) { // Get the current location. @@ -327,13 +328,13 @@ private async Task MiscSettings() var node = GetNthClosestVehicleNode(currentPos.X, currentPos.Y, currentPos.Z, 0, ref nodePos, 0, 0, 0); // Create the default prefix. - var prefix = "~w~"; + var prefix = "~s~"; // If the vehicle node is further away than 1400f, then the player is not near a valid road. // So we set the prefix to "Near " (). if (Vdist2(currentPos.X, currentPos.Y, currentPos.Z, nodePos.X, nodePos.Y, nodePos.Z) > 1400f) { - prefix = "~m~Near ~w~"; + prefix = "~m~Near ~s~"; } // Get the heading. @@ -397,7 +398,7 @@ private async Task MiscSettings() #region Join / Quit notifications // Join/Quit notifications - if (MainMenu.MiscSettingsMenu.JoinQuitNotifications) + if (MainMenu.MiscSettingsMenu.JoinQuitNotifications && cf.IsAllowed(Permission.MSJoinQuitNotifs)) { PlayerList plist = new PlayerList(); Dictionary pl = new Dictionary(); @@ -412,7 +413,7 @@ private async Task MiscSettings() { if (!playerList.Contains(player)) { - Notify.Custom($"~g~{player.Value}~w~ joined the server."); + Notify.Custom($"~g~{player.Value}~s~ joined the server."); } } } @@ -423,7 +424,7 @@ private async Task MiscSettings() { if (!pl.Contains(player)) { - Notify.Custom($"~r~{player.Value}~w~ left the server."); + Notify.Custom($"~r~{player.Value}~s~ left the server."); } } } @@ -433,7 +434,7 @@ private async Task MiscSettings() #region Death Notifications // Death notifications - if (MainMenu.MiscSettingsMenu.DeathNotifications) + if (MainMenu.MiscSettingsMenu.DeathNotifications && cf.IsAllowed(Permission.MSDeathNotifs)) { PlayerList pl = new PlayerList(); foreach (Player p in pl) @@ -452,24 +453,24 @@ private async Task MiscSettings() { if (playerKiller.Character.Handle == killer.Handle) { - Notify.Custom($"~o~{p.Name} ~w~has been murdered by ~y~{playerKiller.Name}~w~."); + Notify.Custom($"~o~{p.Name} ~s~has been murdered by ~y~{playerKiller.Name}~s~."); break; } } } else { - Notify.Custom($"~o~{p.Name} ~w~has been murdered."); + Notify.Custom($"~o~{p.Name} ~s~has been murdered."); } } else { - Notify.Custom($"~o~{p.Name} ~w~committed suicide."); + Notify.Custom($"~o~{p.Name} ~s~committed suicide."); } } else { - Notify.Custom($"~o~{p.Name} ~w~died."); + Notify.Custom($"~o~{p.Name} ~s~died."); } deadPlayers.Add(p.Handle); } @@ -497,9 +498,9 @@ private async Task MiscSettings() /// private async Task VoiceChat() { - if (MainMenu.VoiceChatSettingsMenu != null) + if (MainMenu.VoiceChatSettingsMenu != null && cf.IsAllowed(Permission.VCMenu)) { - if (MainMenu.VoiceChatSettingsMenu.EnableVoicechat) + if (MainMenu.VoiceChatSettingsMenu.EnableVoicechat && cf.IsAllowed(Permission.VCEnable)) { NetworkSetVoiceActive(true); NetworkSetTalkerProximity(MainMenu.VoiceChatSettingsMenu.currentProximity); @@ -512,7 +513,7 @@ private async Task VoiceChat() { NetworkSetVoiceChannel(channel); } - if (MainMenu.VoiceChatSettingsMenu.ShowCurrentSpeaker) + if (MainMenu.VoiceChatSettingsMenu.ShowCurrentSpeaker && cf.IsAllowed(Permission.VCShowSpeaker)) { PlayerList pl = new PlayerList(); var i = 1; @@ -525,7 +526,7 @@ private async Task VoiceChat() { if (!currentlyTalking) { - cf.DrawTextOnScreen("~w~Currently Talking", 0.5f, 0.00f, 0.5f, Alignment.Center, 6); + cf.DrawTextOnScreen("~s~Currently Talking", 0.5f, 0.00f, 0.5f, Alignment.Center, 6); currentlyTalking = true; } cf.DrawTextOnScreen($"~b~{p.Name}", 0.5f, 0.00f + (i * 0.03f), 0.5f, Alignment.Center, 6); @@ -553,9 +554,9 @@ private async Task VoiceChat() /// private async Task TimeOptions() { - if (MainMenu.TimeOptionsMenu != null) + if (MainMenu.TimeOptionsMenu != null && cf.IsAllowed(Permission.TOMenu)) { - if (MainMenu.TimeOptionsMenu.freezeTimeToggle != null && MainMenu.TimeOptionsMenu.GetMenu().Visible) + if ((MainMenu.TimeOptionsMenu.freezeTimeToggle != null && MainMenu.TimeOptionsMenu.GetMenu().Visible) && cf.IsAllowed(Permission.TOFreezeTime)) { // Update the current time displayed in the Time Options menu (only when the menu is actually visible). var hours = GetClockHours(); @@ -576,17 +577,17 @@ private async Task TimeOptions() /// private async Task WeaponOptions() { - if (MainMenu.WeaponOptionsMenu != null) + if (MainMenu.WeaponOptionsMenu != null && cf.IsAllowed(Permission.WPMenu)) { // If no reload is enabled. - if (MainMenu.WeaponOptionsMenu.NoReload && Game.PlayerPed.Weapons.Current.Hash != WeaponHash.Minigun) + if (MainMenu.WeaponOptionsMenu.NoReload && Game.PlayerPed.Weapons.Current.Hash != WeaponHash.Minigun && cf.IsAllowed(Permission.WPNoReload)) { // Disable reloading. PedSkipNextReloading(PlayerPedId()); } // Enable/disable infinite ammo. - SetPedInfiniteAmmoClip(PlayerPedId(), MainMenu.WeaponOptionsMenu.UnlimitedAmmo); + SetPedInfiniteAmmoClip(PlayerPedId(), MainMenu.WeaponOptionsMenu.UnlimitedAmmo && cf.IsAllowed(Permission.WPUnlimitedAmmo)); } else { @@ -602,7 +603,7 @@ private async Task WeaponOptions() /// private async Task SpectateHandling() { - if (MainMenu.OnlinePlayersMenu != null) + if (MainMenu.OnlinePlayersMenu != null && cf.IsAllowed(Permission.OPMenu) && cf.IsAllowed(Permission.OPSpectate)) { // When the player dies while spectating, cancel the spectating to prevent an infinite black loading screen. if (GetEntityHealth(PlayerPedId()) < 1 && NetworkIsInSpectatorMode()) @@ -628,7 +629,7 @@ private async Task SpectateHandling() #endregion /// Not task related - #region Private functions used by some of the tasks. + #region Private ShowSpeed Functions /// /// Shows the current speed in km/h. /// Must be in a vehicle. @@ -639,7 +640,6 @@ private void ShowSpeedKmh() { int speed = int.Parse(Math.Round(GetEntitySpeed(cf.GetVehicle()) * 3.6f).ToString()); cf.DrawTextOnScreen($"{speed} KM/h", 0.995f, 0.955f, 0.7f, Alignment.Right, 4); - //HideHudComponentThisFrame((int)HudComponent.StreetName); } } @@ -651,27 +651,16 @@ private void ShowSpeedMph() { if (IsPedInAnyVehicle(PlayerPedId(), false)) { - //SetTextFont(4); - //SetTextScale(1.0f, 0.7f); - //SetTextJustification(2); - //SetTextWrap(0f, 0.995f); - //SetTextOutline(); - //BeginTextCommandDisplayText("STRING"); - int speed = int.Parse(Math.Round(GetEntitySpeed(cf.GetVehicle()) * 2.23694f).ToString()); - //AddTextComponentSubstringPlayerName($"{speed} MPH"); - if (MainMenu.MiscSettingsMenu.ShowSpeedoKmh) { - //EndTextCommandDisplayText(0f, 0.925f); cf.DrawTextOnScreen($"{speed} MPH", 0.995f, 0.925f, 0.7f, Alignment.Right, 4); + HideHudComponentThisFrame((int)HudComponent.StreetName); } else { cf.DrawTextOnScreen($"{speed} MPH", 0.995f, 0.955f, 0.7f, Alignment.Right, 4); - //EndTextCommandDisplayText(0f, 0.955f); - HideHudComponentThisFrame((int)HudComponent.StreetName); } } } From 407d936cf3946d7e42fcb009843df7e44ec9785c Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:22:22 +0100 Subject: [PATCH 09/21] Fixed the menus closing bug after closing a user input field --- vMenu/MainMenu.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vMenu/MainMenu.cs b/vMenu/MainMenu.cs index 82871470..d630a925 100644 --- a/vMenu/MainMenu.cs +++ b/vMenu/MainMenu.cs @@ -61,7 +61,7 @@ public MainMenu() } catch (Exception e) { - Debug.Write(e.Message); + Cf.Log(e.Message); } TriggerEvent("chatMessage", "^3IMPORTANT: vMenu IS NOT SETUP CORRECTLY. PLEASE CHECK THE SERVER LOG FOR MORE INFO."); } @@ -192,7 +192,7 @@ private async Task OnTick() // If the pause menu is active or all menus should be closed, close all menus. else { - await Delay(5); + await Delay(3); Mp.CloseAllMenus(); } #endregion From d9774b861ad9721e02ae3b9dc0c6c4f73ee6f5ba Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:22:43 +0100 Subject: [PATCH 10/21] Improved About vMenu info --- vMenu/menus/About.cs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/vMenu/menus/About.cs b/vMenu/menus/About.cs index 83285804..b70b5e5e 100644 --- a/vMenu/menus/About.cs +++ b/vMenu/menus/About.cs @@ -29,23 +29,22 @@ private void CreateMenu() }; - var currentVersion = ($"v{GetResourceMetadata(GetCurrentResourceName(), "version", 0)} (Pre-Alpha)"); + //var currentVersion = ($"v{GetResourceMetadata(GetCurrentResourceName(), "version", 0)}"); // Create menu items. - UIMenuItem version = new UIMenuItem("Version", $"Currently installed version of vMenu: ~c~~h~{currentVersion}~h~"); - version.SetRightLabel($"~m~~h~{currentVersion}~h~"); - UIMenuItem credits = new UIMenuItem("Credits", $"vMenu is made by ~b~Vespura~w~. Contributors: ~o~Briglair~w~ & ~o~Shayan~w~. Thanks to ~y~IllusiveTea ~w~for helping me test everything."); - UIMenuItem info1 = new UIMenuItem("More Info (1/2)", "vMenu is a server sided trainer, including full permissions support for all of it's features. " + - "vMenu is inspired by ~b~Oui's Lambda Menu~w~ and ~y~Sjaak327's Simple Trainer for GTA V~w~. "); - UIMenuItem info2 = new UIMenuItem("More Info (2/2)", "I've tried to add all features that ~r~~h~I~h~~w~ believe are important for any trainer. All (in my opinion) unnecassary features have been left out. " + - "This way, I hope to provide a customizable server-sided menu, that can benefit almost all servers."); - UIMenuItem help = new UIMenuItem("Player Help", $"If you found a ~p~bug~w~, want to ~y~request a feature~w~, want to leave ~g~feedback ~w~or you want to ~o~contact ~w~me for another reason, please go to ~b~vespura.com/vmenu/contact~w~."); - UIMenuItem support = new UIMenuItem("Developer Help", "If you need help setting this up on your server, please visit the vMenu wiki page at: ~b~vespura.com/vmenu/wiki~w~."); + UIMenuItem version = new UIMenuItem("Version", $"Currently installed version of vMenu: ~h~v{MainMenu.Version}~h~"); + version.SetRightLabel($"~h~v{MainMenu.Version}~h~"); + UIMenuItem credits = new UIMenuItem("Credits", $"vMenu is made by ~r~Vespura~s~. Big thank you to ~y~Briglair~s~, ~y~Shayan~s~ for helping out with various things! " + + $"Also thanks to ~y~IllusiveTea~s~ for alpha testing and for providing feedback."); + UIMenuItem info = new UIMenuItem("More Info About vMenu", "If you'd like to find out more about vMenu and all of it's features, " + + "checkout the forum post at ~b~vespura.com/vmenu~s~."); + UIMenuItem help = new UIMenuItem("Need Help?", $"If you want to learn more about vMenu, report a bug or you need to contact me, go to ~b~vespura.com/vmenu~s~."); + UIMenuItem support = new UIMenuItem("Info For Server Owners", "If you want to learn how to setup vMenu for your server, please visit the vMenu wiki page " + + "at: ~b~vespura.com/vmenu/wiki~s~."); menu.AddItem(version); menu.AddItem(credits); - menu.AddItem(info1); - menu.AddItem(info2); + menu.AddItem(info); menu.AddItem(help); menu.AddItem(support); From 7f30e809d3111d9d320d13ac2055eacbe94939dd Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:25:46 +0100 Subject: [PATCH 11/21] Changed ~w~ occurances with ~s~ to fix a bug --- vMenu/Notification.cs | 28 ++++++++++++------------- vMenu/menus/MiscSettings.cs | 1 + vMenu/menus/OnlinePlayers.cs | 6 +++--- vMenu/menus/PlayerAppearance.cs | 6 +++--- vMenu/menus/PlayerOptions.cs | 20 +++++++++--------- vMenu/menus/SavedVehicles.cs | 2 +- vMenu/menus/TimeOptions.cs | 6 +++--- vMenu/menus/VehicleOptions.cs | 30 +++++++++++++-------------- vMenu/menus/VehicleSpawner.cs | 2 +- vMenu/menus/VoiceChat.cs | 4 ++-- vMenu/menus/WeaponOptions.cs | 2 +- vMenu/menus/WeatherOptions.cs | 36 ++++++++++++++++----------------- 12 files changed, 72 insertions(+), 71 deletions(-) diff --git a/vMenu/Notification.cs b/vMenu/Notification.cs index c43f5f2d..eef76b9a 100644 --- a/vMenu/Notification.cs +++ b/vMenu/Notification.cs @@ -55,22 +55,22 @@ public static string Get(CommonErrors errorType, string placeholderValue = null) outputMessage = $"You are not allowed to{placeholder}, sorry."; break; case CommonErrors.InvalidModel: - outputMessage = $"This model~r~{placeholder} ~w~could not be found, are you sure it's valid?"; + outputMessage = $"This model~r~{placeholder} ~s~could not be found, are you sure it's valid?"; break; case CommonErrors.InvalidInput: - outputMessage = $"The provided input~r~{placeholder} ~w~is not valid or you cancelled the action, please try again."; + outputMessage = $"The input~r~{placeholder} ~s~is invalid or you cancelled the action, please try again."; break; case CommonErrors.InvalidSaveName: - outputMessage = $"Saving failed because the provided save name~r~{placeholder} ~w~is invalid."; + outputMessage = $"Saving failed because the provided save name~r~{placeholder} ~s~is invalid."; break; case CommonErrors.SaveNameAlreadyExists: - outputMessage = $"Saving failed because the provided save name~r~{placeholder} ~w~already exists."; + outputMessage = $"Saving failed because the provided save name~r~{placeholder} ~s~already exists."; break; case CommonErrors.CouldNotLoadSave: - outputMessage = $"Loading of~r~{placeholder} ~w~failed! Is the saves file corrupt?"; + outputMessage = $"Loading of~r~{placeholder} ~s~failed! Is the saves file corrupt?"; break; case CommonErrors.CouldNotLoad: - outputMessage = $"Could not load~r~{placeholder}~w~, sorry!"; + outputMessage = $"Could not load~r~{placeholder}~s~, sorry!"; break; case CommonErrors.PedNotFound: outputMessage = $"The specified ped could not be found.{placeholder}"; @@ -120,7 +120,7 @@ public void Custom(string message, bool blink = false, bool saveToBrief = true) /// Should the notification be logged to the brief (PAUSE menu > INFO > Notifications)? public void Alert(string message, bool blink = false, bool saveToBrief = true) { - Custom("~y~~h~Alert~h~~w~: " + message, blink, saveToBrief); + Custom("~y~~h~Alert~h~~s~: " + message, blink, saveToBrief); } /// @@ -144,7 +144,7 @@ public void Alert(CommonErrors errorMessage, bool blink = false, bool saveToBrie /// Should the notification be logged to the brief (PAUSE menu > INFO > Notifications)? public void Error(string message, bool blink = false, bool saveToBrief = true) { - Custom("~r~~h~Error~h~~w~: " + message, blink, saveToBrief); + Custom("~r~~h~Error~h~~s~: " + message, blink, saveToBrief); } /// @@ -168,7 +168,7 @@ public void Error(CommonErrors errorMessage, bool blink = false, bool saveToBrie /// Should the notification be logged to the brief (PAUSE menu > INFO > Notifications)? public void Info(string message, bool blink = false, bool saveToBrief = true) { - Custom("~b~~h~Info~h~~w~: " + message, blink, saveToBrief); + Custom("~b~~h~Info~h~~s~: " + message, blink, saveToBrief); } /// @@ -179,7 +179,7 @@ public void Info(string message, bool blink = false, bool saveToBrief = true) /// Should the notification be logged to the brief (PAUSE menu > INFO > Notifications)? public void Success(string message, bool blink = false, bool saveToBrief = true) { - Custom("~g~~h~Success~h~~w~: " + message, blink, saveToBrief); + Custom("~g~~h~Success~h~~s~: " + message, blink, saveToBrief); } } #endregion @@ -217,7 +217,7 @@ public void Custom(string message, int duration = 2500, bool drawImmediately = t /// (Optional) add a prefix to your message, if you use this, only the prefix will be colored. The rest of the message will be left white. public void Alert(string message, int duration = 2500, bool drawImmediately = true, string prefix = null) { - Custom((prefix != null ? "~y~" + prefix + " ~w~" : "~y~") + message, duration, drawImmediately); + Custom((prefix != null ? "~y~" + prefix + " ~s~" : "~y~") + message, duration, drawImmediately); } /// @@ -229,7 +229,7 @@ public void Alert(string message, int duration = 2500, bool drawImmediately = tr /// (Optional) add a prefix to your message, if you use this, only the prefix will be colored. The rest of the message will be left white. public void Error(string message, int duration = 2500, bool drawImmediately = true, string prefix = null) { - Custom((prefix != null ? "~r~" + prefix + " ~w~" : "~r~") + message, duration, drawImmediately); + Custom((prefix != null ? "~r~" + prefix + " ~s~" : "~r~") + message, duration, drawImmediately); } /// @@ -241,7 +241,7 @@ public void Error(string message, int duration = 2500, bool drawImmediately = tr /// (Optional) add a prefix to your message, if you use this, only the prefix will be colored. The rest of the message will be left white. public void Info(string message, int duration = 2500, bool drawImmediately = true, string prefix = null) { - Custom((prefix != null ? "~b~" + prefix + " ~w~" : "~b~") + message, duration, drawImmediately); + Custom((prefix != null ? "~b~" + prefix + " ~s~" : "~b~") + message, duration, drawImmediately); } /// @@ -253,7 +253,7 @@ public void Info(string message, int duration = 2500, bool drawImmediately = tru /// (Optional) add a prefix to your message, if you use this, only the prefix will be colored. The rest of the message will be left white. public void Success(string message, int duration = 2500, bool drawImmediately = true, string prefix = null) { - Custom((prefix != null ? "~g~" + prefix + " ~w~" : "~g~") + message, duration, drawImmediately); + Custom((prefix != null ? "~g~" + prefix + " ~s~" : "~g~") + message, duration, drawImmediately); } } #endregion diff --git a/vMenu/menus/MiscSettings.cs b/vMenu/menus/MiscSettings.cs index e400dffd..d0eebb37 100644 --- a/vMenu/menus/MiscSettings.cs +++ b/vMenu/menus/MiscSettings.cs @@ -31,6 +31,7 @@ public class MiscSettings /// private void CreateMenu() { + // Create the menu. menu = new UIMenu(GetPlayerName(PlayerId()), "Misc Settings", true) { diff --git a/vMenu/menus/OnlinePlayers.cs b/vMenu/menus/OnlinePlayers.cs index 8986edc3..abcb8d9d 100644 --- a/vMenu/menus/OnlinePlayers.cs +++ b/vMenu/menus/OnlinePlayers.cs @@ -88,7 +88,7 @@ public void UpdatePlayerlist() summonBtn.SetRightBadge(UIMenuItem.BadgeStyle.Alert); UIMenuItem killBtn = new UIMenuItem("Kill Player", "Kill the selected player! Why are you so cruel :("); killBtn.SetRightBadge(UIMenuItem.BadgeStyle.Alert); - UIMenuItem kickPlayerBtn = new UIMenuItem("~r~Kick Player", "~r~Kick~w~ this player from the server, you need to specify a reason otherwise the kick will be cancelled."); + UIMenuItem kickPlayerBtn = new UIMenuItem("~r~Kick Player", "~r~Kick~s~ this player from the server, you need to specify a reason otherwise the kick will be cancelled."); kickPlayerBtn.SetRightBadge(UIMenuItem.BadgeStyle.Alert); @@ -154,7 +154,7 @@ public void UpdatePlayerlist() if (player.Handle == PlayerId()) { //Subtitle.Error("You can ~h~not~h~ spectate yourself!", prefix: "Error:"); - Notify.Error("Sorry, you can ~r~~h~not~h~ ~w~spectate yourself!"); + Notify.Error("Sorry, you can ~r~~h~not~h~ ~s~spectate yourself!"); } else { @@ -166,7 +166,7 @@ public void UpdatePlayerlist() { if (player.Handle == PlayerId()) { - Notify.Error("Sorry, you can ~r~~h~not~h~ ~w~summon yourself!"); + Notify.Error("Sorry, you can ~r~~h~not~h~ ~s~summon yourself!"); } else { diff --git a/vMenu/menus/PlayerAppearance.cs b/vMenu/menus/PlayerAppearance.cs index 27a7691e..04e505b8 100644 --- a/vMenu/menus/PlayerAppearance.cs +++ b/vMenu/menus/PlayerAppearance.cs @@ -210,7 +210,7 @@ private void RefreshCustomizationMenu() textureList.Add("Item #" + x.ToString()); } UIMenuListItem listItem = new UIMenuListItem($"{textureNames[i]}", textureList, currentDrawable, - $"Use ← & → to select a ~o~{textureNames[i]} Variation~w~, press ~r~enter~w~ to cycle through the available textures."); + $"Use ← & → to select a ~o~{textureNames[i]} Variation~s~, press ~r~enter~s~ to cycle through the available textures."); pedTextures.AddItem(listItem); // Manage list changes. @@ -271,7 +271,7 @@ private void RefreshCustomizationMenu() // Create and add the list item to the menu. UIMenuListItem listItem = new UIMenuListItem($"{propNames[ii > 2 ? ii - 3 : ii]}", propsList, currentProp, - $"Use ← & → to select a ~o~{propNames[ii > 2 ? ii - 3 : ii]} Variation~w~, press ~r~enter~w~ to cycle through the available textures."); + $"Use ← & → to select a ~o~{propNames[ii > 2 ? ii - 3 : ii]} Variation~s~, press ~r~enter~s~ to cycle through the available textures."); pedTextures.AddItem(listItem); @@ -412,7 +412,7 @@ private void RefreshDeleteSavedPedMenu() } foreach (var savename in savesFound) { - UIMenuItem deleteSavedPed = new UIMenuItem(savename.Substring(4), "~r~Delete ~w~this saved ped, this action can ~r~NOT~w~ be undone!"); + UIMenuItem deleteSavedPed = new UIMenuItem(savename.Substring(4), "~r~Delete ~s~this saved ped, this action can ~r~NOT~s~ be undone!"); deleteSavedPed.SetLeftBadge(UIMenuItem.BadgeStyle.Alert); deleteSavedPedMenu.AddItem(deleteSavedPed); } diff --git a/vMenu/menus/PlayerOptions.cs b/vMenu/menus/PlayerOptions.cs index b7516117..54e2cd69 100644 --- a/vMenu/menus/PlayerOptions.cs +++ b/vMenu/menus/PlayerOptions.cs @@ -47,9 +47,9 @@ private void CreateMenu() UIMenuCheckboxItem playerGodModeCheckbox = new UIMenuCheckboxItem("Godmode", PlayerGodMode, "Makes you invincible."); UIMenuCheckboxItem invisibleCheckbox = new UIMenuCheckboxItem("Invisible", PlayerInvisible, "Makes you invisible to yourself and others."); UIMenuCheckboxItem unlimitedStaminaCheckbox = new UIMenuCheckboxItem("Unlimited Stamina", PlayerStamina, "Allows you to run forever without slowing down or taking damage."); - UIMenuCheckboxItem fastRunCheckbox = new UIMenuCheckboxItem("Fast Run", false, "Get ~g~Snail~w~ powers and run very fast!"); - UIMenuCheckboxItem fastSwimCheckbox = new UIMenuCheckboxItem("Fast Swim", false, "Get ~g~Sail 2.0~w~ powers and swim super fast!"); - UIMenuCheckboxItem superJumpCheckbox = new UIMenuCheckboxItem("Super Jump", PlayerSuperJump, "Get ~g~Snail 3.0~w~ powers and jump like a champ!"); + UIMenuCheckboxItem fastRunCheckbox = new UIMenuCheckboxItem("Fast Run", false, "Get ~g~Snail~s~ powers and run very fast!"); + UIMenuCheckboxItem fastSwimCheckbox = new UIMenuCheckboxItem("Fast Swim", false, "Get ~g~Sail 2.0~s~ powers and swim super fast!"); + UIMenuCheckboxItem superJumpCheckbox = new UIMenuCheckboxItem("Super Jump", PlayerSuperJump, "Get ~g~Snail 3.0~s~ powers and jump like a champ!"); UIMenuCheckboxItem noRagdollCheckbox = new UIMenuCheckboxItem("No Ragdoll", PlayerNoRagdoll, "Disables player ragdoll, makes you not fall off your bike anymore."); UIMenuCheckboxItem neverWantedCheckbox = new UIMenuCheckboxItem("Never Wanted", PlayerNeverWanted, "Disables all wanted levels."); UIMenuCheckboxItem everyoneIgnoresPlayerCheckbox = new UIMenuCheckboxItem("Everyone Ignore Player", PlayerIsIgnored, "Everyone will leave you alone."); @@ -198,12 +198,12 @@ private void CreateMenu() // Max Health case 0: SetEntityHealth(PlayerPedId(), GetEntityMaxHealth(PlayerPedId())); - Subtitle.Info("Max ~g~health ~w~applied.", prefix: "Info:"); + Subtitle.Info("Max ~g~health ~s~applied.", prefix: "Info:"); break; // Max Armor case 1: SetPedArmour(PlayerPedId(), GetPlayerMaxArmour(PlayerId())); - Subtitle.Info("Max ~b~armor ~w~applied.", prefix: "Info:"); + Subtitle.Info("Max ~b~armor ~s~applied.", prefix: "Info:"); break; // Clean Player Clothes case 2: @@ -213,24 +213,24 @@ private void CreateMenu() // Make Player Dry case 3: ClearPedWetness(PlayerPedId()); - Subtitle.Info("Player clothes are now ~c~dry~w~.", prefix: "Info:"); + Subtitle.Info("Player clothes are now ~c~dry~s~.", prefix: "Info:"); break; // Make Player Wet case 4: SetPedWetnessHeight(PlayerPedId(), 2f); SetPedWetnessEnabledThisFrame(PlayerPedId()); - Subtitle.Info("Player clothes are now ~b~wet~w~.", prefix: "Info:"); + Subtitle.Info("Player clothes are now ~b~wet~s~.", prefix: "Info:"); break; // Kill Player case 5: SetEntityHealth(PlayerPedId(), 0); - Subtitle.Info("You ~r~killed ~w~yourself.", prefix: "Info:"); + Subtitle.Info("You ~r~killed ~s~yourself.", prefix: "Info:"); break; // Drive To Waypoint case 6: if (!Game.IsWaypointActive) { - Subtitle.Error("You need to set a ~p~waypoint ~w~first!", prefix: "Error:"); + Subtitle.Error("You need to set a ~p~waypoint ~s~first!", prefix: "Error:"); } else if (IsPedInAnyVehicle(PlayerPedId(), false)) { @@ -266,7 +266,7 @@ private void CreateMenu() } else { - Subtitle.Error("You need a ~r~vehicle ~w~first!", prefix: "Error:"); + Subtitle.Error("You need a ~r~vehicle ~s~first!", prefix: "Error:"); } break; default: diff --git a/vMenu/menus/SavedVehicles.cs b/vMenu/menus/SavedVehicles.cs index 897b5c71..2f3f9d5c 100644 --- a/vMenu/menus/SavedVehicles.cs +++ b/vMenu/menus/SavedVehicles.cs @@ -57,7 +57,7 @@ private void CreateMenu() saveVeh.SetRightBadge(UIMenuItem.BadgeStyle.Tick); UIMenuItem savedVehiclesBtn = new UIMenuItem("Spawn Saved Vehicle", "Select a vehicle from your saved vehicles list."); savedVehiclesBtn.SetRightLabel("→→→"); - UIMenuItem deleteSavedVehiclesBtn = new UIMenuItem("~r~Delete Saved Vehicle", "~r~Delete ~w~a saved vehicle."); + UIMenuItem deleteSavedVehiclesBtn = new UIMenuItem("~r~Delete Saved Vehicle", "~r~Delete ~s~a saved vehicle."); deleteSavedVehiclesBtn.SetLeftBadge(UIMenuItem.BadgeStyle.Alert); deleteSavedVehiclesBtn.SetRightLabel("→→→"); diff --git a/vMenu/menus/TimeOptions.cs b/vMenu/menus/TimeOptions.cs index 3c77930b..df4b5567 100644 --- a/vMenu/menus/TimeOptions.cs +++ b/vMenu/menus/TimeOptions.cs @@ -74,7 +74,7 @@ private void CreateMenu() // If it's the freeze time button. if (item == freezeTimeToggle) { - Subtitle.Info($"Time will now {(EventManager.freezeTime ? "~y~continue" : "~o~freeze")}~w~.", prefix: "Info:"); + Subtitle.Info($"Time will now {(EventManager.freezeTime ? "~y~continue" : "~o~freeze")}~s~.", prefix: "Info:"); cf.UpdateServerTime(EventManager.currentHours, EventManager.currentMinutes, !EventManager.freezeTime); } else @@ -93,8 +93,8 @@ private void CreateMenu() } var newMinute = 0; - Subtitle.Info($"Time set to ~y~{(newHour < 10 ? $"0{newHour.ToString()}" : newHour.ToString())}~w~:~y~" + - $"{(newMinute < 10 ? $"0{newMinute.ToString()}" : newMinute.ToString())}~w~.", prefix: "Info:"); + Subtitle.Info($"Time set to ~y~{(newHour < 10 ? $"0{newHour.ToString()}" : newHour.ToString())}~s~:~y~" + + $"{(newMinute < 10 ? $"0{newMinute.ToString()}" : newMinute.ToString())}~s~.", prefix: "Info:"); cf.UpdateServerTime(newHour, newMinute, EventManager.freezeTime); } }; diff --git a/vMenu/menus/VehicleOptions.cs b/vMenu/menus/VehicleOptions.cs index 526d0c42..89abca91 100644 --- a/vMenu/menus/VehicleOptions.cs +++ b/vMenu/menus/VehicleOptions.cs @@ -80,7 +80,7 @@ private void CreateMenu() componentsMenuBtn.SetRightLabel("→→→"); UIMenuItem liveriesMenuBtn = new UIMenuItem("Vehicle Liveries", "Style your vehicle with fancy liveries!"); liveriesMenuBtn.SetRightLabel("→→→"); - UIMenuItem colorsMenuBtn = new UIMenuItem("Vehicle Colors", "Style your vehicle even further by giving it some ~g~Snailsome ~w~colors!"); + UIMenuItem colorsMenuBtn = new UIMenuItem("Vehicle Colors", "Style your vehicle even further by giving it some ~g~Snailsome ~s~colors!"); colorsMenuBtn.SetRightLabel("→→→"); UIMenuItem flipVehicle = new UIMenuItem("Flip Vehicle", "Sets your current vehicle on all 4 wheels."); UIMenuItem vehicleAlarm = new UIMenuItem("Toggle Vehicle Alarm", "Starts/stops your vehicle's alarm."); @@ -105,9 +105,9 @@ private void CreateMenu() // Create lists. var dirtlevel = new List { "No Dirt", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; - UIMenuListItem setDirtLevel = new UIMenuListItem("Set Dirt Level", dirtlevel, 0, "Select how much dirt should be visible on your vehicle, press ~r~enter~w~ to apply the selected level."); + UIMenuListItem setDirtLevel = new UIMenuListItem("Set Dirt Level", dirtlevel, 0, "Select how much dirt should be visible on your vehicle, press ~r~enter~s~ to apply the selected level."); var licensePlates = new List { GetLabelText("CMOD_PLA_0"), GetLabelText("CMOD_PLA_1"), GetLabelText("CMOD_PLA_2"), GetLabelText("CMOD_PLA_3"), GetLabelText("CMOD_PLA_4"), "North Yankton" }; - UIMenuListItem setLicensePlateType = new UIMenuListItem("License Plate Type", licensePlates, 0, "Choose a license plate type and press ~r~enter ~w~to apply it to your vehicle."); + UIMenuListItem setLicensePlateType = new UIMenuListItem("License Plate Type", licensePlates, 0, "Choose a license plate type and press ~r~enter ~s~to apply it to your vehicle."); var torqueMultiplierList = new List { "x2", "x4", "x8", "x16", "x32", "x64", "x128", "x256", "x512", "x1024" }; UIMenuListItem torqueMultiplier = new UIMenuListItem("Set Engine Torque Multiplier", torqueMultiplierList, 0, "Set the engine torque multiplier."); var powerMultiplierList = new List { "x2", "x4", "x8", "x16", "x32", "x64", "x128", "x256", "x512", "x1024" }; @@ -908,10 +908,10 @@ private void CreateMenu() #endregion #region Vehicle Windows Submenu Stuff - UIMenuItem fwu = new UIMenuItem("~y~↑~w~ Roll Front Windows Up", "Roll both front windows up."); - UIMenuItem fwd = new UIMenuItem("~o~↓~w~ Roll Front Windows Down", "Roll both front windows down."); - UIMenuItem rwu = new UIMenuItem("~y~↑~w~ Roll Rear Windows Up", "Roll both rear windows up."); - UIMenuItem rwd = new UIMenuItem("~o~↓~w~ Roll Rear Windows Down", "Roll both rear windows down."); + UIMenuItem fwu = new UIMenuItem("~y~↑~s~ Roll Front Windows Up", "Roll both front windows up."); + UIMenuItem fwd = new UIMenuItem("~o~↓~s~ Roll Front Windows Down", "Roll both front windows down."); + UIMenuItem rwu = new UIMenuItem("~y~↑~s~ Roll Rear Windows Up", "Roll both rear windows up."); + UIMenuItem rwd = new UIMenuItem("~o~↓~s~ Roll Rear Windows Down", "Roll both rear windows down."); VehicleWindowsMenu.AddItem(fwu); VehicleWindowsMenu.AddItem(fwd); VehicleWindowsMenu.AddItem(rwu); @@ -1187,7 +1187,7 @@ public void UpdateMods(int selectedIndex = 0) // Create the UIMenuListItem for this mod type. var currIndex = GetVehicleMod(veh, (int)mod.ModType) + 1; - UIMenuListItem modTypeListItem = new UIMenuListItem(typeName, modlist, currIndex, $"Choose a ~y~{typeName}~w~ upgrade, it will be automatically applied to your vehicle."); + UIMenuListItem modTypeListItem = new UIMenuListItem(typeName, modlist, currIndex, $"Choose a ~y~{typeName}~s~ upgrade, it will be automatically applied to your vehicle."); // Add the list item to the menu. VehicleModMenu.AddItem(modTypeListItem); @@ -1198,14 +1198,14 @@ public void UpdateMods(int selectedIndex = 0) veh = cf.GetVehicle(); // Create the wheel types list & listitem and add it to the menu. List wheelTypes = new List() { "Sports", "Muscle", "Lowrider", "SUV", "Offroad", "Tuner", "Bike Wheels", "High End" }; - UIMenuListItem vehicleWheelType = new UIMenuListItem("Wheel Type", wheelTypes, GetVehicleWheelType(veh), $"Choose a ~y~wheel type~w~ for your vehicle. ~r~Important:~w~ if you change the wheel type, you will need to back out of the Vehicle Mods menu for the Wheels List to update."); + UIMenuListItem vehicleWheelType = new UIMenuListItem("Wheel Type", wheelTypes, GetVehicleWheelType(veh), $"Choose a ~y~wheel type~s~ for your vehicle. ~r~Important:~s~ if you change the wheel type, you will need to back out of the Vehicle Mods menu for the Wheels List to update."); VehicleModMenu.AddItem(vehicleWheelType); // Create the checkboxes for some options. - UIMenuCheckboxItem toggleCustomWheels = new UIMenuCheckboxItem("Toggle Custom Wheels", GetVehicleModVariation(veh, 23), "Press this to add or remove ~y~custom~w~ wheels."); - UIMenuCheckboxItem xenonHeadlights = new UIMenuCheckboxItem("Xenon Headlights", IsToggleModOn(veh, 22), "Enable or disable ~b~xenon ~w~headlights."); - UIMenuCheckboxItem turbo = new UIMenuCheckboxItem("Turbo", IsToggleModOn(veh, 18), "Enable or disable the ~y~turbo~w~ for this vehicle."); - UIMenuCheckboxItem bulletProofTires = new UIMenuCheckboxItem("Bullet Proof Tires", !GetVehicleTyresCanBurst(veh), "Enable or disable ~y~bullet proof tires~w~ for this vehicle."); + UIMenuCheckboxItem toggleCustomWheels = new UIMenuCheckboxItem("Toggle Custom Wheels", GetVehicleModVariation(veh, 23), "Press this to add or remove ~y~custom~s~ wheels."); + UIMenuCheckboxItem xenonHeadlights = new UIMenuCheckboxItem("Xenon Headlights", IsToggleModOn(veh, 22), "Enable or disable ~b~xenon ~s~headlights."); + UIMenuCheckboxItem turbo = new UIMenuCheckboxItem("Turbo", IsToggleModOn(veh, 18), "Enable or disable the ~y~turbo~s~ for this vehicle."); + UIMenuCheckboxItem bulletProofTires = new UIMenuCheckboxItem("Bullet Proof Tires", !GetVehicleTyresCanBurst(veh), "Enable or disable ~y~bullet proof tires~s~ for this vehicle."); // Add the checkboxes to the menu. VehicleModMenu.AddItem(toggleCustomWheels); @@ -1228,11 +1228,11 @@ public void UpdateMods(int selectedIndex = 0) ["Pink"] = new int[] { 192, 24, 172 }, ["Black"] = new int[] { 1, 1, 1 } }; - UIMenuListItem tireSmoke = new UIMenuListItem("Tire Smoke Color", tireSmokes, 0, $"Choose a ~y~wheel type~w~ for your vehicle."); + UIMenuListItem tireSmoke = new UIMenuListItem("Tire Smoke Color", tireSmokes, 0, $"Choose a ~y~wheel type~s~ for your vehicle."); VehicleModMenu.AddItem(tireSmoke); // Create the checkbox to enable/disable the tiresmoke. - UIMenuCheckboxItem tireSmokeEnabled = new UIMenuCheckboxItem("Tire Smoke", IsToggleModOn(veh, 20), "Enable or disable ~y~tire smoke~w~ for your vehicle. ~h~~r~Important:~w~ When disabling tire smoke, you'll need to drive around before it takes affect."); + UIMenuCheckboxItem tireSmokeEnabled = new UIMenuCheckboxItem("Tire Smoke", IsToggleModOn(veh, 20), "Enable or disable ~y~tire smoke~s~ for your vehicle. ~h~~r~Important:~s~ When disabling tire smoke, you'll need to drive around before it takes affect."); VehicleModMenu.AddItem(tireSmokeEnabled); // Create list for window tint diff --git a/vMenu/menus/VehicleSpawner.cs b/vMenu/menus/VehicleSpawner.cs index 5c702584..6514aad7 100644 --- a/vMenu/menus/VehicleSpawner.cs +++ b/vMenu/menus/VehicleSpawner.cs @@ -86,7 +86,7 @@ private void CreateMenu() 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} ~w~class."); + UIMenuItem btn = new UIMenuItem(className, $"Spawn a vehicle from the ~o~{className} ~s~class."); btn.SetRightLabel("→→→"); UIMenu vehicleClassMenu = new UIMenu("Vehicle Spawner", className, true) { diff --git a/vMenu/menus/VoiceChat.cs b/vMenu/menus/VoiceChat.cs index d777a075..a1b87954 100644 --- a/vMenu/menus/VoiceChat.cs +++ b/vMenu/menus/VoiceChat.cs @@ -108,12 +108,12 @@ private void CreateMenu() if (item == voiceChatProximity) { currentProximity = proximityRange[index]; - Subtitle.Custom($"New voice chat proximity set to: ~b~{proximity[index]}~w~."); + Subtitle.Custom($"New voice chat proximity set to: ~b~{proximity[index]}~s~."); } else if (item == voiceChatChannel) { currentChannel = channels[index]; - Subtitle.Custom($"New voice chat channel set to: ~b~{channels[index]}~w~."); + Subtitle.Custom($"New voice chat channel set to: ~b~{channels[index]}~s~."); } }; diff --git a/vMenu/menus/WeaponOptions.cs b/vMenu/menus/WeaponOptions.cs index 0454c7cb..b6f435a2 100644 --- a/vMenu/menus/WeaponOptions.cs +++ b/vMenu/menus/WeaponOptions.cs @@ -57,7 +57,7 @@ private void CreateMenu() MouseEdgeEnabled = false, ControlDisablingEnabled = false }; - UIMenuItem weaponItem = new UIMenuItem(weapon.Name, $"Open the options for ~y~{weapon.Name.ToString()}~w~."); + UIMenuItem weaponItem = new UIMenuItem(weapon.Name, $"Open the options for ~y~{weapon.Name.ToString()}~s~."); weaponItem.SetRightLabel("→→→"); weaponItem.SetLeftBadge(UIMenuItem.BadgeStyle.Gun); diff --git a/vMenu/menus/WeatherOptions.cs b/vMenu/menus/WeatherOptions.cs index 8df7b98d..fffd916a 100644 --- a/vMenu/menus/WeatherOptions.cs +++ b/vMenu/menus/WeatherOptions.cs @@ -32,21 +32,21 @@ private void CreateMenu() UIMenuItem dynamicWeatherEnabled = new UIMenuItem("Toggle Dynamic Weather", "Enable or disable dynamic weather changes."); UIMenuItem blackout = new UIMenuItem("Toggle Blackout", "This disables or enables all lights across the map. Regardless of this setting, there will always be a very rare chance during thunder storms that the \"power\" will cut out (only lasting 2 minutes max)."); - UIMenuItem extrasunny = new UIMenuItem("Extra Sunny", "Set the weather to ~y~extra sunny~w~!"); - UIMenuItem clear = new UIMenuItem("Clear", "Set the weather to ~y~clear~w~!"); - UIMenuItem neutral = new UIMenuItem("Neutral", "Set the weather to ~y~neutral~w~!"); - UIMenuItem smog = new UIMenuItem("Smog", "Set the weather to ~y~smog~w~!"); - UIMenuItem foggy = new UIMenuItem("Foggy", "Set the weather to ~y~foggy~w~!"); - UIMenuItem clouds = new UIMenuItem("Cloudy", "Set the weather to ~y~clouds~w~!"); - UIMenuItem overcast = new UIMenuItem("Overcast", "Set the weather to ~y~overcast~w~!"); - UIMenuItem clearing = new UIMenuItem("Clearing", "Set the weather to ~y~clearing~w~!"); - UIMenuItem rain = new UIMenuItem("Rainy", "Set the weather to ~y~rain~w~!"); - UIMenuItem thunder = new UIMenuItem("Thunder", "Set the weather to ~y~thunder~w~!"); - UIMenuItem blizzard = new UIMenuItem("Blizzard", "Set the weather to ~y~blizzard~w~!"); - UIMenuItem snow = new UIMenuItem("Snow", "Set the weather to ~y~snow~w~!"); - UIMenuItem snowlight = new UIMenuItem("Light Snow", "Set the weather to ~y~light snow~w~!"); - UIMenuItem xmas = new UIMenuItem("X-MAS Snow", "Set the weather to ~y~x-mas~w~!"); - UIMenuItem halloween = new UIMenuItem("Halloween", "Set the weather to ~y~halloween~w~!"); + UIMenuItem extrasunny = new UIMenuItem("Extra Sunny", "Set the weather to ~y~extra sunny~s~!"); + UIMenuItem clear = new UIMenuItem("Clear", "Set the weather to ~y~clear~s~!"); + UIMenuItem neutral = new UIMenuItem("Neutral", "Set the weather to ~y~neutral~s~!"); + UIMenuItem smog = new UIMenuItem("Smog", "Set the weather to ~y~smog~s~!"); + UIMenuItem foggy = new UIMenuItem("Foggy", "Set the weather to ~y~foggy~s~!"); + UIMenuItem clouds = new UIMenuItem("Cloudy", "Set the weather to ~y~clouds~s~!"); + UIMenuItem overcast = new UIMenuItem("Overcast", "Set the weather to ~y~overcast~s~!"); + UIMenuItem clearing = new UIMenuItem("Clearing", "Set the weather to ~y~clearing~s~!"); + UIMenuItem rain = new UIMenuItem("Rainy", "Set the weather to ~y~rain~s~!"); + UIMenuItem thunder = new UIMenuItem("Thunder", "Set the weather to ~y~thunder~s~!"); + UIMenuItem blizzard = new UIMenuItem("Blizzard", "Set the weather to ~y~blizzard~s~!"); + UIMenuItem snow = new UIMenuItem("Snow", "Set the weather to ~y~snow~s~!"); + UIMenuItem snowlight = new UIMenuItem("Light Snow", "Set the weather to ~y~light snow~s~!"); + UIMenuItem xmas = new UIMenuItem("X-MAS Snow", "Set the weather to ~y~x-mas~s~!"); + UIMenuItem halloween = new UIMenuItem("Halloween", "Set the weather to ~y~halloween~s~!"); UIMenuItem removeclouds = new UIMenuItem("Remove All Clouds", "Remove all clouds from the sky!"); UIMenuItem randomizeclouds = new UIMenuItem("Randomize Clouds", "Add random clouds to the sky!"); @@ -114,18 +114,18 @@ private void CreateMenu() // A weather type is selected. if (index >= 2 && index <= 16) { - Notify.Custom($"The almighty ~g~Snail~w~ will change the weather to ~y~{weatherTypes[index - 2]}~w~."); + Notify.Custom($"The almighty ~g~Snail~s~ will change the weather to ~y~{weatherTypes[index - 2]}~s~."); cf.UpdateServerWeather(weatherTypes[index - 2], EventManager.blackoutMode, EventManager.dynamicWeather); } if (item == blackout) { - Notify.Custom($"The almighty ~g~Snail~w~ will ~y~{(!EventManager.blackoutMode ? "enable" : "disable")}~w~ blackout mode."); + Notify.Custom($"The almighty ~g~Snail~s~ will ~y~{(!EventManager.blackoutMode ? "enable" : "disable")}~s~ blackout mode."); cf.UpdateServerWeather(EventManager.currentWeatherType, !EventManager.blackoutMode, EventManager.dynamicWeather); } else if (item == dynamicWeatherEnabled) { - Notify.Custom($"The almighty ~g~Snail~w~ will ~y~{(!EventManager.dynamicWeather ? "enable" : "disable")}~w~ dynamic weather changes."); + Notify.Custom($"The almighty ~g~Snail~s~ will ~y~{(!EventManager.dynamicWeather ? "enable" : "disable")}~s~ dynamic weather changes."); cf.UpdateServerWeather(EventManager.currentWeatherType, EventManager.blackoutMode, !EventManager.dynamicWeather); } else if (item == removeclouds) From 52ff0084aae27f88d632323bc732806d0b6a95bb Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:26:01 +0100 Subject: [PATCH 12/21] Changed some debug stuff --- vMenu/menus/PlayerOptions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vMenu/menus/PlayerOptions.cs b/vMenu/menus/PlayerOptions.cs index 54e2cd69..9bd081e2 100644 --- a/vMenu/menus/PlayerOptions.cs +++ b/vMenu/menus/PlayerOptions.cs @@ -240,13 +240,13 @@ private void CreateMenu() } catch (NotImplementedException e) { - Debug.Write("\n\r[vMenu] Exception: " + e.Message + "\r\n"); + cf.Log("\n\r[vMenu] Exception: " + e.Message + "\r\n"); Notify.Error(CommonErrors.UnknownError, placeholderValue: "This function is not implemented yet."); } } else { - Subtitle.Error("You need a ~r~vehicle ~w~first!", prefix: "Error:"); + Subtitle.Error("You need a ~r~vehicle ~s~first!", prefix: "Error:"); } break; // Drive Around Randomly (wander) @@ -259,7 +259,7 @@ private void CreateMenu() } catch (NotImplementedException e) { - Debug.Write("\n\r[vMenu] Exception: " + e.Message + "\r\n"); + cf.Log("\n\r[vMenu] Exception: " + e.Message + "\r\n"); Notify.Error(CommonErrors.UnknownError, placeholderValue: "This function is not implemented yet."); } From ce3bb2c3d2be875a47b4bf43dc04dcc4f6da4c58 Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:27:36 +0100 Subject: [PATCH 13/21] Removed broken features that are unresolvable --- vMenu/menus/VehicleOptions.cs | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/vMenu/menus/VehicleOptions.cs b/vMenu/menus/VehicleOptions.cs index 89abca91..e1df9042 100644 --- a/vMenu/menus/VehicleOptions.cs +++ b/vMenu/menus/VehicleOptions.cs @@ -90,12 +90,12 @@ private void CreateMenu() "Hazard Lights", "Left Indicator", "Right Indicator", - "Interior Lights", - "Taxi Light", + //"Interior Lights", + //"Taxi Light", // this doesn't seem to work no matter what. "Helicopter Spotlight", }; UIMenuListItem vehicleLights = new UIMenuListItem("Vehicle Lights", lights, 0, "Turn vehicle lights on/off."); - UIMenuItem deleteBtn = new UIMenuItem("~r~Delete Vehicle", "Delete your vehicle, this ~r~can NOT be undone~w~!"); + UIMenuItem deleteBtn = new UIMenuItem("~r~Delete Vehicle", "Delete your vehicle, this ~r~can NOT be undone~s~!"); deleteBtn.SetLeftBadge(UIMenuItem.BadgeStyle.Alert); deleteBtn.SetRightLabel("→→→"); UIMenuItem deleteNoBtn = new UIMenuItem("NO, CANCEL", "NO, do NOT delete my vehicle and go back!"); @@ -548,15 +548,22 @@ private void CreateMenu() SetVehicleIndicatorLights(veh, 0, false); // right off } } - else if (index == 3) // Interior lights - { - SetVehicleInteriorlight(veh, !IsVehicleInteriorLightOn(veh)); - } - else if (index == 4) // taxi light - { - SetTaxiLights(veh, !IsTaxiLightOn(veh)); - } - else if (index == 5) // helicopter spotlight + //else if (index == 3) // Interior lights + //{ + // cf.Log("Something cool here."); + //} + //else if (index == 4) // taxi light + //{ + // SetTaxiLights(veh, true); + // SetTaxiLights(veh, false); + // //Debug.Write(IsTaxiLightOn(veh).ToString()); + // //SetTaxiLights(veh, true); + // //Debug.Write(IsTaxiLightOn(veh).ToString()); + // //SetTaxiLights(veh, false); + // //SetTaxiLights(veh, !IsTaxiLightOn(veh)); + // Debug.Write + //} + else if (index == 3) // helicopter spotlight { SetVehicleSearchlight(veh, !IsVehicleSearchlightOn(veh), true); } From da12be0487c3df9ab6726d768870e71b5498894c Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:27:59 +0100 Subject: [PATCH 14/21] Changed voice proximity range presets --- vMenu/menus/VoiceChat.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/vMenu/menus/VoiceChat.cs b/vMenu/menus/VoiceChat.cs index a1b87954..6c5d86fc 100644 --- a/vMenu/menus/VoiceChat.cs +++ b/vMenu/menus/VoiceChat.cs @@ -27,18 +27,16 @@ public class VoiceChat "Channel 4", }; public string currentChannel; - - private List proximityRange = new List() { + 5f, // 5m + 10f, // 10m + 15f, // 15m 20f, // 20m - 50f, // 50m 100f, // 100m - 150f, // 150m 300f, // 300m - 500f, // 500m + 1000f, // 1.000m 2000f, // 2.000m - 5000f, // 5.000m 0f, // global }; @@ -64,14 +62,14 @@ private void CreateMenu() List proximity = new List() { + "5 m", + "10 m", + "15 m", "20 m", - "50 m", "100 m", - "150 m", "300 m", - "500 m", + "1 km", "2 km", - "5 km", "Global", }; UIMenuListItem voiceChatProximity = new UIMenuListItem("Voice Chat Proximity", proximity, proximityRange.IndexOf(currentProximity), "Set the voice chat receiving proximity in meters."); From 1e1b380947d2aa97c11b4e66b536d45a26c31edd Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:28:15 +0100 Subject: [PATCH 15/21] Added null check to prevent crashes --- vMenu/Notification.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vMenu/Notification.cs b/vMenu/Notification.cs index eef76b9a..42921ecb 100644 --- a/vMenu/Notification.cs +++ b/vMenu/Notification.cs @@ -104,10 +104,14 @@ public struct Notification public void Custom(string message, bool blink = false, bool saveToBrief = true) { SetNotificationTextEntry("THREESTRINGS"); - var messages = MainMenu.Cf.StringToArray(message); - foreach (var msg in messages) + string[] messages = MainMenu.Cf.StringToArray(message); + foreach (string msg in messages) { - AddTextComponentSubstringPlayerName(msg); + if (msg != null) + { + AddTextComponentSubstringPlayerName(msg); + } + } DrawNotification(blink, saveToBrief); } From bd39ebf48c5ebaa9c5bcb9b32f0b86e2ab441abc Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:28:46 +0100 Subject: [PATCH 16/21] Added some missing saved settings & fixed a null exception bug --- vMenu/UserDefaults.cs | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/vMenu/UserDefaults.cs b/vMenu/UserDefaults.cs index 57ac1c19..35a0f156 100644 --- a/vMenu/UserDefaults.cs +++ b/vMenu/UserDefaults.cs @@ -225,13 +225,21 @@ private static void SetSavedSettingsBool(string kvpString, bool newValue) private static float GetSettingsFloat(string kvpString) { - if ((FindKvp(StartFindKvp(SETTINGS_PREFIX + kvpString)) ?? "") != "") + float savedValue = GetResourceKvpFloat(SETTINGS_PREFIX + kvpString); + if (savedValue.ToString() != null) // this can still become null for some reason, so that's why we check it. { - float savedValue = GetResourceKvpFloat(SETTINGS_PREFIX + kvpString); - return savedValue; + if (savedValue.GetType() == typeof(float)) + { + return savedValue; + } + else + { + return -1f; + } } else { + SetSavedSettingsFloat(SETTINGS_PREFIX + kvpString, -1f); return -1f; } } @@ -285,14 +293,19 @@ public static void SaveSettingsAsync() VehicleSpawnerSpawnInside = MainMenu.VehicleSpawnerMenu.SpawnInVehicle; } - // Todo: - //VoiceChatEnabled - //WeaponsNoReload - //WeaponsUnlimitedAmmo + if (MainMenu.VoiceChatSettingsMenu != null) + { + VoiceChatEnabled = MainMenu.VoiceChatSettingsMenu.EnableVoicechat; + VoiceChatProximity = MainMenu.VoiceChatSettingsMenu.currentProximity; + } + if (MainMenu.WeaponOptionsMenu != null) + { + WeaponsNoReload = MainMenu.WeaponOptionsMenu.NoReload; + WeaponsUnlimitedAmmo = MainMenu.WeaponOptionsMenu.UnlimitedAmmo; + } MainMenu.Notify.Success("Your settings have been saved."); - } #endregion From 0a2280bb3c10b24c3650e7637eebc6dcfa95d55e Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:28:55 +0100 Subject: [PATCH 17/21] Added info --- vMenu/ValidWeapon.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vMenu/ValidWeapon.cs b/vMenu/ValidWeapon.cs index 9e1af50f..ef9df52b 100644 --- a/vMenu/ValidWeapon.cs +++ b/vMenu/ValidWeapon.cs @@ -147,6 +147,9 @@ public ValidWeapons() ["SmokeGrenade"] = "Tear Gas", }; + /// + /// Key = Weapon Name (NOT localized - string), value = hash (uint). + /// public static Dictionary Weapons = new Dictionary() { ["AdvancedRifle"] = 2937143193, From 6330765d84414f2deff397a2932c944fbf80d424 Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:29:08 +0100 Subject: [PATCH 18/21] Reworked default permissions template --- vMenuServer/config/permissions.cfg | 197 ++++++++++++++--------------- 1 file changed, 98 insertions(+), 99 deletions(-) diff --git a/vMenuServer/config/permissions.cfg b/vMenuServer/config/permissions.cfg index c4d5fcac..5e047907 100644 --- a/vMenuServer/config/permissions.cfg +++ b/vMenuServer/config/permissions.cfg @@ -9,31 +9,30 @@ -######## Groups inheritance setup ######## -# Admin group gets all permissions of the moderator group. -add_principal group.admin group.moderator - ######## Add players to groups ######## # Admin group players: -#add_principal identifier.steam:110000105959047 group.admin - +add_principal identifier.steam:110000105959047 group.admin # Moderator group players: -#add_principal identifier.license:4510587c13e0b645eb8d24bc104601792277ab98 group.moderator +add_principal identifier.license:4510587c13e0b645eb8d24bc104601792277ab98 group.moderator + +## Setup group inheritance, it's probably best you don't touch this unless you know what you're doing. +add_principal group.admin group.moderator + ## Setup Permissions -# Global -add_ace builtin.everyone "vMenu.Everything" deny # (Don't set this to allow, or bad things will happen) +# Global Permissions +add_ace builtin.everyone "vMenu.Everything" deny # (Don't set this to allow, or bad things will happen if you don't modify some things) # Admins can't be kicked from the server, everyone else can be kicked though. add_ace group.admin "vMenu.DontKickMe" allow # Online Players add_ace builtin.everyone "vMenu.OnlinePlayers.Menu" allow -add_ace builtin.everyone "vMenu.OnlinePlayers.All" deny +#add_ace builtin.everyone "vMenu.OnlinePlayers.All" allow add_ace builtin.everyone "vMenu.OnlinePlayers.Teleport" allow add_ace builtin.everyone "vMenu.OnlinePlayers.Waypoint" allow add_ace builtin.everyone "vMenu.OnlinePlayers.Spectate" allow @@ -44,121 +43,121 @@ add_ace group.moderator "vMenu.OnlinePlayers.Kick" allow # Player Options add_ace builtin.everyone "vMenu.PlayerOptions.Menu" allow -add_ace builtin.everyone "vMenu.PlayerOptions.All" deny -add_ace builtin.everyone "vMenu.PlayerOptions.God" allow -add_ace builtin.everyone "vMenu.PlayerOptions.Invisible" allow -add_ace builtin.everyone "vMenu.PlayerOptions.FastRun" allow -add_ace builtin.everyone "vMenu.PlayerOptions.FastSwim" allow -add_ace builtin.everyone "vMenu.PlayerOptions.Superjump" allow -add_ace builtin.everyone "vMenu.PlayerOptions.NoRagdoll" allow -add_ace builtin.everyone "vMenu.PlayerOptions.NeverWanted" allow -add_ace builtin.everyone "vMenu.PlayerOptions.SetWanted" allow -add_ace builtin.everyone "vMenu.PlayerOptions.Ignored" allow -add_ace builtin.everyone "vMenu.PlayerOptions.Functions" allow -add_ace builtin.everyone "vMenu.PlayerOptions.Freeze" allow -add_ace builtin.everyone "vMenu.PlayerOptions.Scenarios" allow +add_ace builtin.everyone "vMenu.PlayerOptions.All" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.God" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.Invisible" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.FastRun" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.FastSwim" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.Superjump" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.NoRagdoll" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.NeverWanted" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.SetWanted" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.Ignored" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.Functions" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.Freeze" allow +#add_ace builtin.everyone "vMenu.PlayerOptions.Scenarios" allow # Vehicle Options add_ace builtin.everyone "vMenu.VehicleOptions.Menu" allow -add_ace builtin.everyone "vMenu.VehicleOptions.All" deny -add_ace builtin.everyone "vMenu.VehicleOptions.God" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Repair" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Wash" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Engine" allow -add_ace builtin.everyone "vMenu.VehicleOptions.ChangePlate" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Mod" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Colors" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Liveries" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Components" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Doors" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Windows" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Freeze" allow -add_ace builtin.everyone "vMenu.VehicleOptions.TorqueMultiplier" allow -add_ace builtin.everyone "vMenu.VehicleOptions.PowerMultiplier" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Flip" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Alarm" allow -add_ace builtin.everyone "vMenu.VehicleOptions.CycleSeats" allow -add_ace builtin.everyone "vMenu.VehicleOptions.EngineAlwaysOn" allow -add_ace builtin.everyone "vMenu.VehicleOptions.NoSiren" allow -add_ace builtin.everyone "vMenu.VehicleOptions.NoHelmet" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Lights" allow -add_ace builtin.everyone "vMenu.VehicleOptions.Delete" allow +add_ace builtin.everyone "vMenu.VehicleOptions.All" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.God" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Repair" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Wash" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Engine" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.ChangePlate" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Mod" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Colors" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Liveries" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Components" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Doors" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Windows" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Freeze" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.TorqueMultiplier" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.PowerMultiplier" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Flip" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Alarm" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.CycleSeats" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.EngineAlwaysOn" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.NoSiren" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.NoHelmet" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Lights" allow +#add_ace builtin.everyone "vMenu.VehicleOptions.Delete" allow # Vehicle Spawner add_ace builtin.everyone "vMenu.VehicleSpawner.Menu" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.All" deny -add_ace builtin.everyone "vMenu.VehicleSpawner.SpawnByName" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Compacts" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Sedans" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.SUVs" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Coupes" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Muscle" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.SportsClassic" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Sports" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Super" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Motorcycles" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.OffRoad" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Industrial" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Utility" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Vans" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Cycles" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Boats" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Helicopters" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Planes" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Service" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Emergency" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Military" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Commercial" allow -add_ace builtin.everyone "vMenu.VehicleSpawner.Trains" allow +add_ace builtin.everyone "vMenu.VehicleSpawner.All" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.SpawnByName" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Compacts" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Sedans" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.SUVs" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Coupes" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Muscle" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.SportsClassic" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Sports" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Super" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Motorcycles" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.OffRoad" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Industrial" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Utility" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Vans" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Cycles" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Boats" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Helicopters" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Planes" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Service" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Emergency" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Military" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Commercial" allow +#add_ace builtin.everyone "vMenu.VehicleSpawner.Trains" allow # Saved Vehicles add_ace builtin.everyone "vMenu.SavedVehicles.Menu" allow -add_ace builtin.everyone "vMenu.SavedVehicles.All" deny -add_ace builtin.everyone "vMenu.SavedVehicles.Spawn" allow +add_ace builtin.everyone "vMenu.SavedVehicles.All" allow +#add_ace builtin.everyone "vMenu.SavedVehicles.Spawn" allow # Player Appearance add_ace builtin.everyone "vMenu.PlayerAppearance.Menu" allow -add_ace builtin.everyone "vMenu.PlayerAppearance.All" deny -add_ace builtin.everyone "vMenu.PlayerAppearance.Customize" allow -add_ace builtin.everyone "vMenu.PlayerAppearance.SpawnSaved" allow -add_ace builtin.everyone "vMenu.PlayerAppearance.SpawnNew" allow +add_ace builtin.everyone "vMenu.PlayerAppearance.All" allow +#add_ace builtin.everyone "vMenu.PlayerAppearance.Customize" allow +#add_ace builtin.everyone "vMenu.PlayerAppearance.SpawnSaved" allow +#add_ace builtin.everyone "vMenu.PlayerAppearance.SpawnNew" allow # Time Options (restricted to moderators & admins only) add_ace group.moderator "vMenu.TimeOptions.Menu" allow -add_ace builtin.everyone "vMenu.TimeOptions.All" deny -add_ace group.moderator "vMenu.TimeOptions.FreezeTime" allow -add_ace group.moderator "vMenu.TimeOptions.SetTime" allow +add_ace group.moderator "vMenu.TimeOptions.All" allow +#add_ace group.moderator "vMenu.TimeOptions.FreezeTime" allow +#add_ace group.moderator "vMenu.TimeOptions.SetTime" allow # Weather Options (restricted to moderators & admins only) add_ace group.moderator "vMenu.WeatherOptions.Menu" allow -add_ace builtin.everyone "vMenu.WeatherOptions.All" deny -add_ace group.moderator "vMenu.WeatherOptions.Dynamic" allow -add_ace group.moderator "vMenu.WeatherOptions.Blackout" allow -add_ace group.moderator "vMenu.WeatherOptions.SetWeather" allow -add_ace group.moderator "vMenu.WeatherOptions.RemoveClouds" allow -add_ace group.moderator "vMenu.WeatherOptions.RandomizeClouds" allow +add_ace group.moderator "vMenu.WeatherOptions.All" allow +#add_ace group.moderator "vMenu.WeatherOptions.Dynamic" allow +#add_ace group.moderator "vMenu.WeatherOptions.Blackout" allow +#add_ace group.moderator "vMenu.WeatherOptions.SetWeather" allow +#add_ace group.moderator "vMenu.WeatherOptions.RemoveClouds" allow +#add_ace group.moderator "vMenu.WeatherOptions.RandomizeClouds" allow # Weapon Options add_ace builtin.everyone "vMenu.WeaponOptions.Menu" allow -add_ace builtin.everyone "vMenu.WeaponOptions.All" deny -add_ace builtin.everyone "vMenu.WeaponOptions.GetAll" allow -add_ace builtin.everyone "vMenu.WeaponOptions.RemoveAll" allow -add_ace builtin.everyone "vMenu.WeaponOptions.UnlimitedAmmo" allow -add_ace builtin.everyone "vMenu.WeaponOptions.NoReload" allow +add_ace builtin.everyone "vMenu.WeaponOptions.All" allow +#add_ace builtin.everyone "vMenu.WeaponOptions.GetAll" allow +#add_ace builtin.everyone "vMenu.WeaponOptions.RemoveAll" allow +#add_ace builtin.everyone "vMenu.WeaponOptions.UnlimitedAmmo" allow +#add_ace builtin.everyone "vMenu.WeaponOptions.NoReload" allow # Misc Settings add_ace builtin.everyone "vMenu.MiscSettings.Menu" allow -add_ace builtin.everyone "vMenu.MiscSettings.All" deny -add_ace builtin.everyone "vMenu.MiscSettings.TeleportToWp" allow -add_ace builtin.everyone "vMenu.MiscSettings.ShowCoordinates" allow -add_ace builtin.everyone "vMenu.MiscSettings.ShowLocation" allow -add_ace builtin.everyone "vMenu.MiscSettings.JoinQuitNotifs" allow -add_ace builtin.everyone "vMenu.MiscSettings.DeathNotifs" allow +add_ace builtin.everyone "vMenu.MiscSettings.All" allow +#add_ace builtin.everyone "vMenu.MiscSettings.TeleportToWp" allow +#add_ace builtin.everyone "vMenu.MiscSettings.ShowCoordinates" allow +#add_ace builtin.everyone "vMenu.MiscSettings.ShowLocation" allow +#add_ace builtin.everyone "vMenu.MiscSettings.JoinQuitNotifs" allow +#add_ace builtin.everyone "vMenu.MiscSettings.DeathNotifs" allow # Voice Chat add_ace builtin.everyone "vMenu.VoiceChat.Menu" allow -add_ace builtin.everyone "vMenu.VoiceChat.All" deny +#add_ace builtin.everyone "vMenu.VoiceChat.All" allow add_ace builtin.everyone "vMenu.VoiceChat.Enable" allow add_ace builtin.everyone "vMenu.VoiceChat.ShowSpeaker" allow -# Restrict the voice chat to moderators and admins only -add_ace group.moderator "vMenu.VoiceChat.StaffChannel" allow + +add_ace group.moderator "vMenu.VoiceChat.StaffChannel" allow # Restrict the voice chat staff channel to moderators and admins only From 8a92100e422bf0cf7f700da6a82a2ce4d878194e Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:29:25 +0100 Subject: [PATCH 19/21] Fixed "Dont Kick Me" permissions bug --- vMenuServer/EventManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vMenuServer/EventManager.cs b/vMenuServer/EventManager.cs index a214a77c..6c6d14c3 100644 --- a/vMenuServer/EventManager.cs +++ b/vMenuServer/EventManager.cs @@ -381,7 +381,7 @@ private void KickPlayer([FromSource] Player source, int target, string kickReaso { // If the player is allowed to be kicked. var targetPlayer = new PlayerList()[target]; - if (!IsPlayerAceAllowed(targetPlayer.Handle, "vMenu.dontkick")) + if (!IsPlayerAceAllowed(targetPlayer.Handle, "vMenu.DontKickMe")) { // Kick the player from the server using the specified reason. DropPlayer(targetPlayer.Handle, kickReason); From 1483ab682b221eca32822fafad016dd2dca4661a Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Wed, 7 Mar 2018 23:55:29 +0100 Subject: [PATCH 20/21] Updated readme and moved permissions list to permissions.md --- PERMISSIONS.md | 183 ++++++++++++++++++++++++++++++++++++++++ README.md | 221 +++++++------------------------------------------ 2 files changed, 213 insertions(+), 191 deletions(-) create mode 100644 PERMISSIONS.md diff --git a/PERMISSIONS.md b/PERMISSIONS.md new file mode 100644 index 00000000..27bd7da5 --- /dev/null +++ b/PERMISSIONS.md @@ -0,0 +1,183 @@ +## Features & Permissions List +**Almost all features have custom permissions options. Some options without permissions are not listed below, however they are present in the menu itself.** +>### ⚠ Please note that ALL permissions are `CaSeSeNSItIve`! + +## Global Permissions +**Notes:** +1. __\*__ The `Default (allowed/denied)` values are based on the assumption that you use the default permissions file included with the menu, and you've granted yourself no special permissions or added yourself to any of the admin/moderator groups. If you **DON'T** use the default permissions file, then every option will be **DENIED** by default. +2. __\*\*__ These options are only allowed by default for the "Moderators" / "Admins" groups in the provided permissions file with this resource. +3. __\*\*\*__ When spawning a car using the `Spawn By Name` button, it will always check to see if you have permission for that specific vehicle's class. eg: If you don't have permission to spawn cars from the `Super` class, trying to spawn an `adder` using the `Spawn By Name` button won't work. + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.Everything`|Grants access to everything, not recommended to give this out.|Denied| +|`vMenu.DontKickMe`|Prevents this player from being kicked.|Denied| + +## Online Players + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.OnlinePlayers.Menu`|Grants access to the Online Players Menu|Allowed| +|`vMenu.OnlinePlayers.All`|Grants access to **ALL** `Online Players Menu` options.|Denied| +|`vMenu.OnlinePlayers.Teleport`|Allows you to teleport to another player.|Allowed| +|`vMenu.OnlinePlayers.Waypoint`|Allows you to set a waypoint to another player.|Allowed| +|`vMenu.OnlinePlayers.Spectate`|Allows you to spectate another player.|Allowed| +|`vMenu.OnlinePlayers.Summon`|Allows you to summon/teleport another player to you.|Denied| +|`vMenu.OnlinePlayers.Kill`|Allows you to kill another player by pressing a button. Dam, you're very cruel.|Denied| +|`vMenu.OnlinePlayers.Kick`|Allows you to kick another player from the server.|Denied| + +## Player Options + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.PlayerOptions.Menu`|Grants access to the Player Options Menu.|Allowed| +|`vMenu.PlayerOptions.All`|Grants access to **ALL** `Player Options Menu` options.|Denied| +|`vMenu.PlayerOptions.God`|Allows you to use god mode.|Allowed| +|`vMenu.PlayerOptions.Invisible`|Allows you to go invisble.|Allowed| +|`vMenu.PlayerOptions.FastRun`|Allows you to enable Fast Run.|Allowed| +|`vMenu.PlayerOptions.FastSwim`|Allows you to enable Fast Swim.|Allowed| +|`vMenu.PlayerOptions.Superjump`|Allows you to enable Superjump.|Allowed| +|`vMenu.PlayerOptions.NoRagdoll`|Allows you to enable No Ragdoll.|Allowed| +|`vMenu.PlayerOptions.NeverWanted`|Allows you to enable Never Wanted.|Allowed| +|`vMenu.PlayerOptions.SetWanted`|Allows you to set a custom wanted level.|Allowed| +|`vMenu.PlayerOptions.Ignored`|Allows you to enable the Everyone Ignores Player option.|Allowed| +|`vMenu.PlayerOptions.Functions`|Allows you to access some basic functions like healing, cleaning clothes, dry/wet clothes, commit suicide, etc.|Allowed| +|`vMenu.PlayerOptions.Freeze`|Allows you to freeze your own player. Why would you need to do this though...|Allowed| +|`vMenu.PlayerOptions.Scenarios`|Allows you to play and stop scenarios.|Allowed| + +## Vehicle Options + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.VehicleOptions.Menu`|Grants access to the Vehicle Options Menu.|Allowed| +|`vMenu.VehicleOptions.All`|Grants access to **ALL** `Vehicle Options Menu` options.|Denied| +|`vMenu.VehicleOptions.God`|Allows you to enable vehicle godmode.|Allowed| +|`vMenu.VehicleOptions.Repair`|Allows you to repair your vehicle.|Allowed| +|`vMenu.VehicleOptions.Wash`|Allows you to wash/clean your vehicle & set a custom dirt level.|Allowed| +|`vMenu.VehicleOptions.Engine`|Allows you to toggle your engine on/off.|Allowed| +|`vMenu.VehicleOptions.ChangePlate`|Allows you to change your vehicle's license plate style & text.|Allowed| +|`vMenu.VehicleOptions.Mod`|Allows you to modify any visual and performance specs of your vehicle.|Allowed| +|`vMenu.VehicleOptions.Colors`|Allows you to change the color of your vehicle.|Allowed| +|`vMenu.VehicleOptions.Liveries`|Allows you to change the livery of your vehicle.|Allowed| +|`vMenu.VehicleOptions.Components`|Allows you to modify the components/extras of your vehicle.|Allowed| +|`vMenu.VehicleOptions.Doors`|Allows you to open/close vehicle doors using the menu.|Allowed| +|`vMenu.VehicleOptions.Windows`|Allows you to roll up/down your windows using the menu.|Allowed| +|`vMenu.VehicleOptions.Freeze`|Allows you to freeze the position of your vehicle (why would you do this though...)|Allowed| +|`vMenu.VehicleOptions.TorqueMultiplier`|Allows you to set and enable an engine torque multiplier.|Allowed| +|`vMenu.VehicleOptions.PowerMultiplier`|Allows you to set and enable an engine power multiplier.|Allowed| +|`vMenu.VehicleOptions.Flip`|Allows you to flip your vehicle if it's upside down.|Allowed| +|`vMenu.VehicleOptions.Alarm`|Allows you to toggle the vehicle's alarm on/off. Turning it on will randomize the alarm duration between 8-30 seconds.|Allowed| +|`vMenu.VehicleOptions.CycleSeats`|Allows you to cycle through all available vehicle seats.|Allowed| +|`vMenu.VehicleOptions.EngineAlwaysOn`|Allows you to enable the Engine Always On feature, this keeps the engine running when you exit your vehicle.|Allowed| +|`vMenu.VehicleOptions.NoSiren`|Allows you to disable the siren on the vehicle.|Allowed| +|`vMenu.VehicleOptions.NoHelmet`|Allows you to disable the "automatically equipped" helmets when getting on a bike.|Allowed| +|`vMenu.VehicleOptions.Lights`|Allows you to enable/disable specific vehicle lights like hazard lights, turn signals, interior lighting, taxi lights or helicopter spotlights.|Allowed| +|`vMenu.VehicleOptions.Delete`|Allows you to delete your current vehicle.|Allowed| + +## Vehicle Spawner + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.VehicleSpawner.Menu`|Grants access to the Vehicle Spawner Menu.|Allowed| +|`vMenu.VehicleSpawner.All`|Allows you to spawn **ANY** vehicle.|Denied| +|`vMenu.VehicleSpawner.SpawnByName`|Allows you to enter a **custom vehicle name** to spawn[\*\*\*](#global-permissions).|Allowed| +|`vMenu.VehicleSpawner.Compacts`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Sedans`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.SUVs`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Coupes`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Muscle`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.SportsClassic`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Sports`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Super`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Motorcycles`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.OffRoad`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Industrial`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Utility`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Vans`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Cycles`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Boats`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Helicopters`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Planes`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Service`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Emergency`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Military`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Commercial`|Allows you to spawn a vehicle from this category.|Allowed| +|`vMenu.VehicleSpawner.Trains`|Allows you to spawn a vehicle from this category.|Allowed| + +## Saved Vehicles + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.SavedVehicles.Menu`|Grants access to the Saved Vehicles Menu.|Allowed| +|`vMenu.SavedVehicles.All`|Grants access to **ALL** `Saved Vehicles Menu` options.|Denied| +|`vMenu.SavedVehicles.Spawn`|Allows you to spawn one of your saved cars. Saving new cars or deleting existing saved cars is always allowed no matter what.|Allowed| + +## Player Appearance + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.PlayerAppearance.Menu`|Grants access to the Player Appearance Menu.|Allowed| +|`vMenu.PlayerAppearance.All`|Grants access to **ALL** `Player Appearance Menu` options.|Denied| +|`vMenu.PlayerAppearance.Customize`|Allows you to customize your current ped.|Allowed| +|`vMenu.PlayerAppearance.SpawnSaved`|Allows you to spawn a saved ped. Saving new peds or deleting existing saved peds is always allowed no matter what.|Allowed| +|`vMenu.PlayerAppearance.SpawnNew`|Allows you to spawn any ped model from a list.|Allowed| + +## Time Options + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.TimeOptions.Menu`|Grants access to the Time Options Menu.|Denied[\*\*](#global-permissions)| +|`vMenu.TimeOptions.All`|Grants access to **ALL** `Time Options Menu` options.|Denied| +|`vMenu.TimeOptions.FreezeTime`|Allows you to freeze the current time. (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| +|`vMenu.TimeOptions.SetTime`|Allows you to set the current time. (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| + +## Weather Options + + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.WeatherOptions.Menu`|Grants access to the Weather Options Menu.|Denied[\*\*](#global-permissions)| +|`vMenu.WeatherOptions.All`|Grants access to **ALL** `Weather Options Menu` options.|Denied| +|`vMenu.WeatherOptions.Dynamic`|Allows you to enable/disable dynamic weather changes (which, when enabled, occur every 5 minutes). (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| +|`vMenu.WeatherOptions.Blackout`|Allows you to enable/disable blackout mode (all light sources in the map go dark). (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| +|`vMenu.WeatherOptions.SetWeather`|Allows you to set a custom weather type. (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| +|`vMenu.WeatherOptions.RemoveClouds`|Allows you to remove all cloud effects (only use this with Clear or Extra Sunny weather, obviously). (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| +|`vMenu.WeatherOptions.RandomizeClouds`|Allows you to randomize the cloud patterns/effects. (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| + +## Weapon Options +**Adding/Removing/Customizing any weapon is automatically _ALLOWED_ when you give the player permissions to access this menu.** + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.WeaponOptions.Menu`|Grants access to the Weapon Options Menu.|Allowed| +|`vMenu.WeaponOptions.All`|Grants access to all `Weapon Options Menu` options.|Denied| +|`vMenu.WeaponOptions.GetAll`|Allows you to use the `Get All Weapons` button.|Allowed| +|`vMenu.WeaponOptions.RemoveAll`|Allows you to use the `Remove All Weapons` button.|Allowed| +|`vMenu.WeaponOptions.UnlimitedAmmo`|Allows you to enable/disable unlimited ammo.|Allowed| +|`vMenu.WeaponOptions.NoReload`|Allows you to enable/disable no-reload.|Allowed| + +## Misc Settings +**The `Save Personal Settings` option in the Misc Settings Menu is always allowed, so there's no permission line for that.** + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.MiscSettings.Menu`|Grants access to the Misc Settings Menu.|Allowed| +|`vMenu.MiscSettings.All`|Grants access to **ALL** `Misc Settings Menu` options.|Denied| +|`vMenu.MiscSettings.TeleportToWp`|Allows you to teleport to the waypoint on your map.|Allowed| +|`vMenu.MiscSettings.ShowCoordinates`|Allows you to show your current coordinates on screen.|Allowed| +|`vMenu.MiscSettings.ShowLocation`|Allows you to show your current location on screen (pretty much just like PLD).|Allowed| +|`vMenu.MiscSettings.JoinQuitNotifs`|Allows you to receive join/quit notifications when someone joins/quits the server.|Allowed| +|`vMenu.MiscSettings.DeathNotifs`|Allows you to receive death notifications when someone dies or gets killed.|Allowed| + +## Voice Chat + +|Permission|Description|Default[\*](#global-permissions)| +|:-|:-|:-| +|`vMenu.VoiceChat.Menu`|Grants access to the Voice Chat Options Menu|Allowed| +|`vMenu.VoiceChat.All`|Grants access to **ALL** `Voice Chat Options Menu` options.|Denied| +|`vMenu.VoiceChat.Enable`|Allows you to enable/disable voice chat.|Allowed| +|`vMenu.VoiceChat.ShowSpeaker`|Allows you to enable/disable the "Currently Talking" display at the top of your screen when someone is using voice chat.|Allowed| +|`vMenu.VoiceChat.StaffChannel`|Allows you to enter the staff-only voice channel.|Denied[\*\*](#global-permissions)| + +## About Submenu +The **About vMenu** submenu is always available for everyone, and can not be disabled with the use of permissions. If you don't feel like showing credits to everyone --which seems very selfish to me-- then you'll have to edit the code and disable it yourself, which also means I won't be giving you any support whatsoever. diff --git a/README.md b/README.md index c9a3c8ff..478f1e2d 100644 --- a/README.md +++ b/README.md @@ -6,197 +6,36 @@ -------- # vMenu -vMenu is a custom built server sided trainer, with basic permissions support, whenever possible using labels to automatically translate many menu options to the player's game language, and much more. - -## Features -**Almost all features have custom permissions options.** - - -## Menu Permissions/Features ->### ⚠ Please note that ALL permissions are `CaSeSeNSItIve`! - -## Global Permissions -**Notes:** -1. __\*__ The `Default (allowed/denied)` values are based on the assumption that you use the default permissions file included with the menu, and you've granted yourself no special permissions or added yourself to any of the admin/moderator groups. If you **DON'T** use the default permissions file, then every option will be **DENIED** by default. -2. __\*\*__ These options are only allowed by default for the "Moderators" / "Admins" groups in the provided permissions file with this resource. -3. __\*\*\*__ When spawning a car using the `Spawn By Name` button, it will always check to see if you have permission for that specific vehicle's class. eg: If you don't have permission to spawn cars from the `Super` class, trying to spawn an `adder` using the `Spawn By Name` button won't work. - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.Everything`|Grants access to everything, not recommended to give this out.|Denied| -|`vMenu.DontKickMe`|Prevents this player from being kicked.|Denied| - -## Online Players - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.OnlinePlayers.Menu`|Grants access to the Online Players Menu|Allowed| -|`vMenu.OnlinePlayers.All`|Grants access to **ALL** `Online Players Menu` options.|Denied| -|`vMenu.OnlinePlayers.Teleport`|Allows you to teleport to another player.|Allowed| -|`vMenu.OnlinePlayers.Waypoint`|Allows you to set a waypoint to another player.|Allowed| -|`vMenu.OnlinePlayers.Spectate`|Allows you to spectate another player.|Allowed| -|`vMenu.OnlinePlayers.Summon`|Allows you to summon/teleport another player to you.|Denied| -|`vMenu.OnlinePlayers.Kill`|Allows you to kill another player by pressing a button. Dam, you're very cruel.|Denied| -|`vMenu.OnlinePlayers.Kick`|Allows you to kick another player from the server.|Denied| - -## Player Options - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.PlayerOptions.Menu`|Grants access to the Player Options Menu.|Allowed| -|`vMenu.PlayerOptions.All`|Grants access to **ALL** `Player Options Menu` options.|Denied| -|`vMenu.PlayerOptions.God`|Allows you to use god mode.|Allowed| -|`vMenu.PlayerOptions.Invisible`|Allows you to go invisble.|Allowed| -|`vMenu.PlayerOptions.FastRun`|Allows you to enable Fast Run.|Allowed| -|`vMenu.PlayerOptions.FastSwim`|Allows you to enable Fast Swim.|Allowed| -|`vMenu.PlayerOptions.Superjump`|Allows you to enable Superjump.|Allowed| -|`vMenu.PlayerOptions.NoRagdoll`|Allows you to enable No Ragdoll.|Allowed| -|`vMenu.PlayerOptions.NeverWanted`|Allows you to enable Never Wanted.|Allowed| -|`vMenu.PlayerOptions.SetWanted`|Allows you to set a custom wanted level.|Allowed| -|`vMenu.PlayerOptions.Ignored`|Allows you to enable the Everyone Ignores Player option.|Allowed| -|`vMenu.PlayerOptions.Functions`|Allows you to access some basic functions like healing, cleaning clothes, dry/wet clothes, commit suicide, etc.|Allowed| -|`vMenu.PlayerOptions.Freeze`|Allows you to freeze your own player. Why would you need to do this though...|Allowed| -|`vMenu.PlayerOptions.Scenarios`|Allows you to play and stop scenarios.|Allowed| - -## Vehicle Options - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.VehicleOptions.Menu`|Grants access to the Vehicle Options Menu.|Allowed| -|`vMenu.VehicleOptions.All`|Grants access to **ALL** `Vehicle Options Menu` options.|Denied| -|`vMenu.VehicleOptions.God`|Allows you to enable vehicle godmode.|Allowed| -|`vMenu.VehicleOptions.Repair`|Allows you to repair your vehicle.|Allowed| -|`vMenu.VehicleOptions.Wash`|Allows you to wash/clean your vehicle & set a custom dirt level.|Allowed| -|`vMenu.VehicleOptions.Engine`|Allows you to toggle your engine on/off.|Allowed| -|`vMenu.VehicleOptions.ChangePlate`|Allows you to change your vehicle's license plate style & text.|Allowed| -|`vMenu.VehicleOptions.Mod`|Allows you to modify any visual and performance specs of your vehicle.|Allowed| -|`vMenu.VehicleOptions.Colors`|Allows you to change the color of your vehicle.|Allowed| -|`vMenu.VehicleOptions.Liveries`|Allows you to change the livery of your vehicle.|Allowed| -|`vMenu.VehicleOptions.Components`|Allows you to modify the components/extras of your vehicle.|Allowed| -|`vMenu.VehicleOptions.Doors`|Allows you to open/close vehicle doors using the menu.|Allowed| -|`vMenu.VehicleOptions.Windows`|Allows you to roll up/down your windows using the menu.|Allowed| -|`vMenu.VehicleOptions.Freeze`|Allows you to freeze the position of your vehicle (why would you do this though...)|Allowed| -|`vMenu.VehicleOptions.TorqueMultiplier`|Allows you to set and enable an engine torque multiplier.|Allowed| -|`vMenu.VehicleOptions.PowerMultiplier`|Allows you to set and enable an engine power multiplier.|Allowed| -|`vMenu.VehicleOptions.Flip`|Allows you to flip your vehicle if it's upside down.|Allowed| -|`vMenu.VehicleOptions.Alarm`|Allows you to toggle the vehicle's alarm on/off. Turning it on will randomize the alarm duration between 8-30 seconds.|Allowed| -|`vMenu.VehicleOptions.CycleSeats`|Allows you to cycle through all available vehicle seats.|Allowed| -|`vMenu.VehicleOptions.EngineAlwaysOn`|Allows you to enable the Engine Always On feature, this keeps the engine running when you exit your vehicle.|Allowed| -|`vMenu.VehicleOptions.NoSiren`|Allows you to disable the siren on the vehicle.|Allowed| -|`vMenu.VehicleOptions.NoHelmet`|Allows you to disable the "automatically equipped" helmets when getting on a bike.|Allowed| -|`vMenu.VehicleOptions.Lights`|Allows you to enable/disable specific vehicle lights like hazard lights, turn signals, interior lighting, taxi lights or helicopter spotlights.|Allowed| -|`vMenu.VehicleOptions.Delete`|Allows you to delete your current vehicle.|Allowed| - -## Vehicle Spawner - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.VehicleSpawner.Menu`|Grants access to the Vehicle Spawner Menu.|Allowed| -|`vMenu.VehicleSpawner.All`|Allows you to spawn **ANY** vehicle.|Denied| -|`vMenu.VehicleSpawner.SpawnByName`|Allows you to enter a **custom vehicle name** to spawn[\*\*\*](#global-permissions).|Allowed| -|`vMenu.VehicleSpawner.Compacts`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Sedans`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.SUVs`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Coupes`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Muscle`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.SportsClassic`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Sports`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Super`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Motorcycles`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.OffRoad`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Industrial`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Utility`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Vans`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Cycles`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Boats`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Helicopters`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Planes`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Service`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Emergency`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Military`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Commercial`|Allows you to spawn a vehicle from this category.|Allowed| -|`vMenu.VehicleSpawner.Trains`|Allows you to spawn a vehicle from this category.|Allowed| - -## Saved Vehicles - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.SavedVehicles.Menu`|Grants access to the Saved Vehicles Menu.|Allowed| -|`vMenu.SavedVehicles.All`|Grants access to **ALL** `Saved Vehicles Menu` options.|Denied| -|`vMenu.SavedVehicles.Spawn`|Allows you to spawn one of your saved cars. Saving new cars or deleting existing saved cars is always allowed no matter what.|Allowed| - -## Player Appearance - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.PlayerAppearance.Menu`|Grants access to the Player Appearance Menu.|Allowed| -|`vMenu.PlayerAppearance.All`|Grants access to **ALL** `Player Appearance Menu` options.|Denied| -|`vMenu.PlayerAppearance.Customize`|Allows you to customize your current ped.|Allowed| -|`vMenu.PlayerAppearance.SpawnSaved`|Allows you to spawn a saved ped. Saving new peds or deleting existing saved peds is always allowed no matter what.|Allowed| -|`vMenu.PlayerAppearance.SpawnNew`|Allows you to spawn any ped model from a list.|Allowed| - -## Time Options - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.TimeOptions.Menu`|Grants access to the Time Options Menu.|Denied[\*\*](#global-permissions)| -|`vMenu.TimeOptions.All`|Grants access to **ALL** `Time Options Menu` options.|Denied| -|`vMenu.TimeOptions.FreezeTime`|Allows you to freeze the current time. (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| -|`vMenu.TimeOptions.SetTime`|Allows you to set the current time. (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| - -## Weather Options - - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.WeatherOptions.Menu`|Grants access to the Weather Options Menu.|Denied[\*\*](#global-permissions)| -|`vMenu.WeatherOptions.All`|Grants access to **ALL** `Weather Options Menu` options.|Denied| -|`vMenu.WeatherOptions.Dynamic`|Allows you to enable/disable dynamic weather changes (which, when enabled, occur every 5 minutes). (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| -|`vMenu.WeatherOptions.Blackout`|Allows you to enable/disable blackout mode (all light sources in the map go dark). (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| -|`vMenu.WeatherOptions.SetWeather`|Allows you to set a custom weather type. (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| -|`vMenu.WeatherOptions.RemoveClouds`|Allows you to remove all cloud effects (only use this with Clear or Extra Sunny weather, obviously). (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| -|`vMenu.WeatherOptions.RandomizeClouds`|Allows you to randomize the cloud patterns/effects. (Synced for everyone in the server)|Denied[\*\*](#global-permissions)| - -## Weapon Options -**Adding/Removing/Customizing any weapon is automatically _ALLOWED_ when you give the player permissions to access this menu.** - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.WeaponOptions.Menu`|Grants access to the Weapon Options Menu.|Allowed| -|`vMenu.WeaponOptions.All`|Grants access to all `Weapon Options Menu` options.|Denied| -|`vMenu.WeaponOptions.GetAll`|Allows you to use the `Get All Weapons` button.|Allowed| -|`vMenu.WeaponOptions.RemoveAll`|Allows you to use the `Remove All Weapons` button.|Allowed| -|`vMenu.WeaponOptions.UnlimitedAmmo`|Allows you to enable/disable unlimited ammo.|Allowed| -|`vMenu.WeaponOptions.NoReload`|Allows you to enable/disable no-reload.|Allowed| - -## Misc Settings -**The `Save Personal Settings` option in the Misc Settings Menu is always allowed, so there's no permission line for that.** - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.MiscSettings.Menu`|Grants access to the Misc Settings Menu.|Allowed| -|`vMenu.MiscSettings.All`|Grants access to **ALL** `Misc Settings Menu` options.|Denied| -|`vMenu.MiscSettings.TeleportToWp`|Allows you to teleport to the waypoint on your map.|Allowed| -|`vMenu.MiscSettings.ShowCoordinates`|Allows you to show your current coordinates on screen.|Allowed| -|`vMenu.MiscSettings.ShowLocation`|Allows you to show your current location on screen (pretty much just like PLD).|Allowed| -|`vMenu.MiscSettings.JoinQuitNotifs`|Allows you to receive join/quit notifications when someone joins/quits the server.|Allowed| -|`vMenu.MiscSettings.DeathNotifs`|Allows you to receive death notifications when someone dies or gets killed.|Allowed| - -## Voice Chat - -|Permission|Description|Default[\*](#global-permissions)| -|:-|:-|:-| -|`vMenu.VoiceChat.Menu`|Grants access to the Voice Chat Options Menu|Allowed| -|`vMenu.VoiceChat.All`|Grants access to **ALL** `Voice Chat Options Menu` options.|Denied| -|`vMenu.VoiceChat.Enable`|Allows you to enable/disable voice chat.|Allowed| -|`vMenu.VoiceChat.ShowSpeaker`|Allows you to enable/disable the "Currently Talking" display at the top of your screen when someone is using voice chat.|Allowed| -|`vMenu.VoiceChat.StaffChannel`|Allows you to enter the staff-only voice channel.|Denied[\*\*](#global-permissions)| - -## About Submenu -The **About vMenu** submenu is always available for everyone, and can not be disabled with the use of permissions. If you don't feel like showing credits to everyone --which seems very selfish to me-- then you'll have to edit the code and disable it yourself, which also means I won't be giving you any support whatsoever. - ------ - +vMenu is server sided menu for FiveM servers, including full\* permission support. + +### Demo Screenshots +|Main Menu|Player Options| +|:-:|:-:| +|![Main Menu](https://www.vespura.com/hi/i/fef17e5.png)|![Player Options](https://www.vespura.com/hi/i/458b6e4.png)| + +\*(Some features do not have permissions support as they are either harmless or it'd just be silly to deny them. However, they will be disabled if you deny access to the submenu that they are a part of (eg: unlimited stamina in Player Options will be disabled if you deny `vMenu.PlayerOptions.Menu`.)) + +# Download & Installation & Permissions +**Download** + +Click [here](https://github.com/TomGrobbe/vMenu/releases) to go to the releases page and download it. + +**Installation** +1. Download the latest version. +2. Unzip everything, and take all the files from that zip, and place it in `/resources/vMenu/` on your server. +***NOTE: YOU HAVE TO NAME THE FOLDER `vMenu` (CASE SENSITIVE), OTHERWISE THIS RESOURCE WILL NOT WORK!*** +3. Go to your server.cfg file and **AT THE VERY TOP**, add this line: +```text +exec permissions.cfg +``` +4. Now, place this line anywhere in your server.cfg file, as long as it's somewhere below the one from step 3. +```text +start vMenu +``` +5. Go to `resources/vMenu/config/` and copy the `permissions.cfg` file to the _same folder_ wherever your **server.cfg** file is stored! So, you'll end up with `server.cfg` and `permissions.cfg` IN THE SAME FOLDER. +6. This step is optional **IF** you want to be lazy and just start playing right away. However, if you want to be able to change the time, weather and kick people from the server, or even restrict some of the features for certain players/groups, then go into your `permissions.cfg` file (the one you copied to the same folder as the server.cfg is located), and start editing it by following the instructions in there, and looking at the [permissions list here](https://github.com/TomGrobbe/vMenu/wiki/permissions). + +--- ## NativeUI This menu is created using [a modified version of NativeUI](https://github.com/TomGrobbe/NativeUI), originally by [Guad](https://github.com/Guad/NativeUI). From 92434798406d50fc64af3e8ff173afd006afa2dc Mon Sep 17 00:00:00 2001 From: Tom Grobbe <31419184+TomGrobbe@users.noreply.github.com> Date: Thu, 8 Mar 2018 00:03:46 +0100 Subject: [PATCH 21/21] Changed readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 478f1e2d..ff063072 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ start vMenu ``` 5. Go to `resources/vMenu/config/` and copy the `permissions.cfg` file to the _same folder_ wherever your **server.cfg** file is stored! So, you'll end up with `server.cfg` and `permissions.cfg` IN THE SAME FOLDER. 6. This step is optional **IF** you want to be lazy and just start playing right away. However, if you want to be able to change the time, weather and kick people from the server, or even restrict some of the features for certain players/groups, then go into your `permissions.cfg` file (the one you copied to the same folder as the server.cfg is located), and start editing it by following the instructions in there, and looking at the [permissions list here](https://github.com/TomGrobbe/vMenu/wiki/permissions). - +7. Save the server.cfg file if you haven't already, and restart the server. You're now done, enjoy! --- ## NativeUI