mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-18 10:43:22 +00:00
1.3i
- Updated css - Minor changes
This commit is contained in:
14
Events.cs
14
Events.cs
@@ -40,9 +40,14 @@ namespace WeaponPaints
|
|||||||
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || player.UserId == null) return;
|
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || player.UserId == null) return;
|
||||||
|
|
||||||
if (Config.Additional.KnifeEnabled)
|
if (Config.Additional.KnifeEnabled)
|
||||||
g_playersKnife.Remove((int)player.Index);
|
g_playersKnife.TryRemove((int)player.Index, out _);
|
||||||
if (Config.Additional.SkinEnabled)
|
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))
|
if (commandsCooldown.ContainsKey((int)player.UserId))
|
||||||
{
|
{
|
||||||
commandsCooldown.Remove((int)player.UserId);
|
commandsCooldown.Remove((int)player.UserId);
|
||||||
@@ -52,7 +57,8 @@ namespace WeaponPaints
|
|||||||
private void OnEntityCreated(CEntityInstance entity)
|
private void OnEntityCreated(CEntityInstance entity)
|
||||||
{
|
{
|
||||||
if (!Config.Additional.SkinEnabled) return;
|
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;
|
if (!weaponList.ContainsKey(designerName)) return;
|
||||||
bool isKnife = false;
|
bool isKnife = false;
|
||||||
var weapon = new CBasePlayerWeapon(entity.Handle);
|
var weapon = new CBasePlayerWeapon(entity.Handle);
|
||||||
@@ -229,7 +235,7 @@ namespace WeaponPaints
|
|||||||
private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info)
|
private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info)
|
||||||
{
|
{
|
||||||
CCSPlayerController? player = @event.Userid;
|
CCSPlayerController? player = @event.Userid;
|
||||||
if (player == null || !player.IsValid || player.IsBot)
|
if (player == null || !player.IsValid)
|
||||||
{
|
{
|
||||||
return HookResult.Continue;
|
return HookResult.Continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ namespace WeaponPaints
|
|||||||
internal static void GiveKnifeToPlayer(CCSPlayerController? player)
|
internal static void GiveKnifeToPlayer(CCSPlayerController? player)
|
||||||
{
|
{
|
||||||
if (!_config.Additional.KnifeEnabled || player == null || !player.IsValid) return;
|
if (!_config.Additional.KnifeEnabled || player == null || !player.IsValid) return;
|
||||||
|
|
||||||
if (g_playersKnife.TryGetValue((int)player.Index, out var knife))
|
if (g_playersKnife.TryGetValue((int)player.Index, out var knife))
|
||||||
{
|
{
|
||||||
player.GiveNamedItem(knife);
|
player.GiveNamedItem(knife);
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ using CounterStrikeSharp.API;
|
|||||||
using CounterStrikeSharp.API.Core;
|
using CounterStrikeSharp.API.Core;
|
||||||
using CounterStrikeSharp.API.Core.Attributes;
|
using CounterStrikeSharp.API.Core.Attributes;
|
||||||
using CounterStrikeSharp.API.Modules.Cvars;
|
using CounterStrikeSharp.API.Modules.Cvars;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
|
||||||
namespace WeaponPaints;
|
namespace WeaponPaints;
|
||||||
|
|
||||||
[MinimumApiVersion(132)]
|
[MinimumApiVersion(142)]
|
||||||
public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
||||||
{
|
{
|
||||||
internal static readonly Dictionary<string, string> weaponList = new()
|
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 WeaponPaintsConfig _config = new WeaponPaintsConfig();
|
||||||
internal static IStringLocalizer? _localizer;
|
internal static IStringLocalizer? _localizer;
|
||||||
internal static Dictionary<int, int> g_knifePickupCount = new Dictionary<int, int>();
|
internal static Dictionary<int, int> g_knifePickupCount = new Dictionary<int, int>();
|
||||||
internal static Dictionary<int, string> g_playersKnife = new();
|
internal static ConcurrentDictionary<int, string> g_playersKnife = new ConcurrentDictionary<int, string>();
|
||||||
internal static Dictionary<int, Dictionary<int, WeaponInfo>> gPlayerWeaponsInfo = new Dictionary<int, Dictionary<int, WeaponInfo>>();
|
internal static ConcurrentDictionary<int, ConcurrentDictionary<int, WeaponInfo>> gPlayerWeaponsInfo = new ConcurrentDictionary<int, ConcurrentDictionary<int, WeaponInfo>>();
|
||||||
internal static List<JObject> skinsList = new List<JObject>();
|
internal static List<JObject> skinsList = new List<JObject>();
|
||||||
internal static WeaponSynchronization? weaponSync;
|
internal static WeaponSynchronization? weaponSync;
|
||||||
//internal static List<int> g_changedKnife = new();
|
|
||||||
internal bool g_bCommandsAllowed = true;
|
internal bool g_bCommandsAllowed = true;
|
||||||
|
|
||||||
internal Uri GlobalShareApi = new("https://weaponpaints.fun/api.php");
|
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 ModuleAuthor => "Nereziel & daffyy";
|
||||||
public override string ModuleDescription => "Skin and knife selector, standalone and web-based";
|
public override string ModuleDescription => "Skin and knife selector, standalone and web-based";
|
||||||
public override string ModuleName => "WeaponPaints";
|
public override string ModuleName => "WeaponPaints";
|
||||||
public override string ModuleVersion => "1.3h";
|
public override string ModuleVersion => "1.3i";
|
||||||
|
|
||||||
public static WeaponPaintsConfig GetWeaponPaintsConfig()
|
public static WeaponPaintsConfig GetWeaponPaintsConfig()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.132" />
|
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.147" />
|
||||||
<PackageReference Include="Dapper" Version="2.1.24" />
|
<PackageReference Include="Dapper" Version="2.1.28" />
|
||||||
<PackageReference Include="MySqlConnector" Version="2.3.3" />
|
<PackageReference Include="MySqlConnector" Version="2.3.4" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Dapper;
|
using Dapper;
|
||||||
using MySqlConnector;
|
using MySqlConnector;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
|
||||||
namespace WeaponPaints
|
namespace WeaponPaints
|
||||||
{
|
{
|
||||||
@@ -94,7 +95,7 @@ namespace WeaponPaints
|
|||||||
|
|
||||||
if (!WeaponPaints.gPlayerWeaponsInfo.TryGetValue(player.Index, out _))
|
if (!WeaponPaints.gPlayerWeaponsInfo.TryGetValue(player.Index, out _))
|
||||||
{
|
{
|
||||||
WeaponPaints.gPlayerWeaponsInfo[player.Index] = new Dictionary<int, WeaponInfo>();
|
WeaponPaints.gPlayerWeaponsInfo[player.Index] = new ConcurrentDictionary<int, WeaponInfo>();
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user