mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-18 02:41:54 +00:00
1.9b
- Fixed weapons on retake - FIxed saving
This commit is contained in:
14
Commands.cs
14
Commands.cs
@@ -248,7 +248,7 @@ namespace WeaponPaints
|
|||||||
}
|
}
|
||||||
|
|
||||||
gPlayerWeaponsInfo[p.Slot][weaponDefIndex].Paint = paintID;
|
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;
|
gPlayerWeaponsInfo[p.Slot][weaponDefIndex].Seed = 0;
|
||||||
|
|
||||||
PlayerInfo playerInfo = new PlayerInfo
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
@@ -381,7 +381,17 @@ namespace WeaponPaints
|
|||||||
{
|
{
|
||||||
Task.Run(async () =>
|
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);
|
RefreshGloves(player);
|
||||||
|
|||||||
12
Events.cs
12
Events.cs
@@ -52,7 +52,7 @@ namespace WeaponPaints
|
|||||||
{
|
{
|
||||||
CCSPlayerController player = @event.Userid;
|
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;
|
player.IsHLTV || player.SteamID.ToString().Length != 17) return HookResult.Continue;
|
||||||
|
|
||||||
PlayerInfo playerInfo = new PlayerInfo
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
@@ -71,11 +71,7 @@ namespace WeaponPaints
|
|||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await weaponSync.SyncWeaponPaintsToDatabase(playerInfo);
|
await weaponSync.SyncWeaponPaintsToDatabase(playerInfo);
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove player's command cooldown
|
|
||||||
commandsCooldown.Remove(player.Slot);
|
|
||||||
// Remove player data
|
// Remove player data
|
||||||
if (Config.Additional.SkinEnabled)
|
if (Config.Additional.SkinEnabled)
|
||||||
{
|
{
|
||||||
@@ -89,7 +85,11 @@ namespace WeaponPaints
|
|||||||
{
|
{
|
||||||
g_playersGlove.TryRemove(player.Slot, out _);
|
g_playersGlove.TryRemove(player.Slot, out _);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove player's command cooldown
|
||||||
|
commandsCooldown.Remove(player.Slot);
|
||||||
|
|
||||||
return HookResult.Continue;
|
return HookResult.Continue;
|
||||||
}
|
}
|
||||||
@@ -160,7 +160,7 @@ namespace WeaponPaints
|
|||||||
pickupCount++;
|
pickupCount++;
|
||||||
g_knifePickupCount[player.Slot] = pickupCount;
|
g_knifePickupCount[player.Slot] = pickupCount;
|
||||||
|
|
||||||
RefreshWeapons(player);
|
AddTimer(0.3f, () => RefreshWeapons(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
return HookResult.Continue;
|
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}");
|
||||||
player.ExecuteClientCommand($"slot {i}");
|
player.ExecuteClientCommand($"slot {i}");
|
||||||
@@ -272,6 +272,9 @@ namespace WeaponPaints
|
|||||||
{
|
{
|
||||||
var weapon = player.PlayerPawn.Value.WeaponServices.ActiveWeapon.Value;
|
var weapon = player.PlayerPawn.Value.WeaponServices.ActiveWeapon.Value;
|
||||||
CCSWeaponBaseGun? gun = weapon?.As<CCSWeaponBaseGun>();
|
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();
|
player.DropActiveWeapon();
|
||||||
|
|
||||||
AddTimer(0.22f, () =>
|
AddTimer(0.22f, () =>
|
||||||
@@ -362,7 +365,7 @@ namespace WeaponPaints
|
|||||||
pawn.SetModel(model);
|
pawn.SetModel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
Instance.AddTimer(0.2f, () =>
|
Instance.AddTimer(0.06f, () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -155,7 +155,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, gloves and knife selector, standalone and web-based";
|
public override string ModuleDescription => "Skin, gloves and knife selector, standalone and web-based";
|
||||||
public override string ModuleName => "WeaponPaints";
|
public override string ModuleName => "WeaponPaints";
|
||||||
public override string ModuleVersion => "1.9a";
|
public override string ModuleVersion => "1.9b";
|
||||||
|
|
||||||
public static WeaponPaintsConfig GetWeaponPaintsConfig()
|
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;
|
if (!_config.Additional.GloveEnabled || player == null || string.IsNullOrEmpty(player.SteamId)) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user