25.12.2014, 04:57
https://sampforum.blast.hk/showthread.php?tid=441293
The idea is simple:
An example:
The idea is simple:
pawn Код:
<function>()
{
<chained call>();
}
<does a hook exist?>
<yes - remove the old one>
<else>
<no - it does now>
<end>
<rename chain>
<forward the function>
pawn Код:
public OnPlayerConnect(playerid)
{
#if defined MyLib_OnPlayerConnect
MyLib_OnPlayerConnect(playerid);
#endif
return 1;
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect MyLib_OnPlayerConnect
#if defined MyLib_OnPlayerConnect
forward MyLib_OnPlayerConnect(playerid);
#endif