View Single Post
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-27-2014 , 02:09   Re: Detect when a plugin unload
Reply With Quote #17

Doesn't make sense what you are trying to accomplish.
You could just do away with the other plugin deps, and findstringinarray to make sure there are no duplicates.
If you are worried about models not being available on mapchange or something, you could try to preserve the model by passing a bool (download) and then a handle you clone of files to add to download table, and associate it to that model.

Else you could do things like use the caller's handle as an id/owner for the model, and on plugin unload, you call the native to clear that id/handle.. And it will rove those models from your array. Then you do not have to use libraries in your main plugin.

If you want to use libraries, you could just pass the caller's library name in your native. Store this in a dynamic array in the core plugin, and onlibraryremoved, search through your models and use the dynamic array to see if that library belongs to said model. Then remove the library name from your dynamic array.
This is probably the best choice..
In the child plugin, you reg the library, and when you call your native, just pass that library name, very easy to implement.
Onlibraryremoved isnt bad to use if you findstringinarray the libraries, though if you have a lot of models in the main array, it could take a while to parse them, but what can you do.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 01-27-2014 at 02:12.
friagram is offline