diff --git a/LemonUI.FiveM.V2/LemonUI.FiveM.V2.csproj b/LemonUI.FiveM.V2/LemonUI.FiveM.V2.csproj
new file mode 100644
index 0000000..add8585
--- /dev/null
+++ b/LemonUI.FiveM.V2/LemonUI.FiveM.V2.csproj
@@ -0,0 +1,56 @@
+
+
+
+ net452
+ false
+ true
+ LemonUI.FiveM.V2
+ LemonUI
+ FIVEMV2,CLIENT
+ 1.10.0
+ $(SolutionDir)bin\$(Configuration)\FiveM.V2\
+ true
+ $(OutputPath)\$(AssemblyName).xml
+ AnyCPU
+ embedded
+ true
+ false
+ latest
+ false
+
+ true
+ true
+ logo.png
+ README.md
+ $(ProjectName)
+ Hannele "Lemon" Ruiz
+ Hannele "Lemon" Ruiz
+ LemonUI
+ UI system for Grand Theft Auto V. This package is for FiveM Client using Mono V2.
+ MIT
+ https://github.com/justalemon/LemonUI
+ https://github.com/justalemon/LemonUI.git
+ git
+ en-US
+ $(SolutionDir)bin\$(Configuration)\FOR DEVELOPERS
+
+
+
+
+
+
+
+
+
+
+ lib\CitizenFX.Core.dll
+
+
+ lib\CitizenFX.FiveM.dll
+
+
+ lib\CitizenFX.FiveM.Native.dll
+
+
+
+
diff --git a/LemonUI.FiveM.V2/lib/CitizenFX.Core.dll b/LemonUI.FiveM.V2/lib/CitizenFX.Core.dll
new file mode 100644
index 0000000..58ac591
Binary files /dev/null and b/LemonUI.FiveM.V2/lib/CitizenFX.Core.dll differ
diff --git a/LemonUI.FiveM.V2/lib/CitizenFX.FiveM.Native.dll b/LemonUI.FiveM.V2/lib/CitizenFX.FiveM.Native.dll
new file mode 100644
index 0000000..c049f9d
Binary files /dev/null and b/LemonUI.FiveM.V2/lib/CitizenFX.FiveM.Native.dll differ
diff --git a/LemonUI.FiveM.V2/lib/CitizenFX.FiveM.dll b/LemonUI.FiveM.V2/lib/CitizenFX.FiveM.dll
new file mode 100644
index 0000000..0b8cda7
Binary files /dev/null and b/LemonUI.FiveM.V2/lib/CitizenFX.FiveM.dll differ
diff --git a/LemonUI.sln b/LemonUI.sln
index 6941682..1ca1deb 100644
--- a/LemonUI.sln
+++ b/LemonUI.sln
@@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LemonUI.AltV", "LemonUI.Alt
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LemonUI.AltV.Async", "LemonUI.AltV.Async\LemonUI.AltV.Async.csproj", "{F2761304-2B83-451F-B7BD-F7F752233A01}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LemonUI.FiveM.V2", "LemonUI.FiveM.V2\LemonUI.FiveM.V2.csproj", "{D2040C87-3A02-4EA3-AAA3-68FB6F5754D1}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -51,6 +53,10 @@ Global
{F2761304-2B83-451F-B7BD-F7F752233A01}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2761304-2B83-451F-B7BD-F7F752233A01}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2761304-2B83-451F-B7BD-F7F752233A01}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D2040C87-3A02-4EA3-AAA3-68FB6F5754D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D2040C87-3A02-4EA3-AAA3-68FB6F5754D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D2040C87-3A02-4EA3-AAA3-68FB6F5754D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D2040C87-3A02-4EA3-AAA3-68FB6F5754D1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/LemonUI/CancelEventArgs.cs b/LemonUI/CancelEventArgs.cs
index 8db4c25..2beb4fa 100644
--- a/LemonUI/CancelEventArgs.cs
+++ b/LemonUI/CancelEventArgs.cs
@@ -3,7 +3,7 @@
// Copyright (c) .NET Foundation and Contributors
// Under the MIT License
-#if FIVEM || RAGEMP
+#if FIVEM || RAGEMP || FIVEMV2
using System;
namespace LemonUI // Previously System.ComponentModel
diff --git a/LemonUI/CancelEventHandler.cs b/LemonUI/CancelEventHandler.cs
index 75fb821..7ba3d37 100644
--- a/LemonUI/CancelEventHandler.cs
+++ b/LemonUI/CancelEventHandler.cs
@@ -3,7 +3,7 @@
// Copyright (c) .NET Foundation and Contributors
// Under the MIT License
-#if FIVEM || RAGEMP
+#if FIVEM || RAGEMP || FIVEMV2
namespace LemonUI // Previously System.ComponentModel
{
///
diff --git a/LemonUI/Controls.cs b/LemonUI/Controls.cs
index 150b0e4..e4f5764 100644
--- a/LemonUI/Controls.cs
+++ b/LemonUI/Controls.cs
@@ -1,4 +1,7 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
#elif ALTV
@@ -31,8 +34,10 @@ public static bool IsUsingController
{
get
{
-#if FIVEM
- return !API.IsInputDisabled(2);
+#if FIVEMV2
+ return !Natives.IsInputDisabled(2);
+#elif FIVEM
+ return !API.IsInputDisabled(2);
#elif ALTV
return !Alt.Natives.IsUsingKeyboardAndMouse(2);
#elif RAGEMP
@@ -56,7 +61,9 @@ public static bool IsUsingController
/// true if the control was pressed, false otherwise.
public static bool IsJustPressed(Control control)
{
-#if FIVEM
+#if FIVEMV2
+ return Natives.IsDisabledControlJustPressed(0, (int)control);
+#elif FIVEM
return API.IsDisabledControlJustPressed(0, (int)control);
#elif ALTV
return Alt.Natives.IsDisabledControlJustPressed(0, (int)control);
@@ -77,7 +84,9 @@ public static bool IsJustPressed(Control control)
/// true if the control is pressed, false otherwise.
public static bool IsPressed(Control control)
{
-#if FIVEM
+#if FIVEMV2
+ return Natives.IsDisabledControlPressed(0, (int)control);
+#elif FIVEM
return API.IsDisabledControlPressed(0, (int)control);
#elif ALTV
return Alt.Natives.IsDisabledControlPressed(0, (int)control);
@@ -94,7 +103,9 @@ public static bool IsPressed(Control control)
///
public static void DisableAll(int inputGroup = 0)
{
-#if FIVEM
+#if FIVEMV2
+ Natives.DisableAllControlActions(inputGroup);
+#elif FIVEM
API.DisableAllControlActions(inputGroup);
#elif ALTV
Alt.Natives.DisableAllControlActions(inputGroup);
@@ -112,7 +123,9 @@ public static void DisableAll(int inputGroup = 0)
/// The control to enable.
public static void EnableThisFrame(Control control)
{
-#if FIVEM
+#if FIVEMV2
+ Natives.EnableControlAction(0, (int)control, true);
+#elif FIVEM
API.EnableControlAction(0, (int)control, true);
#elif ALTV
Alt.Natives.EnableControlAction(0, (int)control, true);
@@ -141,7 +154,9 @@ public static void EnableThisFrame(IEnumerable controls)
/// The control to disable.
public static void DisableThisFrame(Control control)
{
-#if FIVEM
+#if FIVEMV2
+ Natives.DisableControlAction(0, (int)control, true);
+#elif FIVEM
API.DisableControlAction(0, (int)control, true);
#elif ALTV
Alt.Natives.DisableControlAction(0, (int)control, true);
diff --git a/LemonUI/Elements/IText.cs b/LemonUI/Elements/IText.cs
index e67bec8..4c18bfd 100644
--- a/LemonUI/Elements/IText.cs
+++ b/LemonUI/Elements/IText.cs
@@ -1,4 +1,7 @@
-#if FIVEM
+#if FIVEMV2
+using Alignment = CitizenFX.FiveM.GUI.Alignment;
+using Font = CitizenFX.FiveM.GUI.Font;
+#elif FIVEM
using Alignment = CitizenFX.Core.UI.Alignment;
using Font = CitizenFX.Core.UI.Font;
#elif RAGEMP
diff --git a/LemonUI/Elements/ScaledAnim.cs b/LemonUI/Elements/ScaledAnim.cs
index 8376ddd..f956311 100644
--- a/LemonUI/Elements/ScaledAnim.cs
+++ b/LemonUI/Elements/ScaledAnim.cs
@@ -1,4 +1,6 @@
-#if ALTV
+#if FIVEMV2
+using Game = CitizenFX.FiveM.Game;
+#elif ALTV
using AltV.Net.Client;
#elif FIVEM
using CitizenFX.Core;
@@ -107,7 +109,7 @@ private void UpdateTexture()
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
long time = Misc.GetGameTimer();
-#elif FIVEM || RPH || SHVDN3 || SHVDNC
+#elif FIVEM || RPH || SHVDN3 || SHVDNC || FIVEMV2
long time = Game.GameTime;
#endif
diff --git a/LemonUI/Elements/ScaledBink.cs b/LemonUI/Elements/ScaledBink.cs
index 6a27a6a..c1300ce 100644
--- a/LemonUI/Elements/ScaledBink.cs
+++ b/LemonUI/Elements/ScaledBink.cs
@@ -1,4 +1,6 @@
-#if ALTV
+#if FIVEMV2
+using CitizenFX.FiveM.Native;
+#elif ALTV
using AltV.Net.Client;
#elif FIVEM
using CitizenFX.Core.Native;
@@ -40,8 +42,9 @@ public string Name
set
{
name = value ?? throw new ArgumentNullException(nameof(value));
-
-#if ALTV
+#if FIVEMV2
+ Id = Natives.SetBinkMovie(name);
+#elif ALTV
Id = Alt.Natives.SetBinkMovie(name);
#elif FIVEM
Id = API.SetBinkMovie(name);
@@ -107,8 +110,10 @@ public override void Draw()
{
return;
}
-
-#if ALTV
+#if FIVEMV2
+ Natives.PlayBinkMovie(Id);
+ Natives.DrawBinkMovie(Id, relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, 0.0f, 255, 255, 255, 255);
+#elif ALTV
Alt.Natives.PlayBinkMovie(Id);
Alt.Natives.DrawBinkMovie(Id, relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, 0.0f, 255, 255, 255, 255);
#elif FIVEM
@@ -137,8 +142,9 @@ public void Stop()
{
return;
}
-
-#if ALTV
+#if FIVEMV2
+ Natives.StopBinkMovie(Id);
+#elif ALTV
Alt.Natives.StopBinkMovie(Id);
#elif FIVEM
API.StopBinkMovie(Id);
@@ -159,8 +165,9 @@ public void Dispose()
{
return;
}
-
-#if ALTV
+#if FIVEMV2
+ Natives.ReleaseBinkMovie(Id);
+#elif ALTV
Alt.Natives.ReleaseBinkMovie(Id);
#elif FIVEM
API.ReleaseBinkMovie(Id);
diff --git a/LemonUI/Elements/ScaledRectangle.cs b/LemonUI/Elements/ScaledRectangle.cs
index 7496554..7b4133e 100644
--- a/LemonUI/Elements/ScaledRectangle.cs
+++ b/LemonUI/Elements/ScaledRectangle.cs
@@ -1,4 +1,7 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.Core;
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core.Native;
#elif RAGEMP
using RAGE.Game;
@@ -42,7 +45,9 @@ public override void Draw()
{
return;
}
-#if FIVEM
+#if FIVEMV2
+ Natives.DrawRect(relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, Color.R, Color.G, Color.B, Color.A);
+#elif FIVEM
API.DrawRect(relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, Color.R, Color.G, Color.B, Color.A);
#elif RAGEMP
Invoker.Invoke(Natives.DrawRect, relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, Color.R, Color.G, Color.B, Color.A);
diff --git a/LemonUI/Elements/ScaledText.cs b/LemonUI/Elements/ScaledText.cs
index 9da274f..aa86d8b 100644
--- a/LemonUI/Elements/ScaledText.cs
+++ b/LemonUI/Elements/ScaledText.cs
@@ -1,4 +1,8 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM.GUI;
+using CitizenFX.FiveM.Native;
+using Font = CitizenFX.FiveM.GUI.Font;
+#elif FIVEM
using CitizenFX.Core.Native;
using CitizenFX.Core.UI;
using Font = CitizenFX.Core.UI.Font;
@@ -148,7 +152,11 @@ public float Width
{
get
{
-#if FIVEM
+#if FIVEMV2
+ Natives.BeginTextCommandWidth("CELL_EMAIL_BCON");
+ Add();
+ return Natives.EndTextCommandGetWidth(true) * 1f.ToXScaled();
+#elif FIVEM
API.BeginTextCommandWidth("CELL_EMAIL_BCON");
Add();
return API.EndTextCommandGetWidth(true) * 1f.ToXScaled();
@@ -178,7 +186,9 @@ public int LineCount
{
get
{
-#if FIVEM
+#if FIVEMV2
+ Natives.BeginTextCommandLineCount("CELL_EMAIL_BCON");
+#elif FIVEM
API.BeginTextCommandLineCount("CELL_EMAIL_BCON");
#elif ALTV
Alt.Natives.BeginTextCommandGetNumberOfLinesForString("CELL_EMAIL_BCON");
@@ -190,7 +200,9 @@ public int LineCount
Function.Call(Hash.BEGIN_TEXT_COMMAND_GET_NUMBER_OF_LINES_FOR_STRING, "CELL_EMAIL_BCON");
#endif
Add();
-#if FIVEM
+#if FIVEMV2
+ return Natives.EndTextCommandGetLineCount(relativePosition.X, relativePosition.Y);
+#elif FIVEM
return API.EndTextCommandGetLineCount(relativePosition.X, relativePosition.Y);
#elif ALTV
return Alt.Natives.EndTextCommandGetNumberOfLinesForString(relativePosition.X, relativePosition.Y);
@@ -211,7 +223,9 @@ public float LineHeight
get
{
// Height will always be 1080
-#if FIVEM
+#if FIVEMV2
+ return 1080 * Natives.GetTextScaleHeight(Scale, (int)Font);
+#elif FIVEM
return 1080 * API.GetTextScaleHeight(Scale, (int)Font);
#elif ALTV
return 1080 * Alt.Natives.GetRenderedCharacterHeight(Scale, (int)Font);
@@ -274,7 +288,43 @@ private void Add()
{
return;
}
-#if FIVEM
+#if FIVEMV2
+ foreach (string chunk in chunks)
+ {
+ Natives.AddTextComponentString(chunk);
+ }
+ Natives.SetTextFont((int)Font);
+ Natives.SetTextScale(1f, Scale);
+ Natives.SetTextColour(Color.R, Color.G, Color.B, Color.A);
+ Natives.SetTextJustification((int)Alignment);
+ if (Shadow)
+ {
+ Natives.SetTextDropShadow();
+ }
+ if (Outline)
+ {
+ Natives.SetTextOutline();
+ }
+ if (WordWrap > 0)
+ {
+ switch (Alignment)
+ {
+ case Alignment.Center:
+ Natives.SetTextWrap(relativePosition.X - (realWrap * 0.5f), relativePosition.X + (realWrap * 0.5f));
+ break;
+ case Alignment.Left:
+ Natives.SetTextWrap(relativePosition.X, relativePosition.X + realWrap);
+ break;
+ case Alignment.Right:
+ Natives.SetTextWrap(relativePosition.X - realWrap, relativePosition.X);
+ break;
+ }
+ }
+ else if (Alignment == Alignment.Right)
+ {
+ Natives.SetTextWrap(0f, relativePosition.X);
+ }
+#elif FIVEM
foreach (string chunk in chunks)
{
API.AddTextComponentString(chunk);
@@ -525,7 +575,9 @@ public void Recalculate()
///
public void Draw()
{
-#if FIVEM
+#if FIVEMV2
+ Natives.SetTextEntry("CELL_EMAIL_BCON");
+#elif FIVEM
API.SetTextEntry("CELL_EMAIL_BCON");
#elif ALTV
Alt.Natives.BeginTextCommandDisplayText("CELL_EMAIL_BCON");
@@ -538,8 +590,9 @@ public void Draw()
#endif
Add();
-
-#if FIVEM
+#if FIVEMV2
+ Natives.DrawText(relativePosition.X, relativePosition.Y);
+#elif FIVEM
API.DrawText(relativePosition.X, relativePosition.Y);
#elif ALTV
Alt.Natives.EndTextCommandDisplayText(relativePosition.X, relativePosition.Y, 0);
diff --git a/LemonUI/Elements/ScaledTexture.cs b/LemonUI/Elements/ScaledTexture.cs
index 25042a5..2f1349f 100644
--- a/LemonUI/Elements/ScaledTexture.cs
+++ b/LemonUI/Elements/ScaledTexture.cs
@@ -1,4 +1,6 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core.Native;
#elif RAGEMP
using RAGE.Game;
@@ -81,7 +83,12 @@ public ScaledTexture(PointF pos, SizeF size, string dictionary, string texture)
///
private void Request()
{
-#if FIVEM
+#if FIVEMV2
+ if (!Natives.HasStreamedTextureDictLoaded(Dictionary))
+ {
+ Natives.RequestStreamedTextureDict(Dictionary, true);
+ }
+#elif FIVEM
if (!API.HasStreamedTextureDictLoaded(Dictionary))
{
API.RequestStreamedTextureDict(Dictionary, true);
@@ -123,7 +130,9 @@ public override void Draw()
return;
}
Request();
-#if FIVEM
+#if FIVEMV2
+ Natives.DrawSprite(Dictionary, Texture, relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, Heading, Color.R, Color.G, Color.B, Color.A);
+#elif FIVEM
API.DrawSprite(Dictionary, Texture, relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, Heading, Color.R, Color.G, Color.B, Color.A);
#elif RAGEMP
Invoker.Invoke(Natives.DrawSprite, Dictionary, Texture, relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, Heading, Color.R, Color.G, Color.B, Color.A);
@@ -147,7 +156,9 @@ public virtual void DrawSpecific(PointF topLeft, PointF bottomRight)
return;
}
Request();
-#if FIVEM
+#if FIVEMV2
+ Natives.DrawSpriteUv(Dictionary, Texture, relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, topLeft.X, topLeft.Y, bottomRight.X, bottomRight.Y, Heading, Color.R, Color.G, Color.B, Color.A);
+#elif FIVEM
API.DrawSpriteUv(Dictionary, Texture, relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, topLeft.X, topLeft.Y, bottomRight.X, bottomRight.Y, Heading, Color.R, Color.G, Color.B, Color.A);
#elif RAGEMP
Invoker.Invoke(0x95812F9B26074726, Dictionary, Texture, relativePosition.X, relativePosition.Y, relativeSize.Width, relativeSize.Height, topLeft.X, topLeft.Y, bottomRight.X, bottomRight.Y, Heading, Color.R, Color.G, Color.B, Color.A);
diff --git a/LemonUI/Menus/NativeColorPanel.cs b/LemonUI/Menus/NativeColorPanel.cs
index 0044cc5..515ff88 100644
--- a/LemonUI/Menus/NativeColorPanel.cs
+++ b/LemonUI/Menus/NativeColorPanel.cs
@@ -1,4 +1,8 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+using CitizenFX.FiveM.GUI;
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core;
using CitizenFX.Core.UI;
#elif ALTV
diff --git a/LemonUI/Menus/NativeGridPanel.cs b/LemonUI/Menus/NativeGridPanel.cs
index 8b88464..ac6f8fe 100644
--- a/LemonUI/Menus/NativeGridPanel.cs
+++ b/LemonUI/Menus/NativeGridPanel.cs
@@ -1,4 +1,8 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+using CitizenFX.FiveM.GUI;
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
using CitizenFX.Core.UI;
@@ -317,7 +321,11 @@ public override void Process()
Controls.EnableThisFrame(Control.ScriptRightAxisX);
Controls.EnableThisFrame(Control.ScriptRightAxisY);
-#if FIVEM
+#if FIVEMV2
+ float rX = Natives.GetControlNormal(0, (int)Control.ScriptRightAxisX);
+ float rY = Natives.GetControlNormal(0, (int)Control.ScriptRightAxisY);
+ float frameTime = Natives.GetFrameTime();
+#elif FIVEM
float rX = Game.GetControlNormal(0, Control.ScriptRightAxisX);
float rY = Game.GetControlNormal(0, Control.ScriptRightAxisY);
float frameTime = Game.LastFrameTime;
diff --git a/LemonUI/Menus/NativeItem.cs b/LemonUI/Menus/NativeItem.cs
index 683ae49..62d3676 100644
--- a/LemonUI/Menus/NativeItem.cs
+++ b/LemonUI/Menus/NativeItem.cs
@@ -1,4 +1,7 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM.GUI;
+using Font = CitizenFX.FiveM.GUI.Font;
+#elif FIVEM
using Font = CitizenFX.Core.UI.Font;
#elif RAGEMP
using Font = RAGE.Game.Font;
diff --git a/LemonUI/Menus/NativeMenu.cs b/LemonUI/Menus/NativeMenu.cs
index 1ad7ce7..9b37986 100644
--- a/LemonUI/Menus/NativeMenu.cs
+++ b/LemonUI/Menus/NativeMenu.cs
@@ -1,4 +1,9 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+using CitizenFX.FiveM.GUI;
+using CitizenFX.FiveM.Native;
+using Font = CitizenFX.FiveM.GUI.Font;
+#elif FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
using CitizenFX.Core.UI;
@@ -1001,7 +1006,9 @@ public void ResetCursor()
pos = new PointF(x, Offset.Y + extraY).ToRelative();
}
// And set the position of the cursor
-#if FIVEM
+#if FIVEMV2
+ Natives.SetCursorLocation(pos.X, pos.Y);
+#elif FIVEM
API.SetCursorLocation(pos.X, pos.Y);
#elif RAGEMP
Invoker.Invoke(Natives.SetCursorLocation, pos.X, pos.Y);
@@ -1145,7 +1152,9 @@ private void ProcessControls()
}
// If the controls are disabled, the menu has just been opened or the text input field is active, return
-#if FIVEM
+#if FIVEMV2
+ bool isKeyboardActive = Natives.UpdateOnscreenKeyboard() == 0;
+#elif FIVEM
bool isKeyboardActive = API.UpdateOnscreenKeyboard() == 0;
#elif ALTV
bool isKeyboardActive = Alt.Natives.UpdateOnscreenKeyboard() == 0;
@@ -1186,7 +1195,7 @@ private void ProcessControls()
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
long time = Misc.GetGameTimer();
-#elif FIVEM || RPH || SHVDN3 || SHVDNC
+#elif FIVEM || RPH || SHVDN3 || SHVDNC || FIVEMV2
long time = Game.GameTime;
#endif
@@ -1231,7 +1240,7 @@ private void ProcessControls()
{
if (GameScreen.IsCursorInArea(PointF.Empty, searchAreaSize))
{
-#if FIVEM || SHVDN3 || SHVDNC
+#if FIVEM || SHVDN3 || SHVDNC || FIVEMV2
GameplayCamera.RelativeHeading += 5;
#elif ALTV
float current = Alt.Natives.GetGameplayCamRelativeHeading();
@@ -1245,7 +1254,7 @@ private void ProcessControls()
}
else if (GameScreen.IsCursorInArea(searchAreaRight, searchAreaSize))
{
-#if FIVEM || SHVDN3 || SHVDNC
+#if FIVEM || SHVDN3 || SHVDNC || FIVEMV2
GameplayCamera.RelativeHeading -= 5;
#elif ALTV
float current = Alt.Natives.GetGameplayCamRelativeHeading();
@@ -1648,8 +1657,10 @@ public virtual void Process()
{
return;
}
-
-#if FIVEM
+#if FIVEMV2
+ Natives.SetInputExclusive(0, (int)Control.PhoneCancel);
+ Natives.SetInputExclusive(0, (int)Control.FrontendPause);
+#elif FIVEM
API.SetInputExclusive(0, (int)Control.PhoneCancel);
API.SetInputExclusive(0, (int)Control.FrontendPause);
#elif ALTV
diff --git a/LemonUI/Menus/NativeSeparatorItem.cs b/LemonUI/Menus/NativeSeparatorItem.cs
index d3ca979..f7858b9 100644
--- a/LemonUI/Menus/NativeSeparatorItem.cs
+++ b/LemonUI/Menus/NativeSeparatorItem.cs
@@ -1,4 +1,6 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM.GUI;
+#elif FIVEM
using CitizenFX.Core.UI;
#elif RAGEMP
using RAGE.Game;
diff --git a/LemonUI/ObjectPool.cs b/LemonUI/ObjectPool.cs
index cf4dbac..98436d2 100644
--- a/LemonUI/ObjectPool.cs
+++ b/LemonUI/ObjectPool.cs
@@ -1,4 +1,6 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core.Native;
#elif RAGEMP
using RAGE.Game;
diff --git a/LemonUI/Scaleform/BaseScaleform.cs b/LemonUI/Scaleform/BaseScaleform.cs
index 22bdb2b..a99b744 100644
--- a/LemonUI/Scaleform/BaseScaleform.cs
+++ b/LemonUI/Scaleform/BaseScaleform.cs
@@ -1,4 +1,7 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
using System.Threading.Tasks;
@@ -23,13 +26,15 @@ public abstract class BaseScaleform : IScaleform
{
#region Fields
-#if FIVEM || SHVDN3
+#if FIVEM || SHVDN3 || FIVEMV2
///
/// The ID of the scaleform.
///
[Obsolete("Please use the Handle or Name properties and call the methods manually.", true)]
#endif
-#if FIVEM
+#if FIVEMV2
+ protected CitizenFX.FiveM.Scaleform scaleform = new CitizenFX.FiveM.Scaleform(string.Empty);
+#elif FIVEM
protected CitizenFX.Core.Scaleform scaleform = new CitizenFX.Core.Scaleform(string.Empty);
#elif SHVDN3
protected GTA.Scaleform scaleform = new GTA.Scaleform(string.Empty);
@@ -58,7 +63,9 @@ public bool IsLoaded
{
get
{
-#if FIVEM
+#if FIVEMV2
+ return Natives.HasScaleformMovieLoaded(Handle);
+#elif FIVEM
return API.HasScaleformMovieLoaded(Handle);
#elif ALTV
return Alt.Natives.HasScaleformMovieLoaded(Handle);
@@ -84,7 +91,9 @@ public BaseScaleform(string sc)
{
Name = sc ?? throw new ArgumentNullException(nameof(sc));
-#if FIVEM
+#if FIVEMV2
+ Handle = Natives.RequestScaleformMovie(Name);
+#elif FIVEM
Handle = API.RequestScaleformMovie(Name);
#elif ALTV
Handle = Alt.Natives.RequestScaleformMovie(Name);
@@ -112,8 +121,9 @@ private void CallFunctionBase(string function, params object[] parameters)
{
throw new ArgumentOutOfRangeException(nameof(function), "The function name is empty or white space.");
}
-
-#if FIVEM
+#if FIVEMV2
+ Natives.BeginScaleformMovieMethod(Handle, function);
+#elif FIVEM
API.BeginScaleformMovieMethod(Handle, function);
#elif ALTV
Alt.Natives.BeginScaleformMovieMethod(Handle, function);
@@ -133,7 +143,9 @@ private void CallFunctionBase(string function, params object[] parameters)
}
else if (obj is int objInt)
{
-#if FIVEM
+#if FIVEMV2
+ Natives.ScaleformMovieMethodAddParamInt(objInt);
+#elif FIVEM
API.ScaleformMovieMethodAddParamInt(objInt);
#elif ALTV
Alt.Natives.ScaleformMovieMethodAddParamInt(objInt);
@@ -147,7 +159,11 @@ private void CallFunctionBase(string function, params object[] parameters)
}
else if (obj is string objString)
{
-#if FIVEM
+#if FIVEMV2
+ Natives.BeginTextCommandScaleformString("STRING");
+ Natives.AddTextComponentSubstringPlayerName(objString);
+ Natives.EndTextCommandScaleformString();
+#elif FIVEM
API.BeginTextCommandScaleformString("STRING");
API.AddTextComponentSubstringPlayerName(objString);
API.EndTextCommandScaleformString();
@@ -172,7 +188,9 @@ private void CallFunctionBase(string function, params object[] parameters)
}
else if (obj is float objFloat)
{
-#if FIVEM
+#if FIVEMV2
+ Natives.ScaleformMovieMethodAddParamFloat(objFloat);
+#elif FIVEM
API.ScaleformMovieMethodAddParamFloat(objFloat);
#elif ALTV
Alt.Natives.ScaleformMovieMethodAddParamFloat(objFloat);
@@ -186,7 +204,9 @@ private void CallFunctionBase(string function, params object[] parameters)
}
else if (obj is double objDouble)
{
-#if FIVEM
+#if FIVEMV2
+ Natives.ScaleformMovieMethodAddParamFloat((float)objDouble);
+#elif FIVEM
API.ScaleformMovieMethodAddParamFloat((float)objDouble);
#elif ALTV
Alt.Natives.ScaleformMovieMethodAddParamFloat((float)objDouble);
@@ -200,7 +220,9 @@ private void CallFunctionBase(string function, params object[] parameters)
}
else if (obj is bool objBool)
{
-#if FIVEM
+#if FIVEMV2
+ Natives.ScaleformMovieMethodAddParamBool(objBool);
+#elif FIVEM
API.ScaleformMovieMethodAddParamBool(objBool);
#elif ALTV
Alt.Natives.ScaleformMovieMethodAddParamBool(objBool);
@@ -230,7 +252,9 @@ private void CallFunctionBase(string function, params object[] parameters)
/// if the value is ready, otherwise.
public bool IsValueReady(int id)
{
-#if FIVEM
+#if FIVEMV2
+ return Natives.IsScaleformMovieMethodReturnValueReady(id);
+#elif FIVEM
return API.IsScaleformMovieMethodReturnValueReady(id);
#elif ALTV
return Alt.Natives.IsScaleformMovieMethodReturnValueReady(id);
@@ -252,7 +276,9 @@ public T GetValue(int id)
{
if (typeof(T) == typeof(string))
{
-#if FIVEM
+#if FIVEMV2
+ return (T)(object)Natives.GetScaleformMovieMethodReturnValueString(id).ToString();
+#elif FIVEM
return (T)(object)API.GetScaleformMovieMethodReturnValueString(id);
#elif ALTV
return (T)(object)Alt.Natives.GetScaleformMovieMethodReturnValueString(id);
@@ -266,7 +292,9 @@ public T GetValue(int id)
}
else if (typeof(T) == typeof(int))
{
-#if FIVEM
+#if FIVEMV2
+ return (T)(object)Natives.GetScaleformMovieMethodReturnValueInt(id);
+#elif FIVEM
return (T)(object)API.GetScaleformMovieMethodReturnValueInt(id);
#elif ALTV
return (T)(object)Alt.Natives.GetScaleformMovieMethodReturnValueInt(id);
@@ -280,7 +308,9 @@ public T GetValue(int id)
}
else if (typeof(T) == typeof(bool))
{
-#if FIVEM
+#if FIVEMV2
+ return (T)(object)Natives.GetScaleformMovieMethodReturnValueBool(id);
+#elif FIVEM
return (T)(object)API.GetScaleformMovieMethodReturnValueBool(id);
#elif ALTV
return (T)(object)Alt.Natives.GetScaleformMovieMethodReturnValueBool(id);
@@ -305,7 +335,9 @@ public T GetValue(int id)
public void CallFunction(string function, params object[] parameters)
{
CallFunctionBase(function, parameters);
-#if FIVEM
+#if FIVEMV2
+ Natives.EndScaleformMovieMethod();
+#elif FIVEM
API.EndScaleformMovieMethod();
#elif ALTV
Alt.Natives.EndScaleformMovieMethod();
@@ -317,7 +349,7 @@ public void CallFunction(string function, params object[] parameters)
Function.Call((Hash)0xC6796A8FFA375E53);
#endif
}
-#if FIVEM || SHVDN3 || SHVDNC
+#if FIVEM || SHVDN3 || SHVDNC || FIVEMV2
///
/// Calls a scaleform function and gets it's return value as soon as is available.
///
@@ -353,7 +385,9 @@ public T CallFunction(string function, params object[] parameters)
public int CallFunctionReturn(string function, params object[] parameters)
{
CallFunctionBase(function, parameters);
-#if FIVEM
+#if FIVEMV2
+ return Natives.EndScaleformMovieMethodReturnValue();
+#elif FIVEM
return API.EndScaleformMovieMethodReturnValue();
#elif ALTV
return Alt.Natives.EndScaleformMovieMethodReturnValue();
@@ -379,7 +413,9 @@ public virtual void DrawFullScreen()
return;
}
Update();
-#if FIVEM
+#if FIVEMV2
+ Natives.DrawScaleformMovieFullscreen(Handle, 255, 255, 255, 255, 0);
+#elif FIVEM
API.DrawScaleformMovieFullscreen(Handle, 255, 255, 255, 255, 0);
#elif ALTV
Alt.Natives.DrawScaleformMovieFullscreen(Handle, 255, 255, 255, 255, 0);
@@ -405,7 +441,9 @@ public virtual void DrawFullScreen()
public void Dispose()
{
int id = Handle;
-#if FIVEM
+#if FIVEMV2
+ Natives.SetScaleformMovieAsNoLongerNeeded(ref id);
+#elif FIVEM
API.SetScaleformMovieAsNoLongerNeeded(ref id);
#elif ALTV
Alt.Natives.SetScaleformMovieAsNoLongerNeeded(ref id);
diff --git a/LemonUI/Scaleform/BigMessage.cs b/LemonUI/Scaleform/BigMessage.cs
index 4258b32..0a7c496 100644
--- a/LemonUI/Scaleform/BigMessage.cs
+++ b/LemonUI/Scaleform/BigMessage.cs
@@ -1,4 +1,6 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+#elif FIVEM
using CitizenFX.Core;
#elif RAGEMP
using RAGE.Game;
@@ -297,7 +299,7 @@ public void FadeOut(int time)
long currentTime = Alt.Natives.GetGameTimer();
#elif RAGEMP
long currentTime = Misc.GetGameTimer();
-#elif FIVEM || RPH || SHVDN3 || SHVDNC
+#elif FIVEM || RPH || SHVDN3 || SHVDNC || FIVEMV2
long currentTime = Game.GameTime;
#endif
hideAfter = currentTime + time;
@@ -309,7 +311,7 @@ public override void DrawFullScreen()
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
long time = Misc.GetGameTimer();
-#elif FIVEM || RPH || SHVDN3 || SHVDNC
+#elif FIVEM || RPH || SHVDN3 || SHVDNC || FIVEMV2
long time = Game.GameTime;
#endif
diff --git a/LemonUI/Scaleform/BruteForce.cs b/LemonUI/Scaleform/BruteForce.cs
index f1c9969..ac9551c 100644
--- a/LemonUI/Scaleform/BruteForce.cs
+++ b/LemonUI/Scaleform/BruteForce.cs
@@ -1,4 +1,6 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+#elif FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
#elif RAGEMP
@@ -220,7 +222,7 @@ public void Reset()
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
long time = Misc.GetGameTimer();
-#elif FIVEM || RPH || SHVDN3 || SHVDNC
+#elif FIVEM || RPH || SHVDN3 || SHVDNC || FIVEMV2
long time = Game.GameTime;
#endif
@@ -256,7 +258,7 @@ public override void Update()
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
long time = Misc.GetGameTimer();
-#elif FIVEM || RPH || SHVDN3 || SHVDNC
+#elif FIVEM || RPH || SHVDN3 || SHVDNC || FIVEMV2
long time = Game.GameTime;
#endif
diff --git a/LemonUI/Scaleform/Celebration.cs b/LemonUI/Scaleform/Celebration.cs
index 7df5bd3..e140587 100644
--- a/LemonUI/Scaleform/Celebration.cs
+++ b/LemonUI/Scaleform/Celebration.cs
@@ -1,4 +1,7 @@
-#if ALTV
+#if FIVEMV2
+using CitizenFX.FiveM;
+using CitizenFX.FiveM.Native;
+#elif ALTV
using AltV.Net.Client;
#elif FIVEM
using CitizenFX.Core;
@@ -153,7 +156,7 @@ public void Show()
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
long time = Misc.GetGameTimer();
-#elif FIVEM || RPH || SHVDN3 || SHVDNC
+#elif FIVEM || RPH || SHVDN3 || SHVDNC || FIVEMV2
long time = Game.GameTime;
#endif
showUntil = time + 333 + 333 + (Duration * 1000);
@@ -189,7 +192,7 @@ public override void Process()
long time = Alt.Natives.GetGameTimer();
#elif RAGEMP
long time = Misc.GetGameTimer();
-#elif FIVEM || RPH || SHVDN3 || SHVDNC
+#elif FIVEM || RPH || SHVDN3 || SHVDNC || FIVEMV2
long time = Game.GameTime;
#endif
@@ -209,8 +212,10 @@ public override void DrawFullScreen()
{
return;
}
-
- #if ALTV
+ #if FIVEMV2
+ Natives.DrawScaleformMovieFullscreenMasked(Background.Handle, Foreground.Handle, 255, 255, 255, 255);
+ Natives.DrawScaleformMovieFullscreen(Handle, 255, 255, 255, 255, 255);
+ #elif ALTV
Alt.Natives.DrawScaleformMovieFullscreenMasked(Background.Handle, Foreground.Handle, 255, 255, 255, 255);
Alt.Natives.DrawScaleformMovieFullscreen(Handle, 255, 255, 255, 255, 255);
#elif FIVEM
diff --git a/LemonUI/Scaleform/Countdown.cs b/LemonUI/Scaleform/Countdown.cs
index 8d33eb9..090ce26 100644
--- a/LemonUI/Scaleform/Countdown.cs
+++ b/LemonUI/Scaleform/Countdown.cs
@@ -1,4 +1,6 @@
-#if ALTV
+#if FIVEMV2
+using CitizenFX.FiveM;
+#elif ALTV
using AltV.Net.Client;
#elif FIVEM
using CitizenFX.Core;
@@ -132,7 +134,7 @@ public void Start()
lastStepTime = Alt.Natives.GetGameTimer();
#elif RAGEMP
lastStepTime = Misc.GetGameTimer();
-#elif FIVEM || RPH || SHVDN3 || SHVDNC
+#elif FIVEM || RPH || SHVDN3 || SHVDNC || FIVEMV2
lastStepTime = Game.GameTime;
#endif
@@ -154,7 +156,7 @@ public override void Process()
long currentTime = Alt.Natives.GetGameTimer();
#elif RAGEMP
long currentTime = Misc.GetGameTimer();
-#elif FIVEM || RPH || SHVDN3 || SHVDNC
+#elif FIVEM || RPH || SHVDN3 || SHVDNC || FIVEMV2
long currentTime = Game.GameTime;
#endif
diff --git a/LemonUI/Scaleform/InstructionalButton.cs b/LemonUI/Scaleform/InstructionalButton.cs
index 751b15a..58b3b78 100644
--- a/LemonUI/Scaleform/InstructionalButton.cs
+++ b/LemonUI/Scaleform/InstructionalButton.cs
@@ -1,4 +1,7 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
#elif RAGEMP
@@ -49,7 +52,9 @@ public Control Control
set
{
control = value;
-#if FIVEM
+#if FIVEMV2
+ raw = Natives.GetControlInstructionalButton(2, (int)value, true);
+#elif FIVEM
raw = API.GetControlInstructionalButton(2, (int)value, 1);
#elif RAGEMP
raw = Invoker.Invoke(Natives.GetControlInstructionalButton, 2, (int)value, 1);
@@ -88,7 +93,9 @@ public InstructionalButton(string description, Control control)
{
this.description = description ?? throw new ArgumentNullException(nameof(description));
this.control = control;
-#if FIVEM
+#if FIVEMV2
+ raw = Natives.GetControlInstructionalButton(2, (int)control, true);
+#elif FIVEM
raw = API.GetControlInstructionalButton(2, (int)control, 1);
#elif ALTV
raw = Alt.Natives.GetControlInstructionalButtonsString(2, (int)control, true);
diff --git a/LemonUI/Scaleform/InstructionalButtons.cs b/LemonUI/Scaleform/InstructionalButtons.cs
index 233d51d..382eaec 100644
--- a/LemonUI/Scaleform/InstructionalButtons.cs
+++ b/LemonUI/Scaleform/InstructionalButtons.cs
@@ -1,4 +1,7 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
#elif RAGEMP
diff --git a/LemonUI/Screen.cs b/LemonUI/Screen.cs
index b7c893d..0ef9eaf 100644
--- a/LemonUI/Screen.cs
+++ b/LemonUI/Screen.cs
@@ -1,4 +1,8 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+using CitizenFX.FiveM.Native;
+using CitizenFX.FiveM.GUI;
+#elif FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
using CitizenFX.Core.UI;
diff --git a/LemonUI/Sound.cs b/LemonUI/Sound.cs
index 7d278d3..7635ffc 100644
--- a/LemonUI/Sound.cs
+++ b/LemonUI/Sound.cs
@@ -1,4 +1,7 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
#elif RAGEMP
@@ -81,7 +84,10 @@ public Sound(string set, string file)
/// If the sound ID should be automatically released.
public void PlayFrontend(bool release)
{
-#if FIVEM
+#if FIVEMV2
+ Id = Natives.GetSoundId();
+ Natives.PlaySoundFrontend(Id, File, Set, true);
+#elif FIVEM
Id = API.GetSoundId();
API.PlaySoundFrontend(Id, File, Set, true);
#elif RAGEMP
@@ -112,8 +118,9 @@ public void Stop()
{
return;
}
-
-#if FIVEM
+#if FIVEMV2
+ Natives.StopSound(Id);
+#elif FIVEM
API.StopSound(Id);
#elif RAGEMP
Invoker.Invoke(Natives.StopSound, Id);
@@ -136,7 +143,9 @@ public void Release()
return;
}
-#if FIVEM
+#if FIVEMV2
+ Natives.ReleaseSoundId(Id);
+#elif FIVEM
API.ReleaseSoundId(Id);
#elif RAGEMP
Invoker.Invoke(Natives.ReleaseSoundId, Id);
diff --git a/LemonUI/TimerBars/TimerBar.cs b/LemonUI/TimerBars/TimerBar.cs
index abcc77f..5e63319 100644
--- a/LemonUI/TimerBars/TimerBar.cs
+++ b/LemonUI/TimerBars/TimerBar.cs
@@ -1,4 +1,6 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM.GUI;
+#elif FIVEM
using CitizenFX.Core.UI;
#elif RAGEMP
using RAGE.Game;
diff --git a/LemonUI/TimerBars/TimerBarCollection.cs b/LemonUI/TimerBars/TimerBarCollection.cs
index cb7de5d..e75e1b3 100644
--- a/LemonUI/TimerBars/TimerBarCollection.cs
+++ b/LemonUI/TimerBars/TimerBarCollection.cs
@@ -1,4 +1,7 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM.GUI;
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core.UI;
#elif RAGEMP
using RAGE.Game;
@@ -165,7 +168,11 @@ public void Process()
}
// Hide the texts in the bottom right corner of the screen
-#if FIVEM
+#if FIVEMV2
+ CitizenFX.FiveM.GUI.Screen.Hud.HideComponentThisFrame(HudComponent.AreaName);
+ CitizenFX.FiveM.GUI.Screen.Hud.HideComponentThisFrame(HudComponent.StreetName);
+ CitizenFX.FiveM.GUI.Screen.Hud.HideComponentThisFrame(HudComponent.VehicleName);
+#elif FIVEM
CitizenFX.Core.UI.Screen.Hud.HideComponentThisFrame(HudComponent.AreaName);
CitizenFX.Core.UI.Screen.Hud.HideComponentThisFrame(HudComponent.StreetName);
CitizenFX.Core.UI.Screen.Hud.HideComponentThisFrame(HudComponent.VehicleName);
diff --git a/LemonUI/Tools/GameScreen.cs b/LemonUI/Tools/GameScreen.cs
index 4315cf5..b4ee472 100644
--- a/LemonUI/Tools/GameScreen.cs
+++ b/LemonUI/Tools/GameScreen.cs
@@ -1,4 +1,7 @@
-#if FIVEM
+#if FIVEMV2
+using CitizenFX.FiveM;
+using CitizenFX.FiveM.Native;
+#elif FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
using CitizenFX.Core.UI;
@@ -34,7 +37,9 @@ public static SizeF AbsoluteResolution
{
get
{
-#if ALTV
+#if FIVEMV2
+ return new SizeF(CitizenFX.FiveM.GUI.Screen.Resolution.Width, CitizenFX.FiveM.GUI.Screen.Resolution.Height);
+#elif ALTV
int height = 0, width = 0;
Alt.Natives.GetActualScreenResolution(ref width, ref height);
return new SizeF(width, height);
@@ -57,7 +62,9 @@ public static float AspectRatio
{
get
{
-#if FIVEM
+#if FIVEMV2
+ return Natives.GetAspectRatio(false);
+#elif FIVEM
return API.GetAspectRatio(false);
#elif RAGEMP
return Invoker.Invoke(Natives.GetAspectRatio);
@@ -77,7 +84,10 @@ public static PointF Cursor
{
get
{
-#if FIVEM
+#if FIVEMV2
+ float cursorX = Natives.GetControlNormal(0, (int)Control.CursorX);
+ float cursorY = Natives.GetControlNormal(0, (int)Control.CursorY);
+#elif FIVEM
float cursorX = API.GetControlNormal(0, (int)Control.CursorX);
float cursorY = API.GetControlNormal(0, (int)Control.CursorY);
#elif ALTV
@@ -129,7 +139,9 @@ public static bool IsCursorInArea(float x, float y, float width, float height)
///
public static void ShowCursorThisFrame()
{
-#if FIVEM
+#if FIVEMV2
+ Natives.SetMouseCursorActiveThisFrame();
+#elif FIVEM
API.SetMouseCursorActiveThisFrame();
#elif ALTV
Alt.Natives.SetMouseCursorThisFrame();
diff --git a/LemonUI/Tools/SafeZone.cs b/LemonUI/Tools/SafeZone.cs
index e78b3cc..e1ea535 100644
--- a/LemonUI/Tools/SafeZone.cs
+++ b/LemonUI/Tools/SafeZone.cs
@@ -1,4 +1,7 @@
-#if ALTV
+#if FIVEMV2
+using CitizenFX.FiveM.GUI;
+using CitizenFX.FiveM.Native;
+#elif ALTV
using AltV.Net.Client;
#elif RAGEMP
using RAGE.Game;
@@ -33,7 +36,9 @@ public static float Size
{
get
{
-#if ALTV
+#if FIVEMV2
+ return Natives.GetSafeZoneSize();
+#elif ALTV
return Alt.Natives.GetSafeZoneSize();
#elif FIVEM
return API.GetSafeZoneSize();
@@ -104,7 +109,9 @@ public static PointF GetSafePosition(float x, float y)
float relativeY = y.ToYRelative();
float realX = 0, realY = 0;
-#if FIVEM
+#if FIVEMV2
+ Natives.GetScriptGfxPosition(relativeX, relativeY, ref realX, ref realY);
+#elif FIVEM
API.GetScriptGfxPosition(relativeX, relativeY, ref realX, ref realY);
#elif ALTV
Alt.Natives.GetScriptGfxAlignPosition(relativeX, relativeY, ref realX, ref realY);
@@ -144,7 +151,10 @@ public static PointF GetSafePosition(float x, float y)
/// The vertical alignment of the items.
public static void SetAlignment(GFXAlignment horizontal, GFXAlignment vertical)
{
-#if FIVEM
+#if FIVEMV2
+ Natives.SetScriptGfxAlign((int)horizontal, (int)vertical);
+ Natives.SetScriptGfxAlignParams(0, 0, 0, 0);
+#elif FIVEM
API.SetScriptGfxAlign((int)horizontal, (int)vertical);
API.SetScriptGfxAlignParams(0, 0, 0, 0);
#elif ALTV
@@ -166,7 +176,9 @@ public static void SetAlignment(GFXAlignment horizontal, GFXAlignment vertical)
///
public static void ResetAlignment()
{
-#if FIVEM
+#if FIVEMV2
+ Natives.ResetScriptGfxAlign();
+#elif FIVEM
API.ResetScriptGfxAlign();
#elif ALTV
Alt.Natives.ResetScriptGfxAlign();