• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] y_hooks - multi level hooking problem
#1
I have the following files:



Code:
====== gamemodes/mymode.pwn?======

#include <a_samp>

#include <YSI_Coding\y_hooks>

#include .\src\first.pwn



public OnGameModeInit()

{

? ??printf("mymode.pwn");

}





======?gamemodes/src/first.pwn?======

#include <YSI_Coding\y_hooks>

#include .\src\second.pwn



hook OnGameModeInit()

{

? ? printf("first.pwn");

}







======?gamemodes/src/second.pwn?======

#include <YSI_Coding\y_hooks>



hook OnGameModeInit()

{

? ? printf("second.pwn");

}





I'm getting this error:?
Code:
.\first.pwn(6) : error 021: symbol already defined: "@yH_OnGameModeInit@002"



Is it possible to use hooks like this and if yes, what is my mistake?
  Reply
#2
You're including y_hooks three times in one file. Make sure to include it only once in a file. Remember that every file that uses the hooks needs to include y_hooks.
  Reply
#3
You can include it multiple times. Just make sure it is always the last include in a file.
  Reply


Forum Jump: