08.09.2016, 13:38
(
Последний раз редактировалось venomlivno8; 08.09.2016 в 13:40.
Причина: explanation
)
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.
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.
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;
}
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.