[Tutorial] Hooking CallBack(s) - How to Hook any callback
#1

Hooking CallBack(s) - How to Hook any callback

Hello all,
This tutorial is about hooking callback(s)-(any).

Let's start with simple example of OnFIlterScriptInit hook:
Код:
public OnFilterScriptInit()
{
	CallLocalFunction("RL@_OnFilterScriptInit", "");
	//Your code here!
}
#if defined _ALS_OnFilterScriptInit
	#undef OnFilterScriptInit
#else
	#define _ALS_OnFilterScriptInit
#endif
#define OnFilterScriptInit RL@_OnFilterScriptInit
forward RL@_OnFilterScriptInit();
First we need to call the public that we want no hook:
Код:
public OnFilterScriptInit()
{
	
}
Next we need to add this code to hook the callback:
Код:
#if defined _ALS_OnFilterScriptInit
	#undef OnFilterScriptInit
#else
	#define _ALS_OnFilterScriptInit
#endif
#define OnFilterScriptInit PRE_OnFilterScriptInit
And the last step, we need to forward the hook callbcack:
Код:
forward PRE_ OnFilterScriptInit();
Now, when OnFilterScript will called the hook public wiil called to.

Enjoy!

Reply


Messages In This Thread
Hooking CallBack(s) - How to Hook any callback - by Swimor - 18.10.2012, 19:12
Re: Hooking CallBack(s) - How to Hook any callback - by CoDeZ - 18.10.2012, 22:22
Re: Hooking CallBack(s) - How to Hook any callback - by Glint - 19.10.2012, 06:33
Re: Hooking CallBack(s) - How to Hook any callback - by RenSoprano - 19.10.2012, 06:38
Re: Hooking CallBack(s) - How to Hook any callback - by JaKe Elite - 19.10.2012, 11:08
Re: Hooking CallBack(s) - How to Hook any callback - by CoDeZ - 19.10.2012, 20:13
Re: Hooking CallBack(s) - How to Hook any callback - by Amit_B - 19.10.2012, 21:32

Forum Jump:


Users browsing this thread: 1 Guest(s)