SA-MP Forums Archive
MYSQL server crashes - 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 server crashes (/showthread.php?tid=124445)



MYSQL server crashes - r0v3r - 30.01.2010

Guys im trying to run a Mysql Server i have done everything as i have to but when i try to start it it crashes please i need your help
Код:
SA:MP Dedicated Server
----------------------
v0.2.2, ©2005-2007 SA:MP Team

[13:37] 
[13:37] Server Plugins
[13:37] --------------
[13:37] Loading plugin: mysql
[13:37] 

 > MySQL plugin R3 successfully loaded.

[13:37]  Loaded.
[13:37] Loading plugin: sampmysql
[13:37] 
/*************************************************/
/* SAMP-MySQL v0.15 Plugin loaded successfully ! */
/*************************************************/

[13:37]  Loaded.
[13:37] Loaded 2 plugins.

[13:37] 
[13:37] Filter Scripts
[13:37] ---------------
[13:37]  Loading filter script 'adminspec.amx'...
[13:37]  Loading filter script 'vactions.amx'...
[13:37]  Loading filter script 'Untitled.amx'...
[13:37]  Loaded 3 filter scripts.

[13:37] MYSQL: Attempting to connect to server...
[13:37] 
Connection to MySQL database: Successfull !
[13:37] MYSQL: Database connection established.
than the server crashes
I need your help please


Re: MYSQL server crashes - ray187 - 30.01.2010

What`s the next mysql related call you do in OnGameModeInit?


Re: MYSQL server crashes - r0v3r - 30.01.2010

Quote:
Originally Posted by ray187
What`s the next mysql related call you do in OnGameModeInit?
MySQLConnect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,MYSQ L_DB);


Re: MYSQL server crashes - ray187 - 30.01.2010

And after that?


Re: MYSQL server crashes - r0v3r - 30.01.2010

Код:
	MySQLConnect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,MYSQL_DB);
	LoadSQLCars();
	printf("Loading families...");
	LoadSQLFamilies();
	printf("LoadSQLFamilyGates()");
 	LoadSQLFamilyGates();
	printf("LoadSQLObjects()");
 	LoadSQLObjects();
	printf("LoadSQLBizz()");
 	LoadSQLBizz();
	printf("LoadSQLSBizz()");
 	LoadSQLSBizz();
	printf("LoadSQLProperty()");
 	LoadSQLProperty();
	printf("LoadSQLApartments()");
 	LoadSQLApartments();
 	printf("LoadSQLSpamWords()");
 	LoadSQLSpamWords();
 	printf("LoadSQLGPS()");
 	LoadSQLGPS();
  	new string[MAX_PLAYER_NAME];
	new string1[MAX_PLAYER_NAME];



Re: MYSQL server crashes - ray187 - 30.01.2010

I`d say LoadSQLCars() doesn`t work as supposed


Re: MYSQL server crashes - r0v3r - 30.01.2010

How do i fix it


Re: MYSQL server crashes - ray187 - 30.01.2010

How does your LoadSQLCars() function look like?


Re: MYSQL server crashes - r0v3r - 30.01.2010

Код:
/-[ Load cars from SQL database ]----------------------------------------------------------------------
public LoadSQLCars() {
	MySQLCheckConnection();
	new sql[64], fields[25][40], row[255];
	new Float:park_x, Float:park_y, Float:park_z, Float:park_a;
//	new owner[MAX_PLAYER_NAME];

	format(sql, sizeof(sql), "SELECT COUNT(*) FROM cars");
	samp_mysql_query(sql);
	//if (DEBUG) SQLLog(sql);
	samp_mysql_store_result();
	samp_mysql_fetch_row(row);
	totalcars = strval(row);
	for (new i=1; i<=totalcars; i++)
	{
	format(sql, sizeof(sql), "SELECT * FROM cars WHERE id=%d", i);
	samp_mysql_query(sql);
	//if (DEBUG) SQLLog(sql);
	samp_mysql_store_result();
	samp_mysql_fetch_row(row);
	split(row, fields, '|');
//	carid = strval(fields[0]);
	CarInfo[i][cModel] = strval(fields[1]);
	CarInfo[i][cLocationx] = floatstr(fields[2]);
	CarInfo[i][cLocationy] = floatstr(fields[3]);
	CarInfo[i][cLocationz] = floatstr(fields[4]);
	CarInfo[i][cAngle]   = floatstr(fields[5]);
	park_x = floatstr(fields[6]);
	park_y = floatstr(fields[7]);
	park_z = floatstr(fields[8]);
	park_a = floatstr(fields[9]);
	
	if (park_x != 0 && park_y != 0 && park_z != 0)
	  {
  	CarInfo[i][cLocationx] = park_x;
		CarInfo[i][cLocationy] = park_y;
		CarInfo[i][cLocationz] = park_z;
		CarInfo[i][cAngle] = park_a;
	  }
	
	CarInfo[i][cColorOne] = strval(fields[10]);
	CarInfo[i][cColorTwo] = strval(fields[11]);
	CarInfo[i][cOwned] = strval(fields[12]);
	memcpy(CarInfo[i][cOwner], fields[13], 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
	memcpy(CarInfo[i][cDescription], fields[17], 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
	CarInfo[i][cValue] = strval(fields[18]);
	CarInfo[i][cFamily] = strval(fields[15]);
	CarInfo[i][cFaction] = strval(fields[14]);
	CarInfo[i][cType] = strval(fields[16]);
	CarInfo[i][cRespawnable] = strval(fields[19]);
	CarInfo[i][cRespawnTime] = 0;
	CarInfo[i][cLock] = strval(fields[20]); // Locked
	CarInfo[i][cHouse] = strval(fields[22]);
	if (carsreloaded==0) AddStaticVehicleEx(CarInfo[i][cModel], CarInfo[i][cLocationx], CarInfo[i][cLocationy], CarInfo[i][cLocationz]+0.25, CarInfo[i][cAngle], CarInfo[i][cColorOne], CarInfo[i][cColorTwo], CarInfo[i][cValue]);
		else CarRespawn(i);
//	printf("Car: %d, Model: %d, Owner: %s, Type: %d, Desc: %s", i, CarInfo[i][cModel], CarInfo[i][cOwner], CarInfo[i][cType], CarInfo[i][cDescription]);
	}
	carsreloaded++;
	format(row, sizeof(row), "LoadSQLCars(): %d cars loaded", totalcars);
	printf(row);
}