Server crashing while connecting to mysql
#1

Hello, the server is crashing while connecting to the mysql database:

Quote:

[22:32:00] Attempting to connect to MySQL...
[22:32:00] [debug] Server crashed while executing dialog.amx
[22:32:00] [debug] AMX backtrace:
[22:32:00] [debug] #0 native fread () from samp-server.exe
[22:32:00] [debug] #1 00056c88 in public Iter_OnGameModeInit () from dialog.amx
[22:32:00] [debug] #2 native CallLocalFunction () from samp-server.exe
[22:32:00] [debug] #4 native CallLocalFunction () from samp-server.exe
[22:32:00] [debug] #5 00007218 in public zcmd_OnGameModeInit () from dialog.amx
[22:32:00] [debug] #6 native CallLocalFunction () from samp-server.exe
[22:32:00] [debug] #7 00006908 in public SSCANF_OnGameModeInit () from dialog.amx
[22:32:00] [debug] #8 00000c70 in public OnGameModeInit () from dialog.amx

OnGameModeInit code:

Код:
print("Attempting to connect to MySQL...");
    
 	new File: mConfiguration = fopen("Config/db.cfg", io_read), retrievedData[150], SQLHost[30], SQLUser[30], SQLDatabase[30], SQLPassword[50], SQLPort, bool: SQLDebug;
	fread(mConfiguration, retrievedData);
	fclose(mConfiguration);

	sscanf(retrievedData, "p<|>s[30]s[30]s[30]s[50]dd", SQLHost, SQLUser, SQLDatabase, SQLPassword, SQLPort, SQLDebug);

	if(SQLPassword[0] == 64)
	{
		SQLPassword[0] = 0;
	}

    mConnectionHandle = mysql_connect(SQLHost, SQLUser, SQLDatabase, SQLPassword);
    
	if(mysql_errno(mConnectionHandle) != 0) print("Could not connect to database!");
	else printf("Connected to database (host: %s, db: %s) as %s", SQL_HOST, SQL_DB, SQL_USER);
This is the db.cfg file:

Quote:

s216.****.com,user,dbname,dbpass,21,1

Since i forgot my last backup where the db.cfg was there, i tried to re-create it a similar one, but when attempting to connect to mysql, server is crashing.
Reply
#2

Код:
native fread () from samp-server.exe
Big, red, warnings boxes here and here. It hardly gets any more clear than that.
Reply
#3

Oh lol, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)