SA-MP Forums Archive
Using y_hooks twice in same call back problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Using y_hooks twice in same call back problem (/showthread.php?tid=610054)



Using y_hooks twice in same call back problem - Luicy. - 19.06.2016

Hi, so I receive this error
error 021: symbol already defined: "@yH_GameModeInit2"
I do know what it mean, but I do not know how to fix this, Since I really need to use hook OnGameModeInit() twice.
This is the Gamemode:
PHP код:
//-----------------------------//              //--------------//
//       Bayside Roleplay      //--------------//  By Meller   //
//-----------------------------//              //--------------//
    #include <a_samp>
    #include <YSI\y_hooks>
    #include <YSI\y_ini> //dont worry about this and filemanager, switching to mysql.
    #include <FileManager>
    #include <sscanf2>
    #include <easy-mysql>
    
    #include "../BSRP/packages/database/index.pwn"
    
    #include "../BSRP/packages/dialogs.pwn"
    #include "../BSRP/packages/textdraws.pwn"
    #include "../BSRP/packages/server/functions.pwn"
    #include "../BSRP/packages/server/index.pwn"
    #include "../BSRP/packages/player/index.pwn"
    #include "../BSRP/packages/player/functions.pwn" 
and example of hooking
PHP код:
hook OnGameModeInit()
{
    
SQL::Connect("localhost""root""BSRP""dont worry about the pass");




Re: Using y_hooks twice in same call back problem - luke49 - 19.06.2016

PHP код:
#include <YSI\y_hooks> 
It should be after other includes, not before.


Re: Using y_hooks twice in same call back problem - Luicy. - 19.06.2016

Quote:
Originally Posted by luke49
Посмотреть сообщение
PHP код:
#include <YSI\y_hooks> 
It should be after other includes, not before.
This do not matter.


Re: Using y_hooks twice in same call back problem - Luicy. - 19.06.2016

Solved.


Re: Using y_hooks twice in same call back problem - Misiur - 19.06.2016

Always share your solution please. For future reference:
pawn Код:
#include <YSI\y_hooks>

hook OnGameModeInit()
{
    print("First");
    return 1;
}

#include <YSI\y_hooks>

hook OnGameModeInit()
{
    print("Second");
    return 1;
}