- Fixed weapons on retake
- FIxed saving
This commit is contained in:
Dawid Bepierszcz
2024-02-22 22:41:32 +01:00
parent ddb4fb7cba
commit 19d004c21d
6 changed files with 36 additions and 23 deletions

View File

@@ -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);

View File

@@ -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,11 +71,7 @@ namespace WeaponPaints
Task.Run(async () =>
{
await weaponSync.SyncWeaponPaintsToDatabase(playerInfo);
});
}
// Remove player's command cooldown
commandsCooldown.Remove(player.Slot);
// Remove player data
if (Config.Additional.SkinEnabled)
{
@@ -89,7 +85,11 @@ namespace WeaponPaints
{
g_playersGlove.TryRemove(player.Slot, out _);
}
});
}
// Remove player's command cooldown
commandsCooldown.Remove(player.Slot);
return HookResult.Continue;
}
@@ -160,7 +160,7 @@ namespace WeaponPaints
pickupCount++;
g_knifePickupCount[player.Slot] = pickupCount;
RefreshWeapons(player);
AddTimer(0.3f, () => RefreshWeapons(player));
}
return HookResult.Continue;

View File

@@ -1 +1 @@
1.9a
1.9b

View File

@@ -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
{

View File

@@ -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()
{

View File

@@ -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;