Strange error
#7

If what Vince said is true, then you need to make a reconnect function every 1440 seconds, since database connection is lost after 1440 seconds, and that would be like.

pawn Код:
#define MYSQL_HOST                          ""
#define MYSQL_USER                          ""
#define MYSQL_PASS                          ""
#define MYSQL_BASE                          ""

new db_handle;

forward MYSQL_Reconnect();
public MYSQL_Reconnect() {
    if(mysql_errno(db_handle)) {
        db_handle = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_BASE, MYSQL_PASS, 3306);
    }
    return 1;
}

public OnGameModeInit() {
    db_handle = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_BASE, MYSQL_PASS, 3306);
    SetTimer("MYSQL_Reconnect", 1440000, true);
    return 1;
}
you need to set values for database defines.

edit: on gamemode initiation, you connect to your database and start the reconnect timer. when timer reaches 1440 seconds(1440000ms), it checks connection, if it's not connected, then it reconnects, if it's connected then it does nothing.
Reply


Messages In This Thread
Strange error - by AndreiWow - 08.09.2016, 11:53
Re: Strange error - by Sithis - 08.09.2016, 12:20
Re: Strange error - by venomlivno8 - 08.09.2016, 12:57
Re: Strange error - by ThatFag - 08.09.2016, 13:02
Re: Strange error - by AndreiWow - 08.09.2016, 13:08
Re: Strange error - by Vince - 08.09.2016, 13:13
Re: Strange error - by venomlivno8 - 08.09.2016, 13:38

Forum Jump:


Users browsing this thread: 1 Guest(s)