25.06.2011, 16:51
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
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?
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; }
What could be wrong?