Raised This Month: $ Target: $400
 0% 

Database.Connect callback is not invoked until i unload plugin?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
gromit190
Junior Member
Join Date: Jun 2019
Old 11-24-2022 , 15:00   Database.Connect callback is not invoked until i unload plugin?
Reply With Quote #1

Hello,

I am following the example from the docs:

Code:
Database hDatabase = null;
 
void StartSQL()
{
    Database.Connect(GotDatabase);
}
 
public void GotDatabase(Database db, const char[] error, any data)
{
    PrintToServer("Got database2"); // <--- this won't actually happen until I do: sm plugins unload myplugin
    if (db == null)
    {
        LogError("Database failure: %s", error);
    } 
    else 
    {
        hDatabase = db;
    }
}
But, for some odd reason, the "GotDatabase" is not invoked unless I unload the plugin.

In the GotDatabase function I am calling "PrintToServer", and also I am inserting a row to the db. I monitor both the server console, and the table in the db and nothing happens UNLESS I unload the plugin.

What am I doing wrong?

Last edited by gromit190; 11-24-2022 at 15:00.
gromit190 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode