SA-MP Forums Archive
y_hooks - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: y_hooks (/showthread.php?tid=611449)



y_hooks - Marricio - 06.07.2016

I have a problem hooking custom functions, native callbacks hook perfectly without problems. I have the latest YSI version and I can't figure out why I can't hook functions.

This is the code:
pawn Код:
#include        YSI_Coding\y_hooks
 
public OnFilterScriptInit()
{
    Function();
    print("\n--Base FS loaded.\n");
    return 1;
}
 
forward Function();
public Function()
{
    print("public");
}
 
hook Function()
{
    print("Hook");
}
 
// Prints just "public"
This is kind of urgent, since I can't find another way to hook functions in my modular gamemode. Thanks


Re: y_hooks - Misiur - 06.07.2016

You have to call the function via CallLocalFunction:
pawn Код:
//No more direct
Function();
//Now
CallLocalFunction("Function", "");
//Or if you are including y_als
call Function();