Advertisement
Guest User

LOAD Function

a guest
Aug 3rd, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. forward LoadDynamicHouses();
  2. public LoadDynamicHouses()
  3. {
  4. new rows = cache_num_rows(),
  5. time = GetTickCount(),
  6. total,
  7. query[128];
  8.  
  9. if(!rows)
  10. {
  11. print("[Houses] Houses Loaded».");
  12. return 1;
  13. }
  14.  
  15. for(new i; i < rows; i++)
  16. {
  17. cache_get_value_name_int(i, "id", HouseInfo[i][hID]);
  18. cache_get_value_name_float(i, "posx", HouseInfo[i][hPosX]);
  19. cache_get_value_name_float(i, "posy", HouseInfo[i][hPosY]);
  20. cache_get_value_name_float(i, "posz", HouseInfo[i][hPosZ]);
  21. cache_get_value_name_float(i, "exitx", HouseInfo[i][hExitX]);
  22. cache_get_value_name_float(i, "exity", HouseInfo[i][hExitY]);
  23. cache_get_value_name_float(i, "exitz", HouseInfo[i][hExitZ]);
  24. cache_get_value_name(i, "ownername", HouseInfo[i][hOwner]);
  25. strreplace(HouseInfo[i][hOwner], "_", " ");
  26. cache_get_value_name_int(i, "owner", HouseInfo[i][hOwnerID]);
  27. cache_get_value_name_int(i, "locked", HouseInfo[i][hLocked]);
  28. cache_get_value_name_int(i, "price", HouseInfo[i][hPrice]);
  29. cache_get_value_name_int(i, "levelbuy", HouseInfo[i][hLevelbuy]);
  30. cache_get_value_name_int(i, "cash", HouseInfo[i][hCash]);
  31. cache_get_value_name_int(i, "exitint", HouseInfo[i][hExitInt]);
  32. cache_get_value_name_int(i, "exitvw", HouseInfo[i][hExitVW] );
  33. cache_get_value_name_int(i, "posint", HouseInfo[i][hPosInt] );
  34. cache_get_value_name_int(i, "posvw", HouseInfo[i][hPosVW]);
  35. cache_get_value_name_float(i, "checkx", HouseInfo[i][hCheckPosX]);
  36. cache_get_value_name_float(i, "checky", HouseInfo[i][hCheckPosY]);
  37. cache_get_value_name_float(i, "checkz", HouseInfo[i][hCheckPosZ]);
  38. cache_get_value_name_int(i, "radio", HouseInfo[i][hRadio] );
  39. cache_get_value_name_int(i, "lock", HouseInfo[i][hLock]);
  40. cache_get_value_name_int(i, "alarm", HouseInfo[i][hAlarm]);
  41. cache_get_value_name_int(i, "door", HouseInfo[i][hDoor]);
  42. cache_get_value_name_int(i, "ddoor", HouseInfo[i][hDDoor]);
  43. cache_get_value_name_int(i, "class", HouseInfo[i][hClass]);
  44. cache_get_value_name_int(i, "heal", HouseInfo[i][hHeal]);
  45. cache_get_value_name_int(i, "heal_amount", HouseInfo[i][hHealAmount]);
  46. cache_get_value_name_int(i, "cupboard", HouseInfo[i][hCupboard]);
  47. cache_get_value_name_float(i, "furniture_radius", HouseInfo[i][hFurnitureRadius]);
  48. HouseInfo[i][hFurniture] = 0;
  49. HouseInfo[i][hOutsideFurniture] = 0;
  50. new str_inv[10];
  51.  
  52. for(new a = 0; a < MAX_HOUSE_INVENTORY; a++)
  53. {
  54. format(str_inv, sizeof(str_inv), "inv_%i", a+1);
  55. cache_get_value_name_int(i, str_inv, HouseInfo[i][hInv][a]);
  56. format(str_inv, sizeof(str_inv), "amount_%i", a+1);
  57. cache_get_value_name_int(i, str_inv, HouseInfo[i][hInvAmount][a]);
  58. }
  59.  
  60. UpdateHouseText(i);
  61. UpdateHouseDoor(i);
  62.  
  63. HouseInfo[i][hCheckPoint] =
  64. CreateDynamicCP(HouseInfo[i][hPosX], HouseInfo[i][hPosY], HouseInfo[i][hPosZ], 1.0, HouseInfo[i][hPosVW], HouseInfo[i][hPosInt], -1, 2.0);
  65.  
  66. //format(query, sizeof(query), "SELECT * FROM `furnitures` WHERE `houseid`='%i'", HouseInfo[i][hID]);
  67. //mysql_tquery(dbCon, query, "OnFurnituresLoad", "i", i);
  68.  
  69.  
  70. total++;
  71. }
  72. printf("[Houses] Case - %i. printif - %i. timp: %i ms.", rows, total, GetTickCount()-time);
  73. return 1;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement