MySQL
#1

Hey, i have much problem with that code, it' not getting good values, like for hInfo[HouseID][hInsideInt] it's get value 109 and in the database is value 2, and with hInfo[HouseID][hOwner] it's not creating the 3dtextlabel, it's getting the value "L".

I maked a new variable named interior and i changed
Код:
cache_get_value_name_int(loaded, "InsideInt", hInfo[HouseId][hInsideInt]);
with
Код:
cache_get_value_name_int(loaded, "InsideInt", interior);
Код:
forward LoadHouses();
public LoadHouses()
{
	new rows;
	cache_get_row_count(rows);

	if(rows)
	{
		new HouseID, interior, loaded;
		for(new i = 0; i < rows; i++) {
			cache_get_value_name_int(loaded, "ID", HouseID);
			cache_get_value_name_float(loaded, "EnterX", hInfo[HouseID][hEnterX]);
			cache_get_value_name_float(loaded, "EnterY", hInfo[HouseID][hEnterY]);
			cache_get_value_name_float(loaded, "EnterZ", hInfo[HouseID][hEnterZ]);
			cache_get_value_name_float(loaded, "ExitX", hInfo[HouseID][hExitX]);
			cache_get_value_name_float(loaded, "ExitX", hInfo[HouseID][hExitY]);
			cache_get_value_name_float(loaded, "ExitY", hInfo[HouseID][hExitZ]);
			cache_get_value_name_float(loaded, "ExitZ", hInfo[HouseID][hExitX]);
			cache_get_value_name_int(loaded, "InsideInt", interior);
			cache_get_value_name_int(loaded, "InsideVir", hInfo[HouseID][hInsideVir]);
			cache_get_value_name_int(loaded, "OutsideInt", hInfo[HouseID][hOutsideInt]);
			cache_get_value_name_int(loaded, "Level", hInfo[HouseID][hLevel]);
			cache_get_value_name(loaded, "Owner", hInfo[HouseID][hOwner], 48);
			cache_get_value_name_int(loaded, "Price", hInfo[HouseID][hPrice]);
			cache_get_value_name(loaded, "Name", hInfo[HouseID][hName], 48);
			cache_get_value_name_int(loaded, "Locked", hInfo[HouseID][hLocked]);
			cache_get_value_name_int(loaded, "Rentable", hInfo[HouseID][hRentable]);
			cache_get_value_name_int(loaded, "RentPrice", hInfo[HouseID][hRentPrice]);
			cache_get_value_name(loaded, "Size", hInfo[HouseID][hSize], 48);

			loaded++;

			hInfo[HouseID][hPickup] = CreateDynamicPickup(1273, 1, hInfo[HouseID][hEnterX], hInfo[HouseID][hEnterY], hInfo[HouseID][hEnterZ], 0, 0, -1, STREAMER_PICKUP_SD, -1, 0);

			new string[255];
			format(string, sizeof(string), "Owner: %s", hInfo[HouseID][hOwner]);
			print(string);

			if(!strcmp(hInfo[HouseID][hOwner], "None"))
			{
				new string[255];
				format(string, sizeof(string), ""w"House "dr"%d\n"dr"This house is for sale(/buyhouse) !\n"w"Owner: "dr"%s\n"w"Size: "dr"%s\n"w"Price: "dr"%d\n"w"Level: "dr"%d", HouseID, hInfo[HouseID][hOwner], hInfo[HouseID][hSize], hInfo[HouseID][hPrice], hInfo[HouseID][hLevel]); 
				hInfo[HouseID][hLabel] = CreateDynamic3DTextLabel(string, COLOR_WHITE, hInfo[HouseID][hEnterX], hInfo[HouseID][hEnterY], hInfo[HouseID][hEnterZ], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, 0, -1, STREAMER_3D_TEXT_LABEL_SD, -1, 0);
			}
		 }

		new string[255];
		format(string, sizeof(string), "Loaded %d houses from Database.", rows);
		print(string);
	}
	else
	{
		print("No house loaded on Database.");
		return 1;
	}
	return 1;
}
Reply


Messages In This Thread
MySQL - by C0oL3r - 08.02.2018, 11:33
Re: MySQL - by Mugala - 08.02.2018, 12:29
Re: MySQL - by Gforcez - 08.02.2018, 12:45
Re: MySQL - by Mugala - 08.02.2018, 12:55
Re: MySQL - by C0oL3r - 08.02.2018, 14:06

Forum Jump:


Users browsing this thread: 1 Guest(s)