mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-17 18:39:07 +00:00
1.6c
- Fix for invalid players
This commit is contained in:
@@ -9,7 +9,8 @@ namespace WeaponPaints
|
||||
{
|
||||
CCSPlayerController? player = Utilities.GetPlayerFromSlot(playerSlot);
|
||||
|
||||
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || weaponSync == null || player.Connected == PlayerConnectedState.PlayerDisconnecting) return;
|
||||
if (player is null || !player.IsValid || player.IsBot || player.IsHLTV || player.SteamID.ToString().Length != 17 ||
|
||||
weaponSync == null || player.Connected == PlayerConnectedState.PlayerDisconnecting) return;
|
||||
|
||||
PlayerInfo playerInfo = new PlayerInfo
|
||||
{
|
||||
@@ -37,8 +38,7 @@ namespace WeaponPaints
|
||||
{
|
||||
CCSPlayerController player = Utilities.GetPlayerFromSlot(playerSlot);
|
||||
|
||||
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || player.UserId == null)
|
||||
return;
|
||||
if (player is null || !player.IsValid || !player.UserId.HasValue || player.IsBot || player.IsHLTV || player.SteamID.ToString().Length != 17) return;
|
||||
|
||||
if (Config.Additional.KnifeEnabled)
|
||||
g_playersKnife.TryRemove((int)player.Index, out _);
|
||||
@@ -134,7 +134,7 @@ namespace WeaponPaints
|
||||
CCSPlayerController? player = Utilities.GetEntityFromIndex<CCSPlayerPawn>((int)activator.Index).OriginalController.Value;
|
||||
|
||||
if (player == null || player.IsBot || player.IsHLTV ||
|
||||
player.SteamID.ToString() == "" || !g_knifePickupCount.TryGetValue((int)player.Index, out var pickupCount) ||
|
||||
player.SteamID.ToString().Length != 17 || !g_knifePickupCount.TryGetValue((int)player.Index, out var pickupCount) ||
|
||||
!g_playersKnife.ContainsKey((int)player.Index))
|
||||
{
|
||||
return HookResult.Continue;
|
||||
|
||||
@@ -358,11 +358,7 @@ namespace WeaponPaints
|
||||
|
||||
if (weapon.Value.DesignerName.Contains("knife") || weaponData?.GearSlot == gear_slot_t.GEAR_SLOT_KNIFE)
|
||||
{
|
||||
player.RemoveItemByDesignerName(weapon.Value.DesignerName, false);
|
||||
if (weapon.Value.Entity != null && weapon.Value.Entity.EntityInstance.IsValid)
|
||||
weapon.Value.Remove();
|
||||
|
||||
AddTimer(0.2f, () => GiveKnifeToPlayer(player));
|
||||
RefreshWeapons(player);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,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.6b";
|
||||
public override string ModuleVersion => "1.6c";
|
||||
|
||||
public static WeaponPaintsConfig GetWeaponPaintsConfig()
|
||||
{
|
||||
@@ -166,7 +166,8 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
|
||||
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (weaponSync == null || player is null || !player.IsValid || !player.PawnIsAlive || player.IsBot || player.IsHLTV || player.Connected != PlayerConnectedState.PlayerConnected)
|
||||
if (weaponSync == null || player is null || !player.IsValid || player.SteamID.ToString().Length != 17 || !player.PawnIsAlive || player.IsBot ||
|
||||
player.IsHLTV || player.Connected != PlayerConnectedState.PlayerConnected)
|
||||
continue;
|
||||
|
||||
g_knifePickupCount[(int)player.Index] = 0;
|
||||
|
||||
Reference in New Issue
Block a user