SDKUnhook apparently causes lag and RemoveEdict is evil

This commit is contained in:
BotoX 2016-12-19 09:29:54 +01:00
parent 5cd37b4e7d
commit 86c2d688a6

View File

@ -24,7 +24,7 @@ public Plugin myinfo =
name = "WeaponCleaner", name = "WeaponCleaner",
author = "BotoX", author = "BotoX",
description = "Clean unneeded weapons", description = "Clean unneeded weapons",
version = "2.2", version = "2.2.1",
url = "" url = ""
}; };
@ -134,7 +134,7 @@ public void OnEntityDestroyed(int entity)
public void OnWeaponSpawned(int entity) public void OnWeaponSpawned(int entity)
{ {
SDKUnhook(entity, SDKHook_Spawn, OnWeaponSpawned); //SDKUnhook(entity, SDKHook_Spawn, OnWeaponSpawned);
int HammerID = GetEntProp(entity, Prop_Data, "m_iHammerID"); int HammerID = GetEntProp(entity, Prop_Data, "m_iHammerID");
// Should not be cleaned since it's a map spawned weapon // Should not be cleaned since it's a map spawned weapon
@ -259,14 +259,9 @@ bool KillWeapon(int entref)
if(!IsValidEntity(entref)) if(!IsValidEntity(entref))
return RemoveWeapon(entref); return RemoveWeapon(entref);
// This implicitly calls OnEntityDestroyed() on success which calls RemoveWeapon()
AcceptEntityInput(entref, "Kill"); AcceptEntityInput(entref, "Kill");
// Not successful? return RemoveWeapon(entref);
if(IsValidEntity(entref))
return RemoveWeapon(entref);
return true;
} }
public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast) public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast)