stock LoadHouse()
{
new string[256];
for(new idx = 1; idx < MAX_HOUSE; idx++)
{
new query[500];
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM `houses` WHERE `ID`='%i' LIMIT 1", idx);
mysql_query(MySQLCon, query);
HouseInfo[idx][hStatus] = cache_get_field_content_int(0, "Status");
HouseInfo[idx][hType] = cache_get_field_content_int(0, "Type");
HouseInfo[idx][hOwner]= cache_get_field_content(0, "Owner");
HouseInfo[idx][hX] = cache_get_field_content_float(0, "X");
HouseInfo[idx][hY] = cache_get_field_content_float(0, "Y");
HouseInfo[idx][hZ] = cache_get_field_content_float(0, "Z");
HouseInfo[idx][hMoney] = cache_get_field_content_int(0, "Money");
HouseInfo[idx][hLevel] = cache_get_field_content_int(0, "Level");
HouseInfo[idx][hPrice] = cache_get_field_content_int(0, "Price");
HouseInfo[idx][hXp] = cache_get_field_content_int(0, "XP");
HouseInfo[idx][hTrashX] = cache_get_field_content_float(0, "TrashX");
HouseInfo[idx][hTrashY] = cache_get_field_content_float(0, "TrashY");
HouseInfo[idx][hTrashZ] = cache_get_field_content_float(0, "TrashZ");
HouseInfo[idx][hRemovalYear] = cache_get_field_content_int(0, "RemovalYear");
HouseInfo[idx][hRemovalDay] = cache_get_field_content_int(0, "RemovalDay");
HouseInfo[idx][hLockStatus] = cache_get_field_content_int(0, "LockStatus");
////////////////////////////////
if(HouseInfo[idx][hStatus] == 1)
{
format(string, sizeof(string), "FOR SALE\n$%d", HouseInfo[idx][hPrice]);
HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
}
if(HouseInfo[idx][hStatus] == 2)
{
format(string, sizeof(string), "House of %s", HouseInfo[idx][hOwner]);
HouseInfo[idx][hPickup] = CreateDynamicPickup(1272, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
}
print("House Loaded");
}
print("Houses loaded successfully.");
return 1;
}
|
Im making a loading system for my houses and when the server loads the houses it only loads the first one in the mysql and then stops.. here is the code
Код:
stock LoadHouse()
{
new string[256];
for(new idx = 1; idx < MAX_HOUSE; idx++)
{
new query[500];
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM `houses` WHERE `ID`='%i' LIMIT 1", idx);
mysql_query(MySQLCon, query);
HouseInfo[idx][hStatus] = cache_get_field_content_int(0, "Status");
HouseInfo[idx][hType] = cache_get_field_content_int(0, "Type");
HouseInfo[idx][hOwner]= cache_get_field_content(0, "Owner");
HouseInfo[idx][hX] = cache_get_field_content_float(0, "X");
HouseInfo[idx][hY] = cache_get_field_content_float(0, "Y");
HouseInfo[idx][hZ] = cache_get_field_content_float(0, "Z");
HouseInfo[idx][hMoney] = cache_get_field_content_int(0, "Money");
HouseInfo[idx][hLevel] = cache_get_field_content_int(0, "Level");
HouseInfo[idx][hPrice] = cache_get_field_content_int(0, "Price");
HouseInfo[idx][hXp] = cache_get_field_content_int(0, "XP");
HouseInfo[idx][hTrashX] = cache_get_field_content_float(0, "TrashX");
HouseInfo[idx][hTrashY] = cache_get_field_content_float(0, "TrashY");
HouseInfo[idx][hTrashZ] = cache_get_field_content_float(0, "TrashZ");
HouseInfo[idx][hRemovalYear] = cache_get_field_content_int(0, "RemovalYear");
HouseInfo[idx][hRemovalDay] = cache_get_field_content_int(0, "RemovalDay");
HouseInfo[idx][hLockStatus] = cache_get_field_content_int(0, "LockStatus");
////////////////////////////////
if(HouseInfo[idx][hStatus] == 1)
{
format(string, sizeof(string), "FOR SALE\n$%d", HouseInfo[idx][hPrice]);
HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
}
if(HouseInfo[idx][hStatus] == 2)
{
format(string, sizeof(string), "House of %s", HouseInfo[idx][hOwner]);
HouseInfo[idx][hPickup] = CreateDynamicPickup(1272, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
}
print("House Loaded");
}
print("Houses loaded successfully.");
return 1;
}
|
|
this load scriptlet also doesn't work when i use while indstead of for
|