mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-03-10 08:31:42 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6d4108ca7 | ||
|
|
7b45169d8d | ||
|
|
42bd45c3f0 |
@@ -195,6 +195,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
}
|
}
|
||||||
Server.NextFrame(() =>
|
Server.NextFrame(() =>
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
if (!weapon.IsValid) return;
|
if (!weapon.IsValid) return;
|
||||||
if (weapon.OwnerEntity.Value == null) return;
|
if (weapon.OwnerEntity.Value == null) return;
|
||||||
if (!weapon.OwnerEntity.Value.EntityIndex.HasValue) return;
|
if (!weapon.OwnerEntity.Value.EntityIndex.HasValue) return;
|
||||||
@@ -225,6 +226,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
var skeleton = GetSkeletonInstance(weapon.CBodyComponent.SceneNode);
|
var skeleton = GetSkeletonInstance(weapon.CBodyComponent.SceneNode);
|
||||||
skeleton.ModelState.MeshGroupMask = 2;
|
skeleton.ModelState.MeshGroupMask = 2;
|
||||||
}
|
}
|
||||||
|
} catch(Exception) {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public void GiveKnifeToPlayer(CCSPlayerController player)
|
public void GiveKnifeToPlayer(CCSPlayerController player)
|
||||||
@@ -267,6 +269,7 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
}
|
}
|
||||||
public void RefreshPlayerKnife(CCSPlayerController player)
|
public void RefreshPlayerKnife(CCSPlayerController player)
|
||||||
{
|
{
|
||||||
|
if (!player.IsValid || !player.PawnIsAlive) return;
|
||||||
if (!PlayerHasKnife(player))
|
if (!PlayerHasKnife(player))
|
||||||
GiveKnifeToPlayer(player);
|
GiveKnifeToPlayer(player);
|
||||||
}
|
}
|
||||||
@@ -320,11 +323,11 @@ public class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig>
|
|||||||
|
|
||||||
public bool PlayerHasKnife(CCSPlayerController player)
|
public bool PlayerHasKnife(CCSPlayerController player)
|
||||||
{
|
{
|
||||||
if (!Config.Additional.KnifeEnabled) return true;
|
if (!Config.Additional.KnifeEnabled) return false;
|
||||||
|
|
||||||
if (!player.IsValid || !player.PlayerPawn.IsValid)
|
if (!player.IsValid || !player.PawnIsAlive)
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var weapons = player.PlayerPawn.Value.WeaponServices!.MyWeapons;
|
var weapons = player.PlayerPawn.Value.WeaponServices!.MyWeapons;
|
||||||
|
|||||||
Reference in New Issue
Block a user