Using y_hooks twice in same call back problem
#1

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");

Reply
#2

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

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

Solved.
Reply
#5

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)