alliedmodders / sourcemod

SourceMod - Source Engine Scripting and Administration
http://www.sourcemod.net/
975 stars 422 forks source link

Add global forward OnPluginUnload #890

Closed R1KO closed 3 years ago

R1KO commented 5 years ago

How do you look at adding this? Maybe I can do it myself and send you a pull request

https://forums.alliedmods.net/showpost.php?p=2091765&postcount=21

Headline commented 5 years ago

Thanks for creating an issue!

Can you use OnLibraryRemoved instead? Our current dependency system is undefined in terms of load/unload order, but using libraries is much preferred.

R1KO commented 5 years ago

Can you use OnLibraryRemoved instead? Our current dependency system is undefined in terms of load/unload order, but using libraries is much preferred.

Unfortunately no. For example, I have a plugin-kernel in which I want to monitor the unloading of plugins-modules and delete the data associated with them. Modules do not register libraries (only the kernel)

KyleSanderson commented 5 years ago

I have an entire IPC system that absolutely needed this function 7 years ago... What I ended up doing was a hack in OnPluginEnd in every single plugin to let the memory management plugin know that the user was disappearing. There's another hack that you can do which is a private forward per plugin, and if GetFunctionCount returns 0 you know that user is gone.

Sorry I don't have a better answer for you.