#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
#2

no, u're using a global variable "interior" instead of a per-house variable.
Reply
#3

You have:
Код:
hInfo[HouseID][hEnterX]
Try:
Код:
hInfo[i][hEnterX]
This will make sure that you fill the hInfo array for the different rows.
Reply
#4

Quote:
Originally Posted by Gforcez1337
Посмотреть сообщение
You have:
Код:
hInfo[HouseID][hEnterX]
Try:
Код:
hInfo[i][hEnterX]
This will make sure that you fill the hInfo array for the different rows.
yeah this guy is right, I didnt see the full code.
for first, reset the Interior variables and use i instead of HouseID, by the way, why u needed HouseID? it's just nothing and only affects at house ID 0.
Reply
#5

Thx!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)