y_hooks explanation
#3

If you want to actually learn what hooks are and how to use them, read the replies in a topic I made earlier: https://sampforum.blast.hk/showthread.php?tid=531197

y_hooks simplifies hooking, only needing you to do this:
pawn Код:
hook function(playerid)
{
// something
}
A normal hook (ALS method 7) would look like this:

pawn Код:
public function(playerid)
{
    #if defined something_function
        return something_function(playerid);
    #else
        return true;
    #endif
}

#if defined _ALS_function
    #undef function
#else
    #define _ALS_function
#endif
#define function something_function
#if defined something_function
    forward something_function(playerid);
#endif
The only requirement is that you include y_hooks in every file you use hooks in, because y_hooks generates unique function names.

Source: http://ysi.wikia.com/wiki/Library:YSI%5Cy_hooks

It may not be up for long though as ****** left SA-MP today and binned all of his content.

EDIT: Please read what Southclaw wrote, as it covers a lot I didn't. I personally never used y_hooks so I can't give a lot of info.

Quote:
Originally Posted by Southclaw
Public functions and regular functions can be hooked and they require different methods. The two primary methods of hooking are: ALS and y_hooks (only works on publics).
Reply


Messages In This Thread
y_hooks explanation - by Denis1 - 13.04.2015, 11:25
Re: y_hooks explanation - by Azula - 13.04.2015, 11:42
Re: y_hooks explanation - by Dignity - 13.04.2015, 11:50

Forum Jump:


Users browsing this thread: 1 Guest(s)