mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-18 10:43:22 +00:00
14
Commands.cs
14
Commands.cs
@@ -248,7 +248,7 @@ namespace WeaponPaints
|
||||
}
|
||||
|
||||
gPlayerWeaponsInfo[p.Slot][weaponDefIndex].Paint = paintID;
|
||||
gPlayerWeaponsInfo[p.Slot][weaponDefIndex].Wear = 0.01f;
|
||||
gPlayerWeaponsInfo[p.Slot][weaponDefIndex].Wear = 0.00f;
|
||||
gPlayerWeaponsInfo[p.Slot][weaponDefIndex].Seed = 0;
|
||||
|
||||
PlayerInfo playerInfo = new PlayerInfo
|
||||
@@ -381,7 +381,17 @@ namespace WeaponPaints
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await weaponSync.SyncGloveToDatabase(playerInfo, (ushort)weaponDefindex);
|
||||
await weaponSync.SyncGloveToDatabase(playerInfo, weaponDefindex);
|
||||
|
||||
if (!gPlayerWeaponsInfo[playerInfo.Slot].ContainsKey(weaponDefindex))
|
||||
{
|
||||
gPlayerWeaponsInfo[playerInfo.Slot][weaponDefindex] = new WeaponInfo();
|
||||
}
|
||||
|
||||
gPlayerWeaponsInfo[playerInfo.Slot][weaponDefindex].Paint = paint;
|
||||
gPlayerWeaponsInfo[playerInfo.Slot][weaponDefindex].Wear = 0.00f;
|
||||
gPlayerWeaponsInfo[playerInfo.Slot][weaponDefindex].Seed = 0;
|
||||
|
||||
});
|
||||
}
|
||||
RefreshGloves(player);
|
||||
|
||||
32
Events.cs
32
Events.cs
@@ -52,7 +52,7 @@ namespace WeaponPaints
|
||||
{
|
||||
CCSPlayerController player = @event.Userid;
|
||||
|
||||
if (player is null || !player.IsValid || !player.UserId.HasValue || player.IsBot ||
|
||||
if (player is null || !player.IsValid || player.IsBot ||
|
||||
player.IsHLTV || player.SteamID.ToString().Length != 17) return HookResult.Continue;
|
||||
|
||||
PlayerInfo playerInfo = new PlayerInfo
|
||||
@@ -71,25 +71,25 @@ namespace WeaponPaints
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await weaponSync.SyncWeaponPaintsToDatabase(playerInfo);
|
||||
|
||||
// Remove player data
|
||||
if (Config.Additional.SkinEnabled)
|
||||
{
|
||||
gPlayerWeaponsInfo.TryRemove(player.Slot, out _);
|
||||
}
|
||||
if (Config.Additional.KnifeEnabled)
|
||||
{
|
||||
g_playersKnife.TryRemove(player.Slot, out _);
|
||||
}
|
||||
if (Config.Additional.GloveEnabled)
|
||||
{
|
||||
g_playersGlove.TryRemove(player.Slot, out _);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Remove player's command cooldown
|
||||
commandsCooldown.Remove(player.Slot);
|
||||
// Remove player data
|
||||
if (Config.Additional.SkinEnabled)
|
||||
{
|
||||
gPlayerWeaponsInfo.TryRemove(player.Slot, out _);
|
||||
}
|
||||
if (Config.Additional.KnifeEnabled)
|
||||
{
|
||||
g_playersKnife.TryRemove(player.Slot, out _);
|
||||
}
|
||||
if (Config.Additional.GloveEnabled)
|
||||
{
|
||||
g_playersGlove.TryRemove(player.Slot, out _);
|
||||
}
|
||||
|
||||
|
||||
return HookResult.Continue;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ namespace WeaponPaints
|
||||
pickupCount++;
|
||||
g_knifePickupCount[player.Slot] = pickupCount;
|
||||
|
||||
RefreshWeapons(player);
|
||||
AddTimer(0.2f, () => RefreshWeapons(player));
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
|
||||
@@ -263,7 +263,7 @@ namespace WeaponPaints
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 1; i <= 3; i++)
|
||||
{
|
||||
player.ExecuteClientCommand($"slot {i}");
|
||||
player.ExecuteClientCommand($"slot {i}");
|
||||
@@ -272,6 +272,9 @@ namespace WeaponPaints
|
||||
{
|
||||
var weapon = player.PlayerPawn.Value.WeaponServices.ActiveWeapon.Value;
|
||||
CCSWeaponBaseGun? gun = weapon?.As<CCSWeaponBaseGun>();
|
||||
|
||||
if (gun?.VData?.GearSlot == gear_slot_t.GEAR_SLOT_C4 || gun?.VData?.GearSlot == gear_slot_t.GEAR_SLOT_GRENADES) return;
|
||||
|
||||
player.DropActiveWeapon();
|
||||
|
||||
AddTimer(0.22f, () =>
|
||||
@@ -362,7 +365,7 @@ namespace WeaponPaints
|
||||
pawn.SetModel(model);
|
||||
}
|
||||
|
||||
Instance.AddTimer(0.2f, () =>
|
||||
Instance.AddTimer(0.06f, () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -155,7 +155,7 @@ public partial class WeaponPaints : BasePlugin, IPluginConfig<WeaponPaintsConfig
|
||||
public override string ModuleAuthor => "Nereziel & daffyy";
|
||||
public override string ModuleDescription => "Skin, gloves and knife selector, standalone and web-based";
|
||||
public override string ModuleName => "WeaponPaints";
|
||||
public override string ModuleVersion => "1.9a";
|
||||
public override string ModuleVersion => "1.9b";
|
||||
|
||||
public static WeaponPaintsConfig GetWeaponPaintsConfig()
|
||||
{
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace WeaponPaints
|
||||
}
|
||||
|
||||
|
||||
internal async Task SyncGloveToDatabase(PlayerInfo player, ushort defindex)
|
||||
internal async Task SyncGloveToDatabase(PlayerInfo player, int defindex)
|
||||
{
|
||||
if (!_config.Additional.GloveEnabled || player == null || string.IsNullOrEmpty(player.SteamId)) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user