Compare commits

...

4 Commits

Author SHA1 Message Date
Dawid Bepierszcz
9e59456c9f Merge pull request #475 from stefanx111/fix-weapon-kill
fix: safe weapon kill (hope no more crash)
2026-01-24 14:23:01 +01:00
StefanX
1f03e1c4f0 fix: safe weapon kill (hope no more crash) 2026-01-24 04:02:16 +02:00
Dawid Bepierszcz
129b34f5c0 Merge pull request #472 from JonneKahvila/main
Update CounterStrikeSharp.API package version to 1.0.358
2026-01-23 16:59:14 +01:00
Erik Mende
fbf473b893 Update CounterStrikeSharp.API package version to 1.0.358 2026-01-23 16:38:15 +02:00
2 changed files with 19 additions and 5 deletions

View File

@@ -332,13 +332,27 @@ namespace WeaponPaints
if (!PlayerHasKnife(player) && hasKnife)
{
var newKnife = new CBasePlayerWeapon(player.GiveNamedItem(CsItem.Knife));
newKnife.AddEntityIOEvent("Kill", newKnife, null, "", 0.01f);
var newWeapon = new CBasePlayerWeapon(player.GiveNamedItem(CsItem.USP));
player.GiveNamedItem(CsItem.Knife);
player.ExecuteClientCommand("slot3");
newWeapon.AddEntityIOEvent("Kill", newWeapon, null, "", 0.01f);
Server.NextFrame(() =>
{
try
{
if (newKnife != null && newKnife.IsValid)
newKnife.AddEntityIOEvent("Kill", newKnife, null, "", 0.01f);
if (newWeapon != null && newWeapon.IsValid)
newWeapon.AddEntityIOEvent("Kill", newWeapon, null, "", 0.01f);
}
catch (Exception ex)
{
Logger.LogWarning("Error AddEntityIOEvent " + ex.Message);
}
});
}
foreach (var entry in weaponsWithAmmo)
{
foreach (var ammo in entry.Value)

View File

@@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.342" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.358" />
<PackageReference Include="Dapper" Version="2.1.66" />
<PackageReference Include="MySqlConnector" Version="2.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
@@ -18,11 +18,11 @@
<ItemGroup>
<None Update="lang\**\*.*" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<None Update="gamedata\*.*" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<Reference Include="MenuManagerApi">
<HintPath>3rd_party\MenuManagerApi.dll</HintPath>