Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] y_hooks multiple includes

 
  • 0 Vote(s) - 0 Average
Pawn y_hooks multiple includes
iReal Worlds
Offline

iReal Worlds
Posts: 28
Threads: 5
Joined: Apr 2019
Reputation: 1
Location: Romania
#1
2019-06-07, 03:54 PM (This post was last modified: 2019-06-08, 12:59 PM by JustMichael.)
I have a problem using y_hooks:
I have the main gamemode (main.pwn), and two "modules" that are included in it: "module1.inc" and "module2.inc".

In both of them, I have to use y_hooks. From what I knew, you had to reinclude y_hooks if you wanted to hook to the same function, so at top of each module, I have
Code:
#include "..\include\YSI\y_hooks.inc"
But I get a "symbol already defined" error in "module2" for the callbacks that have already been hooked to in the first one.
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#2
2019-06-08, 12:55 AM
You're right it needs including in every file, but order is also important - it should be the last include in every file:

https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Coding/y_hooks/faqs.md#error-021-symbol-already-defined-yh_ongamemodeinit003
iReal Worlds
Offline

iReal Worlds
Posts: 28
Threads: 5
Joined: Apr 2019
Reputation: 1
Location: Romania
#3
2019-06-10, 01:14 PM
(2019-06-08, 12:55 AM)Y_Less Wrote: You're right it needs including in every file, but order is also important - it should be the last include in every file:

https://github.com/pawn-lang/YSI-Includes/blob/5.x/YSI_Coding/y_hooks/faqs.md#error-021-symbol-already-defined-yh_ongamemodeinit003
I know, but it already is. It is actually the only include in one of the files:

module1.inc:
Code:
#include "..\include\evf.inc"

#include "..\include\YSI\y_hooks.inc"

module2.inc:
Code:
#include "..\include\YSI\y_hooks.inc"
Y_Less
Offline

Administrator

Posts: 323
Threads: 16
Joined: Feb 2019
Reputation: 90
#4
2019-06-11, 06:36 PM
Ahh, don't write the `.inc` part.
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode