SA-MP Forums Archive
MYSQL - HELP PLEASE - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MYSQL - HELP PLEASE (/showthread.php?tid=103543)



MYSQL - HELP PLEASE - Jofi - 20.10.2009

Hello my server stucks at MYSQL: Database connection established.
I have database.txt uploaded in MySQL Database whitout any errors.
But when i start server.exe its just loads it again, and again, and again... and Cant connect to server.

Here is server_log.txt

Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3a, ©2005-2009 SA-MP Team

[15:18:16] filterscripts = "" (string)
[15:18:16] 
[15:18:16] Server Plugins
[15:18:16] --------------
[15:18:16] Loading plugin: sampmysql
[15:18:16] 
/*************************************************/
/* SAMP-MySQL v0.15 Plugin loaded successfully ! */
/*************************************************/

[15:18:16]  Loaded.
[15:18:16] Loaded 1 plugins.

[15:18:16] 
[15:18:16] Filter Scripts
[15:18:16] ---------------
[15:18:16]  Loaded 0 filter scripts.

[15:18:16] Pickups Max = 100, Current Pickups = 120
[15:18:16] 
[15:18:16] 
[15:18:16]  Moderntopia: Los Santos
[15:18:16] _____________________________
[15:18:16] By Moderntopia Scripting Team 
[15:18:16] 
[15:18:16] MYSQL: Moderntopia MySQL Player Accounts v0.1 by Luk0r
[15:18:16] MYSQL: Attempting to connect to server...
[15:18:16] 
Connection to MySQL database: Successfull !
[15:18:17] MYSQL: Database connection established.
[15:18:29] Pickups Max = 100, Current Pickups = 120
[15:18:29] 
[15:18:29] 
[15:18:29]  Moderntopia: Los Santos
[15:18:29] _____________________________
[15:18:29] By Moderntopia Scripting Team 
[15:18:29] 
[15:18:29] MYSQL: Moderntopia MySQL Player Accounts v0.1 by Luk0r
[15:18:29] MYSQL: Attempting to connect to server...
[15:18:29] 
Connection to MySQL database: Successfull !
[15:18:30] MYSQL: Database connection established.
[15:18:33] --- Server Shutting Down.
[15:18:33]
Yes, its Moderntopia... but here is part of code

if(samp_mysql_ping()==0)
{
print("MYSQL: Database connection established.");
return 1;
}


hmm...

Код:
public MySQLConnect(sqlhost[], sqluser[], sqlpass[], sqldb[]) // by Luk0r
{
	print("MYSQL: Attempting to connect to server...");
	samp_mysql_connect(sqlhost, sqluser, sqlpass);
	samp_mysql_select_db(sqldb);
	if(samp_mysql_ping()==0)
	{
		print("MYSQL: Database connection established.");
		return 1;
	}
	else
	{
		print("MYSQL: Connection error, retrying...");
		samp_mysql_connect(sqlhost, sqluser, sqlpass);
		samp_mysql_select_db(sqldb);
		if(samp_mysql_ping()==0)
		{
			print("MYSQL: Reconnection successful. We can continue as normal.");
			return 1;
		}
		else
		{
			print("MYSQL: Could not reconnect to server, terminating server...");
			SendRconCommand("exit");
			return 0;
		}
	}
}