I have a code, I need the OnEntityKill hook not to fire by default, but only on call
private void OnEntityKill(BaseNetworkable entity, BasePlayer player)
{
var baseEnt = entity as BaseEntity;
if (baseEnt == null) return;
if (oreCashe.Contains(baseEnt))
{
oreCashe.Remove(baseEnt);
IQChat.CallHook("ReplySystem", player, "Твоя руда была разбита");
Puts("Руда");
}
}
I need OnMeleeAttack to be passed to the BasePlayer hook and triggered by the condition -
object OnMeleeAttack (BasePlayer player, HitInfo info)
{
BaseEntity ent = info?.HitEntity;
if(ent.IsDestroyed)
{
OnEntityKill(ent,player);
}