17.02.2019, 14:17
Quote:
That's not true. The main file rarely needs y_hooks, however each include/module that uses hooks should include either y_hooks or y_unique as the last include (preferrably y_hooks so you don't have to worry about if it has been included earlier or not). The main hooking functionality only gets included the first time, all following inclusions just increase the value of UNIQUE_SYMBOL from y_unique to avoid collisions between hook names.
Also, here's a quick example why it should be included as the last file in each include/module: pawn Код:
pawn Код:
|
pawn Код:
// first.pwn
#include <YSI\y_hooks>
hook OnGameModeInit() {
return 1;
}
// second.pwn
#include "first.pwn"
hook OnGameModeInit() {
return 1;
}
pawn Код:
// gamemode.pwn
#include <a_samp>
#include <YSI\y_hooks>
#include "first.pwn"
hook OnGameModeInit() {
return 1;
}
// first.pwn
#include "first.pwn"
hook OnGameModeInit() {
return 1;
}
Both expressions, work, no need to include it each time.