Open dysphie opened 2 years ago
DHooks have this feature, to follow entity: https://sm.alliedmods.net/new-api/dhooks/DHookAddEntityListener https://sm.alliedmods.net/new-api/dhooks/DHookRemoveEntityListener
https://sm.alliedmods.net/new-api/dhooks/ListenCB
~~How about create SM plugin to do this ? I made a example. Haven't test in long usage. Hook OnEntityDestroyed Helper *edit If you need this feature to just for one plugin, try use ArrayList, store entity Reference ID and check again from SDKHooks OnEntityDestroyed. Then do your own function. Not require much code or looping.~~
DHooks have this feature, to follow entity [...]
That's basically OnEntityDestroyed
with extra steps. It doesn't allow the callback to fire for one specific entity; the plugin author still has to keep track which entities they want to act on.
I think the closest approach to what dysphie wants is using DHook to listen in on the entity's UpdateOnRemove
virtual function, which does call into the entity list's NotifyRemoveEntity
and subsequently OnEntityDeleted
, which is what SDKHooks (and in turn, DHooks) uses.
I too wish that this was implemented.
I think it would be nice to have a hook that listens for specific entity removals, I usually find myself doing this:
which is a bit wasteful and annoying to maintain. Instead, it would be nicer to be able to do something like this:
I'm not familiar with the CPP side of things so I don't know if this is technically possible though