mySQL + Loading SQL Bizz = Crash
#1

Hi,
My gamemode got players based on mySQL. It's all working ok.
I tried to add bizz on mySQL, i used CW-RP code.

Here is code of my public:
Код:
public LoadSQLBizz()
{
	printf("_Zaczynam wczytywac biznesy");
	new arrCoords[32][32];
	new sql[80];
	new row[512];
	format(sql, sizeof(sql), "SELECT COUNT(*) FROM bizz");
	samp_mysql_query(sql);
	printf("_Query: %d", sql);
	//if (DEBUG) SQLLog(sql);
	samp_mysql_store_result();
	samp_mysql_fetch_row(row);
	totalbizz = strval(row);
	samp_mysql_free_result();
	printf("_TOTALBIZZ: %d", totalbizz);
	for (new idx=0; idx<totalbizz; idx++)
	{
	  format(sql, sizeof(sql), "SELECT * FROM bizz WHERE id=%d", idx+1);
	  samp_mysql_query(sql);
		//if (DEBUG) SQLLog(sql);
	  samp_mysql_store_result();
	  if (samp_mysql_num_rows() > 0)
	  {
			samp_mysql_fetch_row(row);
			split(row, arrCoords, '|');
			samp_mysql_free_result();
			BizzInfo[idx][bOwned] = strval(arrCoords[1]);
			strmid(BizzInfo[idx][bOwner], arrCoords[2], 0, strlen(arrCoords[2]), 255);
			strmid(BizzInfo[idx][bMessage], arrCoords[3], 0, strlen(arrCoords[3]), 255);
			strmid(BizzInfo[idx][bExtortion], arrCoords[4], 0, strlen(arrCoords[4]), 255);
			BizzInfo[idx][bEntranceX] = floatstr(arrCoords[5]);
			BizzInfo[idx][bEntranceY] = floatstr(arrCoords[6]);
			BizzInfo[idx][bEntranceZ] = floatstr(arrCoords[7]);
			BizzInfo[idx][bExitX] = floatstr(arrCoords[8]);
			BizzInfo[idx][bExitY] = floatstr(arrCoords[9]);
			BizzInfo[idx][bExitZ] = floatstr(arrCoords[10]);
			BizzInfo[idx][bLevelNeeded] = strval(arrCoords[11]);
			BizzInfo[idx][bBuyPrice] = strval(arrCoords[12]);
			BizzInfo[idx][bEntranceCost] = strval(arrCoords[13]);
			BizzInfo[idx][bTill] = strval(arrCoords[14]);
			BizzInfo[idx][bLocked] = strval(arrCoords[15]);
			BizzInfo[idx][bInterior] = strval(arrCoords[16]);
			BizzInfo[idx][bProducts] = strval(arrCoords[17]);
			BizzInfo[idx][bMaxProducts] = strval(arrCoords[18]);
			BizzInfo[idx][bPriceProd] = strval(arrCoords[19]);
			strmid(BizzInfo[idx][bRank1], arrCoords[20], 0, strlen(arrCoords[20]), 255);
			strmid(BizzInfo[idx][bRank2], arrCoords[21], 0, strlen(arrCoords[21]), 255);
			strmid(BizzInfo[idx][bRank3], arrCoords[22], 0, strlen(arrCoords[22]), 255);
			strmid(BizzInfo[idx][bRank4], arrCoords[23], 0, strlen(arrCoords[23]), 255);
			strmid(BizzInfo[idx][bRank5], arrCoords[24], 0, strlen(arrCoords[24]), 255);
			strmid(BizzInfo[idx][bRank6], arrCoords[25], 0, strlen(arrCoords[25]), 255);
			BizzInfo[idx][bPay1] = strval(arrCoords[26]);
			BizzInfo[idx][bPay2] = strval(arrCoords[27]);
			BizzInfo[idx][bPay3] = strval(arrCoords[28]);
			BizzInfo[idx][bPay4] = strval(arrCoords[29]);
			BizzInfo[idx][bPay5] = strval(arrCoords[30]);
			BizzInfo[idx][bPay6] = strval(arrCoords[31]);
			printf("Bizz:%d Own:%s Msg:%s Fee:%d Till:%d Prod:%d/%d Int:%d",
			idx,
			BizzInfo[idx][bOwner],
			BizzInfo[idx][bMessage],
			BizzInfo[idx][bEntranceCost],
			BizzInfo[idx][bTill],
			BizzInfo[idx][bProducts],
			BizzInfo[idx][bMaxProducts],
			BizzInfo[idx][bInterior]);
		}
	}
	//samp_mysql_free_result();
	printf("%d Bizz loaded from database", totalbizz);
	return 1;
}
But the last thing that server do before crash is[
Код:
	printf("_Zaczynam wczytywac biznesy");
Anyone know this bug?
Thanks.
Reply
#2

Fixed, Trash it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)