From 723471ff6f649cde92a5a432d7ee3b0448af152e Mon Sep 17 00:00:00 2001 From: zaCade Date: Sun, 28 Jul 2019 11:59:57 +0200 Subject: [PATCH] Spectate: Only strip knifes After further testing, other weapons seem to be dropped. --- Spectate/scripting/Spectate.sp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Spectate/scripting/Spectate.sp b/Spectate/scripting/Spectate.sp index 6c514628..0ef13238 100644 --- a/Spectate/scripting/Spectate.sp +++ b/Spectate/scripting/Spectate.sp @@ -107,7 +107,7 @@ public Action Command_Spectate(int client, int argc) Call_PushCell(client); Call_Finish(); - StripPlayerWeapons(client); + StripPlayerKnifes(client); ForcePlayerSuicide(client); ChangeClientTeam(client, CS_TEAM_SPECTATOR); } @@ -137,7 +137,7 @@ public Action Command_Spectate(int client, int argc) Call_PushCell(client); Call_Finish(); - StripPlayerWeapons(client); + StripPlayerKnifes(client); ForcePlayerSuicide(client); ChangeClientTeam(client, CS_TEAM_SPECTATOR); } @@ -206,19 +206,16 @@ stock int GetTeamAliveClientCount(int iTeam) return ret; } -stock void StripPlayerWeapons(int client) +stock void StripPlayerKnifes(int client) { - for(int i = 0; i < 5; i++) - { - int w = -1; + int w = -1; - while ((w = GetPlayerWeaponSlot(client, i)) != -1) + while ((w = GetPlayerWeaponSlot(client, CS_SLOT_KNIFE)) != -1) + { + if(IsValidEntity(w) && IsValidEdict(w)) { - if(IsValidEntity(w) && IsValidEdict(w)) - { - RemovePlayerItem(client, w); - AcceptEntityInput(w, "Kill"); - } + RemovePlayerItem(client, w); + AcceptEntityInput(w, "Kill"); } } } \ No newline at end of file