- Updated css
- Minor changes
This commit is contained in:
Dawid Bepierszcz
2024-01-18 01:36:05 +01:00
parent 55905ccc33
commit d04bc0879a
6 changed files with 24 additions and 16 deletions

View File

@@ -40,9 +40,14 @@ namespace WeaponPaints
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || player.UserId == null) return;
if (Config.Additional.KnifeEnabled)
g_playersKnife.Remove((int)player.Index);
g_playersKnife.TryRemove((int)player.Index, out _);
if (Config.Additional.SkinEnabled)
gPlayerWeaponsInfo.Remove((int)player.Index);
{
if (gPlayerWeaponsInfo.TryRemove((int)player.Index, out var innerDictionary))
{
innerDictionary.Clear();
}
}
if (commandsCooldown.ContainsKey((int)player.UserId))
{
commandsCooldown.Remove((int)player.UserId);
@@ -52,7 +57,8 @@ namespace WeaponPaints
private void OnEntityCreated(CEntityInstance entity)
{
if (!Config.Additional.SkinEnabled) return;
var designerName = entity.DesignerName;
if (entity == null || !entity.IsValid || string.IsNullOrEmpty(entity.DesignerName)) return;
string designerName = entity.DesignerName;
if (!weaponList.ContainsKey(designerName)) return;
bool isKnife = false;
var weapon = new CBasePlayerWeapon(entity.Handle);
@@ -229,7 +235,7 @@ namespace WeaponPaints
private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info)
{
CCSPlayerController? player = @event.Userid;
if (player == null || !player.IsValid || player.IsBot)
if (player == null || !player.IsValid)
{
return HookResult.Continue;
}

View File

@@ -1 +1 @@
1.3h
1.3i

View File

@@ -62,6 +62,7 @@ namespace WeaponPaints
internal static void GiveKnifeToPlayer(CCSPlayerController? player)
{
if (!_config.Additional.KnifeEnabled || player == null || !player.IsValid) return;
if (g_playersKnife.TryGetValue((int)player.Index, out var knife))
{
player.GiveNamedItem(knife);

View File

@@ -2,13 +2,14 @@ using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Modules.Cvars;
using Newtonsoft.Json.Linq;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
using System.Collections.Concurrent;
namespace WeaponPaints;
[MinimumApiVersion(132)]
[MinimumApiVersion(142)]
public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
{
internal static readonly Dictionary<string, string> weaponList = new()
@@ -72,11 +73,10 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
internal static WeaponPaintsConfig _config = new WeaponPaintsConfig();
internal static IStringLocalizer? _localizer;
internal static Dictionary<int, int> g_knifePickupCount = new Dictionary<int, int>();
internal static Dictionary<int, string> g_playersKnife = new();
internal static Dictionary<int, Dictionary<int, WeaponInfo>> gPlayerWeaponsInfo = new Dictionary<int, Dictionary<int, WeaponInfo>>();
internal static ConcurrentDictionary<int, string> g_playersKnife = new ConcurrentDictionary<int, string>();
internal static ConcurrentDictionary<int, ConcurrentDictionary<int, WeaponInfo>> gPlayerWeaponsInfo = new ConcurrentDictionary<int, ConcurrentDictionary<int, WeaponInfo>>();
internal static List<JObject> skinsList = new List<JObject>();
internal static WeaponSynchronization? weaponSync;
//internal static List<int> g_changedKnife = new();
internal bool g_bCommandsAllowed = true;
internal Uri GlobalShareApi = new("https://weaponpaints.fun/api.php");
@@ -145,7 +145,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
public override string ModuleAuthor => "Nereziel & daffyy";
public override string ModuleDescription => "Skin and knife selector, standalone and web-based";
public override string ModuleName => "WeaponPaints";
public override string ModuleVersion => "1.3h";
public override string ModuleVersion => "1.3i";
public static WeaponPaintsConfig GetWeaponPaintsConfig()
{

View File

@@ -9,9 +9,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.132" />
<PackageReference Include="Dapper" Version="2.1.24" />
<PackageReference Include="MySqlConnector" Version="2.3.3" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.147" />
<PackageReference Include="Dapper" Version="2.1.28" />
<PackageReference Include="MySqlConnector" Version="2.3.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@@ -1,6 +1,7 @@
using Dapper;
using MySqlConnector;
using Newtonsoft.Json.Linq;
using System.Collections.Concurrent;
namespace WeaponPaints
{
@@ -94,7 +95,7 @@ namespace WeaponPaints
if (!WeaponPaints.gPlayerWeaponsInfo.TryGetValue(player.Index, out _))
{
WeaponPaints.gPlayerWeaponsInfo[player.Index] = new Dictionary<int, WeaponInfo>();
WeaponPaints.gPlayerWeaponsInfo[player.Index] = new ConcurrentDictionary<int, WeaponInfo>();
}
try
{