1+ using System . Runtime . InteropServices ;
12using CounterStrikeSharp . API . Core ;
23using CounterStrikeSharp . API . Modules . Admin ;
34using 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}
0 commit comments