Crash on loading houses
#1

So, I'm using a mysql housing system, but I am not able to get it work correctly.

The houses are getting loaded with this function

Код:
LoadHouses()
{
	new query[1024];
	print("House loading started...(before fromat)");
	format(query,sizeof(query),"SELECT * FROM `houses`");
	print("House loading started...(before query)");
	mysql_query(query);
	print("House loading started...(store res)");
	mysql_store_result();
	new i;
	new rows = mysql_num_rows();
	if(rows)
	{
	    print("House loading started...(if(rows))");
		while(i < rows,i++)
		{
	    	print("in for new");
			new string[512];
			format(string, sizeof(string), "SELECT * FROM `houses` WHERE ID = '%d'", i);
			mysql_query(string);
			mysql_store_result();
		
			sscanf(string,"ds[24]dffffffddddd", \
			HD[i][ID], \
			HD[i][owner], \
 			HD[i][price], \
			HD[i][exteriorX], \
			HD[i][exteriorY], \
			HD[i][exteriorZ], \
			HD[i][interiorX], \
			HD[i][interiorY], \
			HD[i][interiorZ], \
			HD[i][interiorInt], \
			HD[i][locked], \
			HD[i][gunslot1], \
			HD[i][locklevel], \
			HD[i][safeamount]);

			if(strlen(HD[i][owner]) > 0) CreatePickup(1273, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
			else CreatePickup(1272, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
			printf("House %d created at x: %f, y: %f, z: %f, locklevel: %d", i, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], HD[i][locklevel]);
		}
	}
	else
	{
	    print("No houses to load!");
	}
	print("House loading finished.");
	mysql_free_result();
	return 1;
}
If checked the code you can see I've added print lines for debugging. The problem is when I run the server it crashers before mysql_query(query) is called.

What could be wrong?
Reply


Messages In This Thread
Crash on loading houses - by Willow - 25.06.2011, 16:51
Re: Crash on loading houses - by Donya - 25.06.2011, 17:09
Re: Crash on loading houses - by Willow - 25.06.2011, 17:13
Re: Crash on loading houses - by GangsTa_ - 25.06.2011, 17:16
Re: Crash on loading houses - by Willow - 25.06.2011, 17:26
Re: Crash on loading houses - by Donya - 25.06.2011, 17:32
Re: Crash on loading houses - by Willow - 25.06.2011, 17:46
Re: Crash on loading houses - by Markx - 25.06.2011, 17:47
Re: Crash on loading houses - by Willow - 25.06.2011, 17:50
Re: Crash on loading houses - by Donya - 25.06.2011, 17:51

Forum Jump:


Users browsing this thread: 1 Guest(s)