Код:
public LoadDynamicHouses()
{
new rows, fields;
new total = 0, weapons[256];
cache_get_data(rows, fields);
if(rows)
{
while(total < rows)
{
HouseInfo[total][hID] = cache_get_row_int(total, 0);
HouseInfo[total][hEntranceX] = cache_get_row_float(total, 1);
HouseInfo[total][hEntranceY] = cache_get_row_float(total, 2);
HouseInfo[total][hEntranceZ] = cache_get_row_float(total, 3);
HouseInfo[total][hExitX] = cache_get_row_float(total, 4);
HouseInfo[total][hExitY] = cache_get_row_float(total, 5);
HouseInfo[total][hExitZ] = cache_get_row_float(total, 6);
cache_get_row(total, 7, HouseInfo[total][hInfo], dbHandle, 128);
cache_get_row(total, 8, HouseInfo[total][hOwner], dbHandle, 128);
HouseInfo[total][hOwned] = cache_get_row_int(total, 9);
HouseInfo[total][hLocked] = cache_get_row_int(total, 10);
HouseInfo[total][hPrice] = cache_get_row_int(total, 11);
HouseInfo[total][hLevelbuy] = cache_get_row_int(total, 12);
HouseInfo[total][hRentprice] = cache_get_row_int(total, 13);
HouseInfo[total][hRentable] = cache_get_row_int(total, 14);
HouseInfo[total][hInterior] = cache_get_row_int(total, 15);
HouseInfo[total][hWorld] = cache_get_row_int(total, 16);
HouseInfo[total][hCash] = cache_get_row_int(total, 17);
HouseInfo[total][hFurnitures] = cache_get_row_int(total, 18);
cache_get_row(total, 19, weapons, dbHandle, 128);
HouseInfo[total][hCheckPosX] = cache_get_row_float(total, 20);
HouseInfo[total][hCheckPosY] = cache_get_row_float(total, 21);
HouseInfo[total][hCheckPosZ] = cache_get_row_float(total, 22);
HouseInfo[total][hRadio] = cache_get_row_int(total, 23);
HouseInfo[total][hHouseOn] = 1;
AssignHouseWeapons(total, weapons);
if(HouseInfo[total][hOwned] == 0)
format(msg, sizeof(msg), ""EMBED_YELLOW"["EMBED_WHITE"House ID %d"EMBED_YELLOW"]\n"EMBED_WHITE"%s\n"EMBED_GREEN"Price: $%d - "EMBED_WHITE"Level: %d", total, HouseInfo[total][hInfo], HouseInfo[total][hPrice], HouseInfo[total][hLevelbuy]);
else
format(msg, sizeof(msg), ""EMBED_YELLOW"["EMBED_WHITE"House ID %d"EMBED_YELLOW"]\n"EMBED_WHITE"%s", total, HouseInfo[total][hInfo]);
HouseInfo[total][hLabel] = CreateDynamic3DTextLabel(msg, -1, HouseInfo[total][hEntranceX], HouseInfo[total][hEntranceY], HouseInfo[total][hEntranceZ], 3.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1);
HouseInfo[total][hCheckPoint] = CreateDynamicCP(HouseInfo[total][hEntranceX], HouseInfo[total][hEntranceY], HouseInfo[total][hEntranceZ], 1.0, -1, -1, -1);
if(HouseInfo[total][hFurnitures] > 0)
{
LoadHouseFurnitures(total);
}
total++;
}
}
format(msg,sizeof(msg), "Loaded %d dynamic houses from MySQL.", total);
printf(msg);
return 1;
}