[Question] Connect to MYSQL in an include
#1

I'm working on an include, but I need to connect to MYSQL in that include.
Is it possible to do that?

If yes, how to? Because OnGameModeInit will only get called by the GM itself.

Thanks
Reply
#2

Quote:
Originally Posted by Biesmen
Посмотреть сообщение
If yes, how to? Because OnGameModeInit will only get called by the GM itself.
Not true.
Reply
#3

If you wanted to do it "OnGameModeInit" - why not just hook OnGameModeInit to suit your needs? OR create a stock with no arguments, and just run that in "OnGameModeInit"

eg;
pawn Код:
//In your include
stock MySQL_Connect()
{
     //Connect to sql here
}

//In GM script
public OnGameModeInit()
{
     MySQL_Connect();
     //rest of gminit
}
Reply
#4

Just incase you want to use the ALS hooking method (this way you wont need to do anything outside of the include).

Inside the include
pawn Код:
public OnGameModeInit()
{
    // do stuff here above the funcidx function

    if (funcidx("ig_OnGameModeInit") != -1)
        return CallLocalFunction("ig_OnGameModeInit", "");
    return 1;
}

#if defined _ALS_OnGameModeInit
    #undef OnGameModeInit
#else
    #define _ALS_OnGameModeInit
#endif
#define OnGameModeInit ig_OnGameModeInit
forward ig_OnGameModeInit();
Reply
#5

After I posted this I found the hooking method, I used that.
Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)