diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1ff0c42..0000000 --- a/.gitattributes +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################### -# Set default behavior to automatically normalize line endings. -############################################################################### -* text=auto - -############################################################################### -# Set default behavior for command prompt diff. -# -# This is need for earlier builds of msysgit that does not have it on by -# default for csharp files. -# Note: This is only used by command line -############################################################################### -#*.cs diff=csharp - -############################################################################### -# Set the merge driver for project and solution files -# -# Merging from the command prompt will add diff markers to the files if there -# are conflicts (Merging from VS is not affected by the settings below, in VS -# the diff markers are never inserted). Diff markers may cause the following -# file extensions to fail to load in VS. An alternative would be to treat -# these files as binary and thus will always conflict and require user -# intervention with every merge. To do so, just uncomment the entries below -############################################################################### -#*.sln merge=binary -#*.csproj merge=binary -#*.vbproj merge=binary -#*.vcxproj merge=binary -#*.vcproj merge=binary -#*.dbproj merge=binary -#*.fsproj merge=binary -#*.lsproj merge=binary -#*.wixproj merge=binary -#*.modelproj merge=binary -#*.sqlproj merge=binary -#*.wwaproj merge=binary - -############################################################################### -# behavior for image files -# -# image files are treated as binary by default. -############################################################################### -#*.jpg binary -#*.png binary -#*.gif binary - -############################################################################### -# diff behavior for common document formats -# -# Convert binary document formats to text before diffing them. This feature -# is only available from the command line. Turn it on by uncommenting the -# entries below. -############################################################################### -#*.doc diff=astextplain -#*.DOC diff=astextplain -#*.docx diff=astextplain -#*.DOCX diff=astextplain -#*.dot diff=astextplain -#*.DOT diff=astextplain -#*.pdf diff=astextplain -#*.PDF diff=astextplain -#*.rtf diff=astextplain -#*.RTF diff=astextplain diff --git a/Client/fxmanifest.lua b/Client/fxmanifest.lua deleted file mode 100644 index f2a183e..0000000 --- a/Client/fxmanifest.lua +++ /dev/null @@ -1,14 +0,0 @@ -fx_version 'cerulean' -games { 'gta5' } - -author 'ToastinYou' -description 'No Reticle / Reticle Disabler' -version '2.2.0' - -client_scripts { - 'Client.net.dll', -} - -server_scripts { - 'Server.net.dll', -} \ No newline at end of file diff --git a/Client/Main.cs b/NoReticle.Client/ClientMain.cs similarity index 64% rename from Client/Main.cs rename to NoReticle.Client/ClientMain.cs index bb8a122..9c53750 100644 --- a/Client/Main.cs +++ b/NoReticle.Client/ClientMain.cs @@ -1,15 +1,15 @@ using CitizenFX.Core; -using CitizenFX.Core.Native; -using System; +using static CitizenFX.Core.Native.API; using System.Threading.Tasks; +using CitizenFX.Core.UI; -namespace Client +namespace NoReticle.Client { - public class Main : BaseScript + public class ClientMain : BaseScript { - private bool _reticleAllowed, _stunGunReticleAllowed; + private bool reticleAllowed, stunGunReticleAllowed; - public Main() + public ClientMain() { Log("Resource loaded."); TriggerServerEvent("NoReticle:Server:GetAcePermissions", Game.Player.Handle); @@ -19,18 +19,18 @@ public Main() private void SetPlayerReticleAceAllowed() { Log("Allowing reticle."); - _reticleAllowed = true; + reticleAllowed = true; } [EventHandler("NoReticle:Client:SetStunGunReticleAllowed")] private void SetStunGunReticleAllowed() { Log("Allowing stun gun reticle."); - _stunGunReticleAllowed = true; + stunGunReticleAllowed = true; } [Tick] - private async Task ProcessTask() + private Task OnTick() { // gets client's current weapon. Weapon w = Game.PlayerPed?.Weapons?.Current; @@ -38,20 +38,22 @@ private async Task ProcessTask() if (w != null) { // disable reticle for musket and all weapons EXCEPT snipers, unarmed, stungun (if permissions allowed), and aircraft (w.Group == 0). - if (w.Hash == WeaponHash.Musket || !(w.Group == WeaponGroup.Sniper || w.Group == WeaponGroup.Unarmed || (_stunGunReticleAllowed && w.Group == WeaponGroup.Stungun) || w.Group == 0)) + if (w.Hash == WeaponHash.Musket || !((w.Group == WeaponGroup.Sniper && IsFirstPersonAimCamActive()) || w.Group == WeaponGroup.Unarmed || (stunGunReticleAllowed && w.Group == WeaponGroup.Stungun) || w.Group == 0)) { // if ace perm "Reticle" is not allowed (cannot have reticle) then.. - if (!_reticleAllowed) + if (!reticleAllowed) { // hides reticle (white dot [HUD] when aiming in). - API.HideHudComponentThisFrame(14); + HideHudComponentThisFrame(14); } } } + + return Task.FromResult(0); } /// - /// Writes debug message to client's console. + /// Writes debug message to the client's console. /// /// Message to display. private void Log(string msg) @@ -59,4 +61,4 @@ private void Log(string msg) Debug.Write($"[NoReticle]: {msg}\n"); } } -} +} \ No newline at end of file diff --git a/Server/Server.csproj b/NoReticle.Client/NoReticle.Client.csproj similarity index 72% rename from Server/Server.csproj rename to NoReticle.Client/NoReticle.Client.csproj index 11262c2..5ae104b 100644 --- a/Server/Server.csproj +++ b/NoReticle.Client/NoReticle.Client.csproj @@ -4,35 +4,41 @@ Debug AnyCPU - {A74E9727-19EF-46FE-B940-056978E2DA99} + {7BCB0CF3-3F9F-4A32-9852-39A4E2EA7529} Library Properties - Server - Server.net + NoReticle.Client + NoReticle.Client.net v4.5.2 512 + true true - portable + embedded false ..\build\ - DEBUG;TRACE + + prompt 4 - portable + embedded true ..\build\ - TRACE + + prompt 4 true + + false + - - ..\packages\CitizenFX.Core.Server.1.0.3212\lib\net45\CitizenFX.Core.Server.dll + + ..\packages\CitizenFX.Core.Client.1.0.5230\lib\net45\CitizenFX.Core.Client.dll False @@ -45,7 +51,7 @@ - + diff --git a/Server/Properties/AssemblyInfo.cs b/NoReticle.Client/Properties/AssemblyInfo.cs similarity index 79% rename from Server/Properties/AssemblyInfo.cs rename to NoReticle.Client/Properties/AssemblyInfo.cs index 35d8ca9..e2bcb46 100644 --- a/Server/Properties/AssemblyInfo.cs +++ b/NoReticle.Client/Properties/AssemblyInfo.cs @@ -5,12 +5,12 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Server")] +[assembly: AssemblyTitle("NoReticle.Client")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Server")] -[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyProduct("NoReticle.Client")] +[assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -20,7 +20,7 @@ [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a74e9727-19ef-46fe-b940-056978e2da99")] +[assembly: Guid("7bcb0cf3-3f9f-4a32-9852-39a4e2ea7529")] // Version information for an assembly consists of the following four values: // @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.2.0")] -[assembly: AssemblyFileVersion("2.2.0")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Client/packages.config b/NoReticle.Client/packages.config similarity index 57% rename from Client/packages.config rename to NoReticle.Client/packages.config index e6047f6..ade0982 100644 --- a/Client/packages.config +++ b/NoReticle.Client/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Client/Client.csproj b/NoReticle.Server/NoReticle.Server.csproj similarity index 80% rename from Client/Client.csproj rename to NoReticle.Server/NoReticle.Server.csproj index 34a979b..4aaf1ea 100644 --- a/Client/Client.csproj +++ b/NoReticle.Server/NoReticle.Server.csproj @@ -4,20 +4,22 @@ Debug AnyCPU - {F8C5642D-8030-46B7-B55F-C5FCE19080BE} + {980F4CA9-BCB5-4A47-8E65-94E14B0A32BF} Library Properties - Client - Client.net + NoReticle.Server + NoReticle.Server.net v4.5.2 512 + true true embedded false ..\build\ - DEBUG;TRACE + + prompt 4 @@ -25,14 +27,15 @@ embedded true ..\build\ - TRACE + + prompt 4 true - - ..\packages\CitizenFX.Core.Client.1.0.3212\lib\net45\CitizenFX.Core.Client.dll + + ..\packages\CitizenFX.Core.Server.1.0.5230\lib\net45\CitizenFX.Core.Server.dll False @@ -45,14 +48,14 @@ - + - PreserveNewest + \ No newline at end of file diff --git a/Client/Properties/AssemblyInfo.cs b/NoReticle.Server/Properties/AssemblyInfo.cs similarity index 79% rename from Client/Properties/AssemblyInfo.cs rename to NoReticle.Server/Properties/AssemblyInfo.cs index b067a3f..928a647 100644 --- a/Client/Properties/AssemblyInfo.cs +++ b/NoReticle.Server/Properties/AssemblyInfo.cs @@ -5,12 +5,12 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Client")] +[assembly: AssemblyTitle("NoReticle.Server")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Client")] -[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyProduct("NoReticle.Server")] +[assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -20,7 +20,7 @@ [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("f8c5642d-8030-46b7-b55f-c5fce19080be")] +[assembly: Guid("980f4ca9-bcb5-4a47-8e65-94e14b0a32bf")] // Version information for an assembly consists of the following four values: // @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.2.0")] -[assembly: AssemblyFileVersion("2.2.0")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Server/Main.cs b/NoReticle.Server/ServerMain.cs similarity index 71% rename from Server/Main.cs rename to NoReticle.Server/ServerMain.cs index ccfce73..bf0f12a 100644 --- a/Server/Main.cs +++ b/NoReticle.Server/ServerMain.cs @@ -1,22 +1,20 @@ using CitizenFX.Core; -using CitizenFX.Core.Native; +using static CitizenFX.Core.Native.API; -namespace Server +namespace NoReticle.Server { - public class Main : BaseScript + public class ServerMain : BaseScript { - public Main() { } - [EventHandler("NoReticle:Server:GetAcePermissions")] private void GetAcePermissions([FromSource] Player p) { // if ace permission 'Reticle' is allowed for the player then show the reticle.. - if (API.IsPlayerAceAllowed(p.Handle, "Reticle")) + if (IsPlayerAceAllowed(p.Handle, "Reticle")) { p.TriggerEvent("NoReticle:Client:SetPlayerReticleAceAllowed"); } // if ace permission 'ReticleStunGun' is allowed for the player then show the reticle.. - if (API.IsPlayerAceAllowed(p.Handle, "ReticleStunGun")) + if (IsPlayerAceAllowed(p.Handle, "ReticleStunGun")) { p.TriggerEvent("NoReticle:Client:SetStunGunReticleAllowed"); } diff --git a/NoReticle.Server/fxmanifest.lua b/NoReticle.Server/fxmanifest.lua new file mode 100644 index 0000000..e6e4eb5 --- /dev/null +++ b/NoReticle.Server/fxmanifest.lua @@ -0,0 +1,8 @@ +fx_version 'cerulean' +game 'gta5' + +author 'ToastinYou' +version '2.3.0' + +client_script 'NoReticle.Client.net.dll' +server_script 'NoReticle.Server.net.dll' \ No newline at end of file diff --git a/Server/packages.config b/NoReticle.Server/packages.config similarity index 57% rename from Server/packages.config rename to NoReticle.Server/packages.config index d856be8..9e44bde 100644 --- a/Server/packages.config +++ b/NoReticle.Server/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/NoReticle.sln b/NoReticle.sln index d3999f5..cde5694 100644 --- a/NoReticle.sln +++ b/NoReticle.sln @@ -1,11 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2005 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31424.327 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{F8C5642D-8030-46B7-B55F-C5FCE19080BE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoReticle.Client", "NoReticle.Client\NoReticle.Client.csproj", "{7BCB0CF3-3F9F-4A32-9852-39A4E2EA7529}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{A74E9727-19EF-46FE-B940-056978E2DA99}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoReticle.Server", "NoReticle.Server\NoReticle.Server.csproj", "{980F4CA9-BCB5-4A47-8E65-94E14B0A32BF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,19 +13,19 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F8C5642D-8030-46B7-B55F-C5FCE19080BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F8C5642D-8030-46B7-B55F-C5FCE19080BE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F8C5642D-8030-46B7-B55F-C5FCE19080BE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F8C5642D-8030-46B7-B55F-C5FCE19080BE}.Release|Any CPU.Build.0 = Release|Any CPU - {A74E9727-19EF-46FE-B940-056978E2DA99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A74E9727-19EF-46FE-B940-056978E2DA99}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A74E9727-19EF-46FE-B940-056978E2DA99}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A74E9727-19EF-46FE-B940-056978E2DA99}.Release|Any CPU.Build.0 = Release|Any CPU + {7BCB0CF3-3F9F-4A32-9852-39A4E2EA7529}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7BCB0CF3-3F9F-4A32-9852-39A4E2EA7529}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7BCB0CF3-3F9F-4A32-9852-39A4E2EA7529}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7BCB0CF3-3F9F-4A32-9852-39A4E2EA7529}.Release|Any CPU.Build.0 = Release|Any CPU + {980F4CA9-BCB5-4A47-8E65-94E14B0A32BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {980F4CA9-BCB5-4A47-8E65-94E14B0A32BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {980F4CA9-BCB5-4A47-8E65-94E14B0A32BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {980F4CA9-BCB5-4A47-8E65-94E14B0A32BF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {532FE271-0D51-42A8-8617-0C993F7A3DA9} + SolutionGuid = {8B1EA5E6-4C2B-4789-9871-D58248BF29D5} EndGlobalSection EndGlobal diff --git a/README.md b/README.md index 840b6b5..a386d7a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # NoReticle -Server-side FiveM script that disables the reticle (white dot [HUD item] when aiming in with a weapon). Now includes use of ACE permissions! +Server-side FiveM script that disables the reticle (white dot [HUD item] when aiming in with a weapon). \ No newline at end of file