entWatch4: Drop anything thats not a knife on Death and Disconnect.

Should probably look into making it actually check weaponslots somehow...
This commit is contained in:
zaCade 2019-04-13 22:43:22 +02:00
parent 5af565c861
commit 5d63d283e4

View File

@ -417,6 +417,17 @@ public void OnClientDisconnect(int client)
if (item.bClient && item.iClient == client)
{
if (item.bWeapon)
{
char sWeaponClass[32];
GetEntityClassname(item.iWeapon, sWeaponClass, sizeof(sWeaponClass))
if (!StrEqual(sWeaponClass, "weapon_bayonet") && strncmp(sWeaponClass, "weapon_knife", 12) != 0)
{
SDKHooks_DropWeapon(item.iClient, item.iWeapon, NULL_VECTOR, NULL_VECTOR);
}
}
item.iClient = INVALID_ENT_REFERENCE;
Call_StartForward(g_hFwd_OnClientItemDisconnect);
@ -443,6 +454,17 @@ public void OnClientDeath(Event hEvent, const char[] sEvent, bool bDontBroadcast
if (item.bClient && item.iClient == client)
{
if (item.bWeapon)
{
char sWeaponClass[32];
GetEntityClassname(item.iWeapon, sWeaponClass, sizeof(sWeaponClass))
if (!StrEqual(sWeaponClass, "weapon_bayonet") && strncmp(sWeaponClass, "weapon_knife", 12) != 0)
{
SDKHooks_DropWeapon(item.iClient, item.iWeapon, NULL_VECTOR, NULL_VECTOR);
}
}
item.iClient = INVALID_ENT_REFERENCE;
Call_StartForward(g_hFwd_OnClientItemDeath);