Issue about updating mysql functions
#1

Hello SA-MP Helpers, I'm having an issue, i used to update my mysql plugin so i used to update the quieres, because my old plugin is edited by AndreT so when i tried to update it, there is an issue with one function lemme take it here

The old function was

Код:
function LoadHouseData()
{
	new count;
	cache_get_rowcount(rows);
	if(!rows)
	{
  		// House doesn't exist
	}
	else
 	{
 		for(new h; h < rows; h++)
		{
	 	    // Proceed loading house data.
	 	    h_id = cache_get_row_int(h, 0);
	 		cache_get_row(h, 1, hInfo[h][HouseName]);
	 		cache_get_row(h, 2, hInfo[h][HouseOwner]);
	 		cache_get_row(h, 3, hInfo[h][HouseLocation]);
	 		cache_get_row(h, 4, hInfo[h][HousePassword]);
	 		hInfo[h][SpawnOutX] = cache_get_row_float(h, 5);
	 		hInfo[h][SpawnOutY] = cache_get_row_float(h, 6);
	 		hInfo[h][SpawnOutZ] = cache_get_row_float(h, 7);
	 		hInfo[h][SpawnOutAngle] = cache_get_row_float(h, 8);
	        hInfo[h][CPOutX] = cache_get_row_float(h, 9);
	        hInfo[h][CPOutY] = cache_get_row_float(h, 10);
	        hInfo[h][CPOutZ] = cache_get_row_float(h, 11);
			hInfo[h][HouseValue] = cache_get_row_int(h, 12);
			hInfo[h][HouseStorage] = cache_get_row_int(h, 13);
			hInfo[h][HouseInterior] = cache_get_row_int(h, 14);
			hInfo[h][HousePrivacy] = cache_get_row_int(h, 15);
			
			// Create House Pickup
   			HousePickupOut[h_id] = CreateDynamicPickup(PICKUP_MODEL_OUT, PICKUP_TYPE, hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], 0, 0, -1, 20.0);
			CreateCorrectHouseExitCP(h_id);
			new labeltext[300];
			if(!strcmp(hInfo[h_id][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE))
		 	{
		  		format(labeltext, sizeof(labeltext), LABELTEXT1, hInfo[h_id][HouseName], hInfo[h_id][HouseValue], h_id);
		  		HouseMIcon[h_id] = CreateDynamicMapIcon(hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], 31, -1, 0, 0, -1, MICON_VD);
			}
		 	else if(strcmp(hInfo[h_id][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE))
		  	{
		   		format(labeltext, sizeof(labeltext), LABELTEXT2, hInfo[h_id][HouseName], hInfo[h_id][HouseOwner], hInfo[h_id][HouseValue], Answer(hInfo[h_id][HousePrivacy], "Open", "Closed"), h_id);
				HouseMIcon[h_id] = CreateDynamicMapIcon(hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], 32, -1, 0, 0, -1, MICON_VD);
			}
			HouseLabel[h_id] = CreateDynamic3DTextLabel(labeltext, COLOR_GREEN, hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ]+0.7, TEXTLABEL_DISTANCE, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, TEXTLABEL_TESTLOS, 0, 0, -1, TEXTLABEL_DISTANCE);

			Iter_Add(Houses, h);
			count++;
		}
		// DEBUG
		printf("UoS: %d houses loaded!", count);
	}
	return 1;
}
And the updated one is:

Код:
function LoadHouseData()
{
	new count;
	cache_get_data(rows, fields);
	if(!rows)
	{
  		// House doesn't exist
	}
	else
 	{
 		for(new h; h < rows; h++)
		{
	 	    // Proceed loading house data.
	 	    h_id = cache_get_row_int(h, 0);
	 		cache_get_field_int(h, "HouseName", hInfo[h][HouseName]);
	 		cache_get_row(h, 2, hInfo[h][HouseOwner]);
	 		cache_get_row(h, 3, hInfo[h][HouseLocation]);
	 		cache_get_row(h, 4, hInfo[h][HousePassword]);
	 		hInfo[h][SpawnOutX] = cache_get_row_float(h, 5);
	 		hInfo[h][SpawnOutY] = cache_get_row_float(h, 6);
	 		hInfo[h][SpawnOutZ] = cache_get_row_float(h, 7);
	 		hInfo[h][SpawnOutAngle] = cache_get_row_float(h, 8);
	        hInfo[h][CPOutX] = cache_get_row_float(h, 9);
	        hInfo[h][CPOutY] = cache_get_row_float(h, 10);
	        hInfo[h][CPOutZ] = cache_get_row_float(h, 11);
			hInfo[h][HouseValue] = cache_get_row_int(h, 12);
			hInfo[h][HouseStorage] = cache_get_row_int(h, 13);
			hInfo[h][HouseInterior] = cache_get_row_int(h, 14);
			hInfo[h][HousePrivacy] = cache_get_row_int(h, 15);
			
			// Create House Pickup
   			HousePickupOut[h_id] = CreateDynamicPickup(PICKUP_MODEL_OUT, PICKUP_TYPE, hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], 0, 0, -1, 20.0);
			CreateCorrectHouseExitCP(h_id);
			new labeltext[300];
			if(!strcmp(hInfo[h_id][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE))
		 	{
		  		format(labeltext, sizeof(labeltext), LABELTEXT1, hInfo[h_id][HouseName], hInfo[h_id][HouseValue], h_id);
		  		HouseMIcon[h_id] = CreateDynamicMapIcon(hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], 31, -1, 0, 0, -1, MICON_VD);
			}
		 	else if(strcmp(hInfo[h_id][HouseOwner], INVALID_HOWNER_NAME, CASE_SENSETIVE))
		  	{
		   		format(labeltext, sizeof(labeltext), LABELTEXT2, hInfo[h_id][HouseName], hInfo[h_id][HouseOwner], hInfo[h_id][HouseValue], Answer(hInfo[h_id][HousePrivacy], "Open", "Closed"), h_id);
				HouseMIcon[h_id] = CreateDynamicMapIcon(hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ], 32, -1, 0, 0, -1, MICON_VD);
			}
			HouseLabel[h_id] = CreateDynamic3DTextLabel(labeltext, COLOR_GREEN, hInfo[h_id][CPOutX], hInfo[h_id][CPOutY], hInfo[h_id][CPOutZ]+0.7, TEXTLABEL_DISTANCE, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, TEXTLABEL_TESTLOS, 0, 0, -1, TEXTLABEL_DISTANCE);

			Iter_Add(Houses, h);
			count++;
		}
		// DEBUG
		printf("UoS: %d houses loaded!", count);
	}
	return 1;
}
Also I'd like to tell you that the mysql include is strange i can share to you the Old one
Код:
native mysql_ping();
native mysql_insert_id();
native mysql_real_escape_string(const source[], destination[]);
native enable_mutex(bool:enable);
native mysql_function_query(query[], bool:cache = false, const callback[] = "", const format[] = "", {Float,_}:...);
native cache_get_row(row, idx, dest[]);
native cache_get_row_int(row, idx);
native Float:cache_get_row_float(row, idx);
native cache_get_rowcount(&num_rows);
native cache_get_fieldcount(&num_fields);
Also it is compiling sucessfully
And when i see the mysql_log it doesnt show any error.
PM me if you gonna to check it VIA TeamViewer
And you can see the new one (The newest version)

I appreaciate your help and i will +REP you if you have helped me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)