Struggling to update code to support MYSQL R40+
#1

Hmm, im really trying to understand this mysql business, todays project is my safe system,

this is what i've changed the load code to

Код:
public onloadSafes() {
	new
	    iRows,
	    iFields,
	    szResult[64];
	   
	cache_get_data(iRows, iFields, MainPipeline);
	
	if(!iRows)
	    return printf("[LoadSafes] Failed to load any Safes.");
	    
	for(new iRow; iRow < iRows; iRow++) {
		cache_get_value_name_int(iRow, "safeDBID", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iDBID] = strval(szResult);
		cache_get_value_name_int(iRow, "safeType", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iType] = strval(szResult);
		cache_get_value_name_int(iRow, "safeTypeID", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iTypeID] = strval(szResult);
		cache_get_field_name_int(iRow, "safeVW", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iVW] = strval(szResult);
		cache_get_field_name_int(iRow, "safeInt", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iVW] = strval(szResult);
		cache_get_field_name_int(iRow, "safeModel", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iModelID] = strval(szResult);
		cache_get_field_name_float(iRow, "safePosX", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][0] = floatstr(szResult);
		cache_get_field_name_float(iRow, "safePosY", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][1] = floatstr(szResult);
		cache_get_field_name_float(iRow, "safePosZ", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][2] = floatstr(szResult);
		cache_get_field_name_float(iRow, "safeRotX", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][3] = floatstr(szResult);
		cache_get_field_name_float(iRow, "safeRotY", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][4] = floatstr(szResult);
		cache_get_field_name_float(iRow, "safeRotZ", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][5] = floatstr(szResult);
		cache_get_field_name_int(iRow, "safeMoney", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iMoney] = strval(szResult);
		cache_get_field_name_int(iRow, "safePin", SafeData[iRow][g_iPin], MainPipeline, 5);
		cache_get_field_name_int(iRow, "safeRobbed", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iRobbed] = strval(szResult);
		cache_get_field_name_int(iRow, "safeRobbedTime", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_tRobbedTime] = strval(szResult);
		processSafe(iRow);
	}
	return printf("[MySQL] Loaded %i Safes from database.", iRows);
}
And im getting ALOT of errors so obviously i don't quite understand what im doing

this is what the code used to be
Код:
forward onloadSafes();
public onloadSafes() {
	new
	    iRows,
	    iFields,
	    szResult[64];
	   
	cache_get_data(iRows, iFields, MainPipeline);
	
	if(!iRows)
	    return printf("[LoadSafes] Failed to load any Safes.");
	    
	for(new iRow; iRow < iRows; iRow++) {
		cache_get_field_content(iRow, "safeDBID", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iDBID] = strval(szResult);
		cache_get_field_content(iRow, "safeType", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iType] = strval(szResult);
		cache_get_field_content(iRow, "safeTypeID", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iTypeID] = strval(szResult);
		cache_get_field_content(iRow, "safeVW", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iVW] = strval(szResult);
		cache_get_field_content(iRow, "safeInt", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iVW] = strval(szResult);
		cache_get_field_content(iRow, "safeModel", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iModelID] = strval(szResult);
		cache_get_field_content(iRow, "safePosX", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][0] = floatstr(szResult);
		cache_get_field_content(iRow, "safePosY", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][1] = floatstr(szResult);
		cache_get_field_content(iRow, "safePosZ", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][2] = floatstr(szResult);
		cache_get_field_content(iRow, "safeRotX", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][3] = floatstr(szResult);
		cache_get_field_content(iRow, "safeRotY", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][4] = floatstr(szResult);
		cache_get_field_content(iRow, "safeRotZ", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][5] = floatstr(szResult);
		cache_get_field_content(iRow, "safeMoney", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iMoney] = strval(szResult);
		cache_get_field_content(iRow, "safePin", SafeData[iRow][g_iPin], MainPipeline, 5);
		cache_get_field_content(iRow, "safeRobbed", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iRobbed] = strval(szResult);
		cache_get_field_content(iRow, "safeRobbedTime", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_tRobbedTime] = strval(szResult);
		processSafe(iRow);
	}
	return printf("[MySQL] Loaded %i Safes from database.", iRows);
}
What have i done wrong? and is someone able to show me what i need todo to fix it
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)