Skip to content

Commit

Permalink
Merge pull request #241 from daffyyyy/main
Browse files Browse the repository at this point in the history
2.4d
  • Loading branch information
daffyyyy authored Apr 26, 2024
2 parents c594cd5 + ec0d4f4 commit 74ec584
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
4 changes: 3 additions & 1 deletion Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using CounterStrikeSharp.API.Modules.Entities;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using System.Runtime.InteropServices;

namespace WeaponPaints
{
Expand Down Expand Up @@ -342,7 +343,8 @@ private void RegisterListeners()
if (Config.Additional.ShowSkinImage)
RegisterListener<Listeners.OnTick>(OnTick);

VirtualFunctions.GiveNamedItemFunc.Hook(OnGiveNamedItemPost, HookMode.Post);
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
VirtualFunctions.GiveNamedItemFunc.Hook(OnGiveNamedItemPost, HookMode.Post);
}
}
}
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4b
2.4d
8 changes: 4 additions & 4 deletions WeaponAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ internal void RefreshWeapons(CCSPlayerController? player)

int playerTeam = player.TeamNum;

Dictionary<string, List<(int, int)>> weaponsWithAmmo = new Dictionary<string, List<(int, int)>>();
Dictionary<string, List<(int, int)>> weaponsWithAmmo = [];

foreach (var weapon in weapons)
{
Expand Down Expand Up @@ -101,7 +101,7 @@ internal void RefreshWeapons(CCSPlayerController? player)

if (!weaponsWithAmmo.TryGetValue(weaponByDefindex, out List<(int, int)>? value))
{
value = new List<(int, int)>();
value = [];
weaponsWithAmmo.Add(weaponByDefindex, value);
}

Expand All @@ -121,8 +121,8 @@ internal void RefreshWeapons(CCSPlayerController? player)

try
{
player.ExecuteClientCommand("slot 3");
player.ExecuteClientCommand("slot 3");
player.ExecuteClientCommandFromServer("slot 3");
player.ExecuteClientCommandFromServer("slot 3");

var weapon = player.PlayerPawn.Value.WeaponServices.ActiveWeapon;
if (weapon is null || !weapon.IsValid || weapon.Value == null) return;
Expand Down
7 changes: 4 additions & 3 deletions WeaponPaints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace WeaponPaints;

[MinimumApiVersion(201)]
[MinimumApiVersion(215)]
public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
{
internal static WeaponPaints Instance { get; private set; } = new();
Expand Down Expand Up @@ -160,7 +160,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
public override string ModuleAuthor => "Nereziel & daffyy";
public override string ModuleDescription => "Skin, gloves, agents and knife selector, standalone and web-based";
public override string ModuleName => "WeaponPaints";
public override string ModuleVersion => "2.4b";
public override string ModuleVersion => "2.4d";

public static WeaponPaintsConfig GetWeaponPaintsConfig()
{
Expand Down Expand Up @@ -252,7 +252,8 @@ public void OnConfigParsed(WeaponPaintsConfig config)
if (config.DatabaseHost.Length < 1 || config.DatabaseName.Length < 1 || config.DatabaseUser.Length < 1)
{
Logger.LogError("You need to setup Database credentials in config!");
throw new Exception("[WeaponPaints] You need to setup Database credentials in config!");
Unload(false);
//throw new Exception("[WeaponPaints] You need to setup Database credentials in config!");
}

var builder = new MySqlConnectionStringBuilder
Expand Down
4 changes: 2 additions & 2 deletions WeaponPaints.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.203" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.215" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="MySqlConnector" Version="2.3.6" />
<PackageReference Include="MySqlConnector" Version="2.3.7" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

Expand Down

0 comments on commit 74ec584

Please sign in to comment.