Skip to content

Commit 91655f9

Browse files
authored
1.0.5
1 parent f2aa440 commit 91655f9

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

Config/Helper.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Runtime.InteropServices;
12
using CounterStrikeSharp.API.Core;
23
using CounterStrikeSharp.API.Modules.Admin;
34
using CounterStrikeSharp.API;
@@ -84,7 +85,26 @@ public static void ClearGroundWeapons()
8485
}
8586
}
8687

87-
public static void DropAllWeaponsAndDelete(CCSPlayerController player)
88+
public static void DropAllWeaponsAndDeleteLunix(CCSPlayerController player)
89+
{
90+
if(player == null || !player.IsValid)return;
91+
if(player.PlayerPawn == null || !player.PlayerPawn.IsValid)return;
92+
if(!player.PawnIsAlive)return;
93+
if(player.PlayerPawn.Value == null || !player.PlayerPawn.Value.IsValid)return;
94+
if(player.PlayerPawn.Value.WeaponServices == null || player.PlayerPawn.Value.WeaponServices.MyWeapons == null)return;
95+
96+
foreach (var weapon in player.PlayerPawn.Value.WeaponServices.MyWeapons)
97+
{
98+
if (weapon == null || !weapon.IsValid) continue;
99+
var weaponValue = weapon.Value;
100+
if (weaponValue == null || !weaponValue.IsValid) continue;
101+
if (weaponValue.DesignerName != null && weaponValue.DesignerName.Contains("weapon_knife") || weaponValue.DesignerName != null && weaponValue.DesignerName.Contains("weapon_c4"))continue;
102+
if(weaponValue.DesignerName == null)continue;
103+
player.ExecuteClientCommand("slot3");
104+
Utilities.RemoveItemByDesignerName(player, weaponValue.DesignerName);
105+
}
106+
}
107+
public static void DropAllWeaponsAndDeleteWin(CCSPlayerController player)
88108
{
89109
if(player == null || !player.IsValid)return;
90110
if(player.PlayerPawn == null || !player.PlayerPawn.IsValid)return;
@@ -179,4 +199,8 @@ public static void CreateDefaultWeaponsJson()
179199
File.WriteAllText(configcfg, jsonContent);
180200
}
181201
}
202+
public static bool IsWindows()
203+
{
204+
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
205+
}
182206
}

CounterStrikeSharp.API.dll

512 Bytes
Binary file not shown.

Spawn-Loadout-GoldKingZ.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
using CounterStrikeSharp.API.Modules.Timers;
66
using Spawn_Loadout_GoldKingZ.Config;
77
using Newtonsoft.Json.Linq;
8-
using System.Net;
9-
using CounterStrikeSharp.API.Modules.Entities;
108

119
namespace Spawn_Loadout_GoldKingZ;
1210

1311
public class SpawnLoadoutGoldKingZ : BasePlugin
1412
{
1513
public override string ModuleName => "Give Weapons On Spawn (Depend The Map Name + Team Side)";
16-
public override string ModuleVersion => "1.0.4";
14+
public override string ModuleVersion => "1.0.5";
1715
public override string ModuleAuthor => "Gold KingZ";
1816
public override string ModuleDescription => "https://github.com/oqyh";
1917

@@ -29,6 +27,7 @@ public override void Load(bool hotReload)
2927
RegisterListener<Listeners.OnMapEnd>(OnMapEnd);
3028
RegisterEventHandler<EventRoundStart>(OnEventRoundStart);
3129
}
30+
3231
public HookResult OnEventGrenadeThrown(EventGrenadeThrown @event, GameEventInfo info)
3332
{
3433
if (@event == null) return HookResult.Continue;
@@ -213,7 +212,14 @@ private HookResult OnEventPlayerSpawn(EventPlayerSpawn @event, GameEventInfo inf
213212
{
214213
AddTimer(0.1f, () =>
215214
{
216-
Helper.DropAllWeaponsAndDelete(player);
215+
if(Helper.IsWindows())
216+
{
217+
Helper.DropAllWeaponsAndDeleteWin(player);
218+
}else
219+
{
220+
Helper.DropAllWeaponsAndDeleteLunix(player);
221+
}
222+
217223
});
218224
}
219225

0 commit comments

Comments
 (0)