Fixed not all grenades being stripped when infected.

This commit is contained in:
Greyscale
2009-08-27 12:56:29 -07:00
parent c2a40196eb
commit 1f09e1d0c7
2 changed files with 80 additions and 34 deletions

View File

@ -609,39 +609,8 @@ InfectHumanToZombie(client, attacker = -1, bool:motherinfect = false, bool:respa
new bool:weaponsdrop = GetConVarBool(g_hCvarsList[CVAR_INFECT_WEAPONS_DROP]);
// This must be after the event forwarding because it fixes a problem caused by changing models in ClassOnClientInfected.
// Loop through array slots and force drop.
// x = weapon slot.
for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
{
// If weapon is invalid, then stop.
if (weapons[x] == -1)
{
continue;
}
if (weaponsdrop)
{
// If this is the knife slot, then stop.
if (WeaponsSlot:x == Slot_Melee)
{
// Strip knife.
RemovePlayerItem(client, weapons[x]);
continue;
}
// Force client to drop weapon.
WeaponsForceClientDrop(client, weapons[x]);
}
else
{
// Strip weapon.
RemovePlayerItem(client, weapons[x]);
}
}
// Give zombie a new knife. (If you leave the old one there will be glitches with the knife positioning)
GivePlayerItem(client, "weapon_knife");
// Remove all weapons but knife.
WeaponsRemoveAllClientWeapons(client, weaponsdrop);
// Switch the player to terrorists.
// TODO: A solution to stop confusing bots? Respawn and teleport?
@ -1191,4 +1160,4 @@ public Action:InfectHumanCommand(client, argc)
InfectManualHuman(client, targets, result, respawn, protect);
return Plugin_Handled;
}
}