Server crash on samp_mysql_fetch_row - windows 7 64bit
#1

So I just dug out my old GM and tried to run it on my local server again. As I last ran it at 0.3c I had lots of errors first cause of aged includes but I updated all of them. Now my only problem is regarding SQL - Whenever there is samp_mysql_fetch_row() in the script, the server crashes. No idea why, it used to work before. I'm compiling with 0.3e compilator and I'm starting to think it might have something to do with my windows being 64bit as I've always done scripting in 32bit before..

I'm using a very old plugin for my SQL, it's from https://sampforum.blast.hk/showthread.php?tid=7106 . The SAMP-MySQL v0.15. I know it's old but upgrading to a newer plugin would require a lot of work regarding the script as the functions are a little bit different. I also don't know much about SQL, I've copied the bits of my script's SQL from other (old) scripts such as CWRP.

The problem is here for example -
Код:
public LoadSQLCars() {
	MySQLCheckConnection();
	new sql[64], fields[25][40], row[255];
	new Float:park_x, Float:park_y, Float:park_z, Float:park_a;

	format(sql, sizeof(sql), "SELECT COUNT(*) FROM cars");
	samp_mysql_query(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);
	samp_mysql_store_result();
	samp_mysql_fetch_row(row);
	split(row, fields, '|');
	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]);
	memcpy(CarInfo[i][cPlate], fields[15], 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
	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) SetVehicleNumberPlate(AddStaticVehicleEx(CarInfo[i][cModel], CarInfo[i][cLocationx], CarInfo[i][cLocationy], CarInfo[i][cLocationz]+1, CarInfo[i][cAngle], CarInfo[i][cColorOne], CarInfo[i][cColorTwo], CarInfo[i][cValue]), CarInfo[i][cPlate])
	
		else CarRespawn(i);
	new engine, lights, alarm, doors, bonnet, boot, objective;
	GetVehicleParamsEx(i, engine, lights, alarm, doors, bonnet, boot, objective);
	SetVehicleParamsEx(i, 0, 0, 0, 0, 0, 0, 0);
	SetVehicleNumberPlate(i, CarInfo[i][cPlate]);
	printf("Car: %d, Model: %d, Owner: %s, Type: %d, Desc: %s, Plate: %s", i, CarInfo[i][cModel], CarInfo[i][cOwner], CarInfo[i][cType], CarInfo[i][cDescription], CarInfo[i][cPlate]);
	}
	carsreloaded++;
	format(row, sizeof(row), "LoadSQLCars(): %d cars loaded", totalcars);
	printf(row);
	print("SQL Cars loaded!");
}
Error shows at samp_mysql_fetch_row(row);
It all used to work before but I don't know why right now only one of the functions isn't working.


Anyone able to help me out? Is there anything wrong in my script or anything outdated or is this a Windows problem?

And how hard would it be to totally upgrade my script's SQL to date, taking in concideration that I don't know much about SQL.


Kind regards,
666.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)