mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-25 12:52:17 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1109c0cf56 | ||
|
|
63869f4c94 | ||
|
|
fa284678e8 | ||
|
|
558f3178f2 |
@@ -9,7 +9,8 @@ namespace WeaponPaints
|
|||||||
{
|
{
|
||||||
CCSPlayerController? player = Utilities.GetPlayerFromSlot(playerSlot);
|
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
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
{
|
{
|
||||||
@@ -37,8 +38,7 @@ namespace WeaponPaints
|
|||||||
{
|
{
|
||||||
CCSPlayerController player = Utilities.GetPlayerFromSlot(playerSlot);
|
CCSPlayerController player = Utilities.GetPlayerFromSlot(playerSlot);
|
||||||
|
|
||||||
if (player == null || !player.IsValid || player.IsBot || player.IsHLTV || player.UserId == null)
|
if (player is null || !player.IsValid || !player.UserId.HasValue || player.IsBot || player.IsHLTV || player.SteamID.ToString().Length != 17) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (Config.Additional.KnifeEnabled)
|
if (Config.Additional.KnifeEnabled)
|
||||||
g_playersKnife.TryRemove((int)player.Index, out _);
|
g_playersKnife.TryRemove((int)player.Index, out _);
|
||||||
@@ -134,7 +134,7 @@ namespace WeaponPaints
|
|||||||
CCSPlayerController? player = Utilities.GetEntityFromIndex<CCSPlayerPawn>((int)activator.Index).OriginalController.Value;
|
CCSPlayerController? player = Utilities.GetEntityFromIndex<CCSPlayerPawn>((int)activator.Index).OriginalController.Value;
|
||||||
|
|
||||||
if (player == null || player.IsBot || player.IsHLTV ||
|
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))
|
!g_playersKnife.ContainsKey((int)player.Index))
|
||||||
{
|
{
|
||||||
return HookResult.Continue;
|
return HookResult.Continue;
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ namespace WeaponPaints
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void RefreshKnife(CCSPlayerController? player, bool force = false)
|
internal void RefreshKnife(CCSPlayerController? player)
|
||||||
{
|
{
|
||||||
if (player == null || !player.IsValid || player.PlayerPawn?.Value == null || (LifeState_t)player.LifeState != LifeState_t.LIFE_ALIVE)
|
if (player == null || !player.IsValid || player.PlayerPawn?.Value == null || (LifeState_t)player.LifeState != LifeState_t.LIFE_ALIVE)
|
||||||
return;
|
return;
|
||||||
@@ -358,8 +358,7 @@ namespace WeaponPaints
|
|||||||
|
|
||||||
if (weapon.Value.DesignerName.Contains("knife") || weaponData?.GearSlot == gear_slot_t.GEAR_SLOT_KNIFE)
|
if (weapon.Value.DesignerName.Contains("knife") || weaponData?.GearSlot == gear_slot_t.GEAR_SLOT_KNIFE)
|
||||||
{
|
{
|
||||||
player.RemoveItemByDesignerName(weapon.Value.DesignerName, weapon.Value.Entity?.EntityInstance.IsValid ?? false);
|
RefreshWeapons(player);
|
||||||
AddTimer(0.2f, () => GiveKnifeToPlayer(player));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,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.6b";
|
public override string ModuleVersion => "1.6c";
|
||||||
|
|
||||||
public static WeaponPaintsConfig GetWeaponPaintsConfig()
|
public static WeaponPaintsConfig GetWeaponPaintsConfig()
|
||||||
{
|
{
|
||||||
@@ -166,7 +166,8 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
|
|||||||
|
|
||||||
foreach (var player in Utilities.GetPlayers())
|
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;
|
continue;
|
||||||
|
|
||||||
g_knifePickupCount[(int)player.Index] = 0;
|
g_knifePickupCount[(int)player.Index] = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user