Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 2.2.0 #10

Merged
merged 6 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bld/
[Bb]in/
[Oo]bj/
[Ll]og/
build/*

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand Down
5 changes: 3 additions & 2 deletions Client/Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
</PropertyGroup>
<ItemGroup>
<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>
<HintPath>..\packages\CitizenFX.Core.Client.1.0.3212\lib\net45\CitizenFX.Core.Client.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -49,7 +50,7 @@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="__resource.lua">
<None Include="fxmanifest.lua">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Expand Down
35 changes: 16 additions & 19 deletions Client/Main.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CitizenFX.Core;
using CitizenFX.Core;
using CitizenFX.Core.Native;
using CitizenFX.Core.UI;
using System;
using System.Threading.Tasks;

namespace Client
{
public class Main : BaseScript
{
private bool _reticleAllowed = false;

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

public Main()
{
Log("Resource loaded.");
TriggerServerEvent("NoReticle:Server:GetPlayerReticleAceAllowed", Game.Player.Handle);
TriggerServerEvent("NoReticle:Server:GetAcePermissions", Game.Player.Handle);
}

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

[EventHandler("NoReticle:Client:SetStunGunReticleAllowed")]
private void SetStunGunReticleAllowed()
{
Log("Allowing stun gun reticle.");
_stunGunReticleAllowed = true;
}

[Tick]
private async Task ProcessTask()
{
Expand All @@ -39,9 +37,8 @@ private async Task ProcessTask()

if (w != null)
{
WeaponHash wHash = w.Hash;

if (!_overrideDisable.Contains(wHash) && API.GetHashKey(wHash.ToString()) != -1783943904) // add MarksmanRifle MKII
// 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 ace perm "Reticle" is not allowed (cannot have reticle) then..
if (!_reticleAllowed)
Expand All @@ -59,7 +56,7 @@ private async Task ProcessTask()
/// <param name="msg">Message to display.</param>
private void Log(string msg)
{
Debug.Write($"[NoReticle] - {msg}");
Debug.Write($"[NoReticle]: {msg}\n");
}
}
}
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("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
[assembly: AssemblyVersion("2.2.0")]
[assembly: AssemblyFileVersion("2.2.0")]
9 changes: 0 additions & 9 deletions Client/__resource.lua

This file was deleted.

14 changes: 14 additions & 0 deletions Client/fxmanifest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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',
}
2 changes: 1 addition & 1 deletion Client/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CitizenFX.Core.Client" version="1.0.1290" targetFramework="net452" />
<package id="CitizenFX.Core.Client" version="1.0.3212" targetFramework="net452" />
</packages>
11 changes: 8 additions & 3 deletions Server/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ public class Main : BaseScript
{
public Main() { }

[EventHandler("NoReticle:Server:GetPlayerReticleAceAllowed")]
private void GetPlayerReticleAceAllowed([FromSource] Player p)
[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") == true)
if (API.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"))
{
p.TriggerEvent("NoReticle:Client:SetStunGunReticleAllowed");
}
}
}
}
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("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
[assembly: AssemblyVersion("2.2.0")]
[assembly: AssemblyFileVersion("2.2.0")]
7 changes: 4 additions & 3 deletions Server/Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\build\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>embedded</DebugType>
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\build\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
Expand All @@ -32,7 +32,8 @@
</PropertyGroup>
<ItemGroup>
<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>
<HintPath>..\packages\CitizenFX.Core.Server.1.0.3212\lib\net45\CitizenFX.Core.Server.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion Server/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CitizenFX.Core.Server" version="1.0.1290" targetFramework="net452" />
<package id="CitizenFX.Core.Server" version="1.0.3212" targetFramework="net452" />
</packages>
Binary file removed build/CitizenFX.Core.Client.dll
Binary file not shown.
Loading