Skip to content

Commit

Permalink
Merge pull request #4 from ToastinYou/dev
Browse files Browse the repository at this point in the history
Merge v2.1.0 to Master for Release.
  • Loading branch information
ToastinYou authored Jun 3, 2019
2 parents 9fabafc + 2991a39 commit 78dec12
Show file tree
Hide file tree
Showing 18 changed files with 3,822 additions and 712 deletions.
15 changes: 10 additions & 5 deletions Client/Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,23 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\build\</OutputPath>
<OutputPath>..\build\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>embedded</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\build\</OutputPath>
<OutputPath>..\build\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="CitizenFX.Core">
<HintPath>..\dependencies\client\CitizenFX.Core.dll</HintPath>
<Private>False</Private>
<Reference Include="CitizenFX.Core.Client, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CitizenFX.Core.Client.1.0.1290\lib\net45\CitizenFX.Core.Client.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -48,5 +47,11 @@
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="__resource.lua">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
47 changes: 20 additions & 27 deletions Client/Main.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CitizenFX.Core;
using CitizenFX.Core.Native;
Expand All @@ -8,56 +10,47 @@ namespace Client
{
public class Main : BaseScript
{
private Ped _p = Game.PlayerPed;
private bool _reticleAllowed = false;

private List<WeaponHash> _overrideDisable = new List<WeaponHash>()
{
WeaponHash.Unarmed, WeaponHash.StunGun, WeaponHash.SniperRifle, WeaponHash.HeavySniper,
WeaponHash.HeavySniperMk2, WeaponHash.MarksmanRifle,
};

public Main()
{
Log("Resource loaded.");

EventHandlers.Add("NoReticle:Client:SetPlayerReticleAceAllowed", new Action(SetPlayerReticleAceAllowed));

TriggerServerEvent("NoReticle:Server:GetPlayerReticleAceAllowed", Game.Player.Handle);

Tick += ProcessTask;
}

[EventHandler("NoReticle:Client:SetPlayerReticleAceAllowed")]
private void SetPlayerReticleAceAllowed()
{
Screen.ShowNotification("Allowing reticle.", true);
_reticleAllowed = true;
}

[Tick]
private async Task ProcessTask()
{
if (_p != null)
// gets client's current weapon.
Weapon w = Game.PlayerPed?.Weapons?.Current;

if (w != null)
{
// gets client's current weapon.
Weapon w = _p.Weapons.Current;
WeaponHash wHash = w.Hash;

if (w != null)
if (!_overrideDisable.Contains(wHash) && API.GetHashKey(wHash.ToString()) != -1783943904) // add MarksmanRifle MKII
{
WeaponHash wHash = w.Hash;

if (wHash != WeaponHash.Unarmed && wHash != WeaponHash.StunGun &&
wHash != WeaponHash.SniperRifle && wHash != WeaponHash.HeavySniper &&
wHash != WeaponHash.HeavySniperMk2 &&
wHash != WeaponHash.MarksmanRifle &&
API.GetHashKey(wHash.ToString()) != -1783943904) // add MarksmanRifle MKII
// if ace perm "Reticle" is not allowed (cannot have reticle) then..
if (!_reticleAllowed)
{
// if ace perm "Reticle" is not allowed (cannot have reticle) then..
if (_reticleAllowed == false)
{
// hides reticle (white dot [HUD] when aiming in).
API.HideHudComponentThisFrame(14);
}
// hides reticle (white dot [HUD] when aiming in).
API.HideHudComponentThisFrame(14);
}
}
}
else
{
_p = Game.PlayerPed;
}
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
9 changes: 9 additions & 0 deletions Client/__resource.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'

client_scripts {
'Client.net.dll',
}

server_script {
'Server.net.dll',
}
4 changes: 4 additions & 0 deletions Client/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CitizenFX.Core.Client" version="1.0.1290" targetFramework="net452" />
</packages>
11 changes: 4 additions & 7 deletions Server/Main.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using System;
using CitizenFX.Core;
using CitizenFX.Core;
using CitizenFX.Core.Native;

namespace Server
{
public class Main : BaseScript
{
public Main()
{
EventHandlers.Add("NoReticle:Server:GetPlayerReticleAceAllowed", new Action<Player>(GetPlayerReticleAceAllowed));
}
public Main() { }

[EventHandler("NoReticle:Server:GetPlayerReticleAceAllowed")]
private void GetPlayerReticleAceAllowed([FromSource] Player p)
{
// if ace permission 'Reticle' is allowed for the player then show the reticle..
Expand All @@ -20,4 +17,4 @@ private void GetPlayerReticleAceAllowed([FromSource] Player p)
}
}
}
}
}
4 changes: 2 additions & 2 deletions Server/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
12 changes: 7 additions & 5 deletions Server/Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,23 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\build\</OutputPath>
<OutputPath>..\build\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>embedded</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\build\</OutputPath>
<OutputPath>..\build\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="CitizenFX.Core.Server">
<HintPath>..\dependencies\server\CitizenFX.Core.Server.dll</HintPath>
<Private>False</Private>
<Reference Include="CitizenFX.Core.Server, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\CitizenFX.Core.Server.1.0.1290\lib\net45\CitizenFX.Core.Server.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -48,5 +47,8 @@
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
4 changes: 4 additions & 0 deletions Server/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CitizenFX.Core.Server" version="1.0.1290" targetFramework="net452" />
</packages>
Binary file added build/CitizenFX.Core.Client.dll
Binary file not shown.
Loading

0 comments on commit 78dec12

Please sign in to comment.