Advertisement
Lirbo

Untitled

Dec 1st, 2022 (edited)
1,107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.71 KB | None | 0 0
  1. stock ReloadHouseFurnitures(houseid)
  2. {
  3.     for(new i; i < MAX_HOUSE_FURNITURES; i++)
  4.     {
  5.         DestroyDynamicObject(HouseInfo[houseid][Furniture][i]);
  6.         HouseInfo[houseid][Furniture][i] = 0;
  7.     }
  8.     new query[186];
  9.     mysql_format(sql, query, sizeof query, "SELECT * FROM house_furnitures hf INNER JOIN house_textures ht ON hf.house_id = ht.house_id WHERE hf.house_id = %d", houseid);
  10.     mysql_tquery(sql, query, "OnLoadHouseFurnitures", "d", houseid);
  11. }
  12.  
  13. forward OnLoadHouseFurnitures(houseid);
  14. public OnLoadHouseFurnitures(houseid)
  15. {
  16.     if(!cache_get_row_count()) return 1;
  17.     new objectid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, textureid[16];//, material_index, material_model_id, material_txd[32], material_texture[32], material_color;
  18.     new query[128], Cache:result, model, txd[32], texture[32], color;
  19.     for(new i; i < cache_get_row_count(); i++)
  20.     {
  21.         objectid = cache_get_field_content_int(i, "object_id");
  22.         x = cache_get_field_content_float(i, "x");
  23.         y = cache_get_field_content_float(i, "y");
  24.         z = cache_get_field_content_float(i, "z");
  25.         rx = cache_get_field_content_float(i, "rx");
  26.         ry = cache_get_field_content_float(i, "ry");
  27.         rz = cache_get_field_content_float(i, "rz");
  28.         textureid[0] = cache_get_field_content_int(i, "texture_0");
  29.         textureid[1] = cache_get_field_content_int(i, "texture_1");
  30.         textureid[2] = cache_get_field_content_int(i, "texture_2");
  31.         textureid[3] = cache_get_field_content_int(i, "texture_3");
  32.         textureid[4] = cache_get_field_content_int(i, "texture_4");
  33.         textureid[5] = cache_get_field_content_int(i, "texture_5");
  34.         textureid[6] = cache_get_field_content_int(i, "texture_6");
  35.         textureid[7] = cache_get_field_content_int(i, "texture_7");
  36.         textureid[8] = cache_get_field_content_int(i, "texture_8");
  37.         textureid[9] = cache_get_field_content_int(i, "texture_9");
  38.         textureid[10] = cache_get_field_content_int(i, "texture_10");
  39.         textureid[11] = cache_get_field_content_int(i, "texture_11");
  40.         textureid[12] = cache_get_field_content_int(i, "texture_12");
  41.         textureid[13] = cache_get_field_content_int(i, "texture_13");
  42.         textureid[14] = cache_get_field_content_int(i, "texture_14");
  43.         textureid[15] = cache_get_field_content_int(i, "texture_15");
  44.         HouseInfo[houseid][Furniture][i] = CreateDynamicObject(objectid, x, y, z, rx, ry, rz, HouseInfo[houseid][ID], HouseInfo[houseid][Interior2]);
  45.         for(new j; j <= 15; j++)
  46.         {
  47.             if(textureid[j] > 0)
  48.             {
  49.                 model = cache_get_field_content_int(0, "model");
  50.                 cache_get_field_content(0, "txd", txd);
  51.                 cache_get_field_content(0, "texture", texture);
  52.                 color = cache_get_field_content_int(0, "color");
  53.                 SetDynamicObjectMaterial(HouseInfo[houseid][Furniture][i], j, model, txd, texture, color);
  54.             }
  55.         }
  56.     }
  57.     return 1;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement