mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-03-02 22:22:58 +00:00
17.09.2025 - Update
This commit is contained in:
11
Events.cs
11
Events.cs
@@ -4,6 +4,7 @@ using CounterStrikeSharp.API.Core.Attributes.Registration;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace WeaponPaints
|
||||
{
|
||||
@@ -222,7 +223,7 @@ namespace WeaponPaints
|
||||
|
||||
if (designerName.Contains("weapon"))
|
||||
{
|
||||
Server.NextFrame(() =>
|
||||
Server.NextWorldUpdate(() =>
|
||||
{
|
||||
var weapon = new CBasePlayerWeapon(entity.Handle);
|
||||
if (!weapon.IsValid) return;
|
||||
@@ -251,7 +252,7 @@ namespace WeaponPaints
|
||||
|
||||
if (string.IsNullOrEmpty(player?.PlayerName)) return;
|
||||
if (!Utility.IsPlayerValid(player)) return;
|
||||
|
||||
|
||||
GivePlayerWeaponSkin(player, weapon);
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -285,7 +286,7 @@ namespace WeaponPaints
|
||||
var player = @event.Userid;
|
||||
if (player == null || !player.IsValid || player.IsBot) return HookResult.Continue;
|
||||
if (!@event.Item.Contains("knife")) return HookResult.Continue;
|
||||
|
||||
|
||||
var weaponDefIndex = (int)@event.Defindex;
|
||||
|
||||
if (!HasChangedKnife(player, out var _) || !HasChangedPaint(player, weaponDefIndex, out var _))
|
||||
@@ -295,7 +296,7 @@ namespace WeaponPaints
|
||||
{
|
||||
GiveOnItemPickup(player);
|
||||
}
|
||||
|
||||
|
||||
return HookResult.Continue;
|
||||
}
|
||||
|
||||
@@ -340,7 +341,7 @@ namespace WeaponPaints
|
||||
RegisterEventHandler<EventRoundStart>(OnRoundStart);
|
||||
RegisterEventHandler<EventRoundEnd>(OnRoundEnd);
|
||||
RegisterEventHandler<EventRoundMvp>(OnRoundMvp);
|
||||
RegisterListener<Listeners.OnEntityCreated>(OnEntityCreated);
|
||||
RegisterListener<Listeners.OnEntitySpawned>(OnEntityCreated);
|
||||
RegisterEventHandler<EventPlayerDeath>(OnPlayerDeath);
|
||||
|
||||
if (Config.Additional.ShowSkinImage)
|
||||
|
||||
Reference in New Issue
Block a user