Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
TomGrobbe committed Apr 26, 2020
2 parents ef06f35 + 7de3ebd commit 6426b2e
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 81 deletions.
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

patreon: Vespura
custom: "https://www.paypal.me/tomgrobbe"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,4 @@ dependencies/shared/vMenuShared\.net\.dll
external/

*.cmd
*.cmd.bak
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
# vMenu
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`.))

Expand Down Expand Up @@ -81,7 +76,7 @@ vMenu v2.0.0 and earlier was [using a modified version of NativeUI](https://gith

Tom Grobbe - https://www.vespura.com/

Copyright © 2017-2019
Copyright © 2017-2020

----

Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build:
after_build:
- cmd: copy README.md ..\build\net452\README.md
- cmd: copy LICENSE.md ..\build\net452\LICENSE.md
- ps: Invoke-WebRequest -OutFile '..\build\net452\__resource.lua' https://vespura.com/vmenu/__resource.lua
- ps: Invoke-WebRequest -OutFile '..\build\net452\fxmanifest.lua' https://vespura.com/vmenu/fxmanifest.lua
- cmd: if %APPVEYOR_REPO_TAG%==true (appveyor SetVariable -Name VERSION_NAME -Value %APPVEYOR_REPO_TAG_NAME%) else (appveyor SetVariable -Name VERSION_NAME -Value beta-%APPVEYOR_BUILD_VERSION%)
- cmd: cd ..\build\net452\ && 7z a "..\..\vMenu\vMenu-%VERSION_NAME%.zip" -r * && cd ..\..\vMenu\
- cmd: appveyor PushArtifact vMenu-%VERSION_NAME%.zip
Expand All @@ -33,4 +33,4 @@ after_deploy:
on_success:
- cmd: if %APPVEYOR_REPO_TAG%==false curl -H "Content-Type:application/json" -X POST -d "{\"embeds\":[{\"title\":\"%APPVEYOR_PROJECT_NAME% (%VERSION_NAME%)\",\"description\":\"Build passed!\",\"color\":4502298,\"author\":{\"name\":\"Build triggered by %APPVEYOR_ACCOUNT_NAME%\",\"url\":\"https://github.com/%APPVEYOR_ACCOUNT_NAME%/\"},\"fields\":[{\"name\":\"AppVeyor Build\",\"value\":\"[Here](%APPVEYOR_URL%/project/%APPVEYOR_ACCOUNT_NAME%/%APPVEYOR_PROJECT_SLUG%/builds/%APPVEYOR_BUILD_ID%)\"},{\"name\":\"GitHub Commit (%APPVEYOR_REPO_COMMIT%)\",\"value\":\"[%APPVEYOR_REPO_COMMIT%](https://github.com/%APPVEYOR_ACCOUNT_NAME%/%APPVEYOR_PROJECT_NAME%/commit/%APPVEYOR_REPO_COMMIT%) - %APPVEYOR_REPO_COMMIT_MESSAGE%%APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED%\"},{\"name\":\"GitHub Branch\",\"value\":\"[%APPVEYOR_REPO_BRANCH%](https://github.com/%APPVEYOR_ACCOUNT_NAME%/%APPVEYOR_PROJECT_NAME%/tree/%APPVEYOR_REPO_BRANCH%)\"}]}]}" %WEBHOOK_URL%
on_failure:
- cmd: curl -H "Content-Type:application/json" -X POST -d "{\"embeds\":[{\"title\":\"%APPVEYOR_PROJECT_NAME% (%VERSION_NAME%)\",\"description\":\"Build FAILED! Ouch.\",\"color\":13632027,\"author\":{\"name\":\"Build triggered by %APPVEYOR_ACCOUNT_NAME%\",\"url\":\"https://github.com/%APPVEYOR_ACCOUNT_NAME%/\"},\"fields\":[{\"name\":\"AppVeyor Build\",\"value\":\"[Here](%APPVEYOR_URL%/project/%APPVEYOR_ACCOUNT_NAME%/%APPVEYOR_PROJECT_SLUG%/builds/%APPVEYOR_BUILD_ID%)\"},{\"name\":\"GitHub Commit (%APPVEYOR_REPO_COMMIT%)\",\"value\":\"[%APPVEYOR_REPO_COMMIT%](https://github.com/%APPVEYOR_ACCOUNT_NAME%/%APPVEYOR_PROJECT_NAME%/commit/%APPVEYOR_REPO_COMMIT%) - %APPVEYOR_REPO_COMMIT_MESSAGE%%APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED%\"},{\"name\":\"GitHub Branch\",\"value\":\"[%APPVEYOR_REPO_BRANCH%](https://github.com/%APPVEYOR_ACCOUNT_NAME%/%APPVEYOR_PROJECT_NAME%/tree/%APPVEYOR_REPO_BRANCH%)\"}]}]}" %WEBHOOK_URL%
- cmd: curl -H "Content-Type:application/json" -X POST -d "{\"embeds\":[{\"title\":\"%APPVEYOR_PROJECT_NAME% (%VERSION_NAME%)\",\"description\":\"Build FAILED! Ouch.\",\"color\":13632027,\"author\":{\"name\":\"Build triggered by %APPVEYOR_ACCOUNT_NAME%\",\"url\":\"https://github.com/%APPVEYOR_ACCOUNT_NAME%/\"},\"fields\":[{\"name\":\"AppVeyor Build\",\"value\":\"[Here](%APPVEYOR_URL%/project/%APPVEYOR_ACCOUNT_NAME%/%APPVEYOR_PROJECT_SLUG%/builds/%APPVEYOR_BUILD_ID%)\"},{\"name\":\"GitHub Commit (%APPVEYOR_REPO_COMMIT%)\",\"value\":\"[%APPVEYOR_REPO_COMMIT%](https://github.com/%APPVEYOR_ACCOUNT_NAME%/%APPVEYOR_PROJECT_NAME%/commit/%APPVEYOR_REPO_COMMIT%) - %APPVEYOR_REPO_COMMIT_MESSAGE%%APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED%\"},{\"name\":\"GitHub Branch\",\"value\":\"[%APPVEYOR_REPO_BRANCH%](https://github.com/%APPVEYOR_ACCOUNT_NAME%/%APPVEYOR_PROJECT_NAME%/tree/%APPVEYOR_REPO_BRANCH%)\"}]}]}" %WEBHOOK_URL%
8 changes: 4 additions & 4 deletions vMenu/CommonFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1585,7 +1585,7 @@ public static async Task<string> GetUserInput(string windowTitle, string default
{
// Create the window title string.
var spacer = "\t";
AddTextEntry($"{GetCurrentResourceName().ToUpper()}_WINDOW_TITLE", $"{windowTitle ?? "Enter"}:{spacer}(MAX {maxInputLength.ToString()} Characters)");
AddTextEntry($"{GetCurrentResourceName().ToUpper()}_WINDOW_TITLE", $"{windowTitle ?? "Enter"}:{spacer}(MAX {maxInputLength} Characters)");

// Display the input box.
DisplayOnscreenKeyboard(1, $"{GetCurrentResourceName().ToUpper()}_WINDOW_TITLE", "", defaultText ?? "", "", "", "", maxInputLength);
Expand Down Expand Up @@ -1671,11 +1671,11 @@ public static string ToProperString(string inputString)
{
if (prevUpper)
{
outputString += $"{c.ToString()}";
outputString += $"{c}";
}
else
{
outputString += $" {c.ToString()}";
outputString += $" {c}";
}
prevUpper = true;
}
Expand Down Expand Up @@ -2422,7 +2422,7 @@ public static async void SpawnCustomWeapon()
}
else
{
Notify.Error($"This ({inputName.ToString()}) is not a valid weapon model name, or the model hash ({model.ToString()}) could not be found in the game files.");
Notify.Error($"This ({inputName}) is not a valid weapon model name, or the model hash ({model}) could not be found in the game files.");
}
}
else
Expand Down
65 changes: 14 additions & 51 deletions vMenu/FunctionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class FunctionsController : BaseScript
// show location variables
private Vector3 currentPos = Game.PlayerPed.Position;
private Vector3 nodePos = Game.PlayerPed.Position;
private bool node = false;
private float heading = 0f;
private float safeZoneSizeX = (1 / GetSafeZoneSize() / 3.0f) - 0.358f;
private uint crossing = 1;
Expand Down Expand Up @@ -104,8 +103,7 @@ public FunctionsController()
Tick += PersonalVehicleOptions;
Tick += AnimalPedCameraChangeBlocker;
Tick += SlowMiscTick;


Tick += SpectateHandling;
//Tick += FlaresAndBombsTick;
}

Expand All @@ -130,8 +128,6 @@ private async Task GcTick()
#endregion

#region General Tasks
int lastProp = -1;
int lastPropTexture = 0;
/// <summary>
/// All general tasks that run every 1 game ticks (and are not (sub)menu specific).
/// </summary>
Expand All @@ -149,30 +145,6 @@ private async Task GeneralTasks()
LastVehicle = tmpVehicle.Handle;
SwitchedVehicle = true;
}
if (lastProp > -1 && GetPedPropIndex(Game.PlayerPed.Handle, 0) != lastProp)
{
SetPedPropIndex(Game.PlayerPed.Handle, 0, lastProp, lastPropTexture, true);
lastProp = -1;
lastPropTexture = 0;
}
}
else
{
if (Game.PlayerPed.IsGettingIntoAVehicle && !Game.PlayerPed.IsInVehicle()) // if they are (attempting to) get into a vehicle but they're not in yet.
{
int prop = GetPedPropIndex(Game.PlayerPed.Handle, 0);
int propTexture = GetPedPropTextureIndex(Game.PlayerPed.Handle, 0);
if (prop > -1)
{
lastProp = prop;
lastPropTexture = propTexture;
}
else
{
lastProp = -1;
lastPropTexture = 0;
}
}
}
// this can wait 1 ms
await Delay(1);
Expand All @@ -190,11 +162,8 @@ private async Task PlayerOptions()
if (MainMenu.PermissionsSetupComplete && MainMenu.PlayerOptionsMenu != null && IsAllowed(Permission.POMenu))
{
// perms
bool ignorePlayerAllowed = IsAllowed(Permission.POIgnored);
bool godmodeAllowed = IsAllowed(Permission.POGod);
bool noRagdollAllowed = IsAllowed(Permission.PONoRagdoll);
bool vehicleGodModeAllowed = IsAllowed(Permission.VOGod);
bool playerFrozenAllowed = IsAllowed(Permission.POFreeze);

if (MainMenu.MpPedCustomizationMenu != null && MainMenu.MpPedCustomizationMenu.appearanceMenu != null && MainMenu.MpPedCustomizationMenu.faceShapeMenu != null && MainMenu.MpPedCustomizationMenu.createCharacterMenu != null && MainMenu.MpPedCustomizationMenu.inheritanceMenu != null && MainMenu.MpPedCustomizationMenu.propsMenu != null && MainMenu.MpPedCustomizationMenu.clothesMenu != null && MainMenu.MpPedCustomizationMenu.tattoosMenu != null)
{
Expand Down Expand Up @@ -469,7 +438,7 @@ private async Task VehicleOptions()
catch (Exception e)
{
Debug.WriteLine(@"[CRITICAL] A critical bug in one of your scripts was detected. vMenu is unable to set or register a decorator's value because another resource has already registered 1.5k or more decorators. vMenu will NOT work as long as this bug in your other scripts is unsolved. Please fix your other scripts. This is *NOT* caused by or fixable by vMenu!!!");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message.ToString()}");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message}");
await Delay(1000);
}
}
Expand Down Expand Up @@ -750,7 +719,7 @@ private async Task UpdateLocation()

// Get the nearest vehicle node.
nodePos = currentPos;
node = GetNthClosestVehicleNode(currentPos.X, currentPos.Y, currentPos.Z, 0, ref nodePos, 0, 0, 0);
GetNthClosestVehicleNode(currentPos.X, currentPos.Y, currentPos.Z, 0, ref nodePos, 0, 0, 0);
heading = Game.PlayerPed.Heading;

// Get the safezone size for x and y to be able to move with the minimap.
Expand Down Expand Up @@ -792,7 +761,7 @@ private void ShowLocation()
prefix = "~m~Near ~s~";
}

string headingCharacter = "";
string headingCharacter;

// Heading Facing North
if (heading > 320 || heading < 45)
Expand Down Expand Up @@ -1162,12 +1131,10 @@ private async Task MiscRecordingKeybinds()
if (notifOne != -1)
{
RemoveNotification(notifOne);
notifOne = -1;
}
if (notifTwo != -1)
{
RemoveNotification(notifTwo);
notifTwo = -1;
}
}
}
Expand Down Expand Up @@ -1653,10 +1620,6 @@ private async Task ManageCamera()
}
}

var menu = MainMenu.MpPedCustomizationMenu.GetMenu();



if (IsMpCharEditorOpen())
{
if (!HasAnimDictLoaded("anim@random@shop_clothes@watches"))
Expand Down Expand Up @@ -2105,7 +2068,7 @@ private async Task PlayerClothingAnimationsController()
catch (Exception e)
{
Debug.WriteLine(@"[CRITICAL] A critical bug in one of your scripts was detected. vMenu is unable to set or register a decorator's value because another resource has already registered 1.5k or more decorators. vMenu will NOT work as long as this bug in your other scripts is unsolved. Please fix your other scripts. This is *NOT* caused by or fixable by vMenu!!!");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message.ToString()}");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message}");
await Delay(1000);
}
while (!DecorIsRegisteredAsType(clothingAnimationDecor, 3))
Expand All @@ -2122,7 +2085,7 @@ private async Task PlayerClothingAnimationsController()
catch (Exception e)
{
Debug.WriteLine(@"[CRITICAL] A critical bug in one of your scripts was detected. vMenu is unable to set or register a decorator's value because another resource has already registered 1.5k or more decorators. vMenu will NOT work as long as this bug in your other scripts is unsolved. Please fix your other scripts. This is *NOT* caused by or fixable by vMenu!!!");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message.ToString()}");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message}");
await Delay(1000);
}
foreach (Player player in Players)
Expand Down Expand Up @@ -2200,7 +2163,7 @@ private async Task PlayerClothingAnimationsController()
catch (Exception e)
{
Debug.WriteLine(@"[CRITICAL] A critical bug in one of your scripts was detected. vMenu is unable to set or register a decorator's value because another resource has already registered 1.5k or more decorators. vMenu will NOT work as long as this bug in your other scripts is unsolved. Please fix your other scripts. This is *NOT* caused by or fixable by vMenu!!!");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message.ToString()}");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message}");
await Delay(1000);
}
}
Expand Down Expand Up @@ -2230,7 +2193,7 @@ private async Task PlayerBlipsControl()
catch (Exception e)
{
Debug.WriteLine(@"[CRITICAL] A critical bug in one of your scripts was detected. vMenu is unable to set or register a decorator's value because another resource has already registered 1.5k or more decorators. vMenu will NOT work as long as this bug in your other scripts is unsolved. Please fix your other scripts. This is *NOT* caused by or fixable by vMenu!!!");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message.ToString()}");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message}");
await Delay(1000);
}

Expand Down Expand Up @@ -2348,7 +2311,7 @@ private async Task PlayerBlipsControl()
catch (Exception e)
{
Debug.WriteLine(@"[CRITICAL] A critical bug in one of your scripts was detected. vMenu is unable to set or register a decorator's value because another resource has already registered 1.5k or more decorators. vMenu will NOT work as long as this bug in your other scripts is unsolved. Please fix your other scripts. This is *NOT* caused by or fixable by vMenu!!!");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message.ToString()}");
Debug.WriteLine($"Error Location: {e.StackTrace}\nError info: {e.Message}");
await Delay(1000);
}
while (!DecorIsRegisteredAsType("vmenu_player_blip_sprite_id", 3))
Expand All @@ -2364,7 +2327,7 @@ private async Task PlayerBlipsControl()
#region player overhead names
private Dictionary<Player, int> gamerTags = new Dictionary<Player, int>();

private float distance = GetSettingsFloat(Setting.vmenu_player_names_distance) > 10f ? GetSettingsFloat(Setting.vmenu_player_names_distance) : 500f; // todo make this a convar.
private float playerNamesDistance = GetSettingsFloat(Setting.vmenu_player_names_distance) > 10f ? GetSettingsFloat(Setting.vmenu_player_names_distance) : 500f;


/// <summary>
Expand Down Expand Up @@ -2395,7 +2358,7 @@ private async Task PlayerOverheadNamesControl()
{
var dist = p.Character.Position.DistanceToSquared(Game.PlayerPed.Position);
//Debug.WriteLine($"Dist: {dist}");
bool closeEnough = dist < distance;
bool closeEnough = dist < playerNamesDistance;
if (gamerTags.ContainsKey(p))
{
if (!closeEnough)
Expand Down Expand Up @@ -2736,7 +2699,7 @@ private async Task ModelDrawDimensions()
SetDrawOrigin(v.Position.X, v.Position.Y, v.Position.Z - 0.3f, 0);
int model = GetEntityModel(v.Handle);

string hashes = $"{model} / {(uint)model} / 0x{model.ToString("X8")}";
string hashes = $"{model} / {(uint)model} / 0x{model:X8}";

DrawTextOnScreen($"Hash {hashes}", 0f, 0f, 0.3f, Alignment.Center, 0);
ClearDrawOrigin();
Expand Down Expand Up @@ -2768,7 +2731,7 @@ private async Task ModelDrawDimensions()
SetDrawOrigin(p.Position.X, p.Position.Y, p.Position.Z - 0.3f, 0);
int model = GetEntityModel(p.Handle);

string hashes = $"{model} / {(uint)model} / 0x{model.ToString("X8")}";
string hashes = $"{model} / {(uint)model} / 0x{model:X8}";

DrawTextOnScreen($"Hash {hashes}", 0f, 0f, 0.3f, Alignment.Center, 0);
ClearDrawOrigin();
Expand Down Expand Up @@ -2800,7 +2763,7 @@ private async Task ModelDrawDimensions()
SetDrawOrigin(p.Position.X, p.Position.Y, p.Position.Z - 0.3f, 0);
int model = GetEntityModel(p.Handle);

string hashes = $"{model} / {(uint)model} / 0x{model.ToString("X8")}";
string hashes = $"{model} / {(uint)model} / 0x{model:X8}";

DrawTextOnScreen($"Hash {hashes}", 0f, 0f, 0.3f, Alignment.Center, 0);
ClearDrawOrigin();
Expand Down
Loading

0 comments on commit 6426b2e

Please sign in to comment.