Jump to content
Anarchiyx3

Unload/Reload Callback [Solved]

Recommended Posts

Hey guys,

I would like to extend my plugin "Be A Prison Guard". I need a callback, when LSPDFR Reload/Unload my Assembly. 

I tried to solve it with Finally(), but it didnt work.

Any ideas?

 

 

//Edit: All right, have found a solution!

Best regards,

Anarchiyx3

Edited by Anarchiyx3

Share this post


Link to post
Share on other sites

This works for me:

 

private static StaticFinalizer sf;

public override void Initialize()
{
	sf = new StaticFinalizer(delegate {
   		CleanYourScript();
    });
}

public static void CleanYourScript()
{
	//Do your stuff here
	Game.LogTrivial("Be A Prison Guard has been cleaned");
}

 

Edited by Anarchiyx3

Share this post


Link to post
Share on other sites

You might simplify the code this way:

private static StaticFinalizer sf;

public override void Initialize()
{
	sf = new StaticFinalizer(CleanYourScript);
}

public static void CleanYourScript()
{
	//Do your stuff here
	Game.LogTrivial("Be A Prison Guard has been cleaned");
}

 

Albo1125 likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×