Advertisement
Guest User

Untitled

a guest
May 19th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. stock LoadBuildings()
  2. {
  3. new query[128];
  4. mysql_format(mysql, query, sizeof(query), "SELECT * FROM `buildings`");
  5. mysql_tquery(mysql, query, "OnBuildingLoad");
  6. return 1;
  7. }
  8.  
  9. forward OnBuildingLoad();
  10. public OnBuildingLoad()
  11. {
  12. static row, field;
  13. cache_get_data(row, field, mysql);
  14. if(row)
  15. {
  16. for(new i = 0; i < row; i++)
  17. {
  18. new id = Iter_Free(buildings);
  19. Iter_Add(buildings, id);
  20. bInfo[id][bSQLID] = cache_get_field_content_int(i, "ID");
  21. bInfo[id][bOwnID] = cache_get_field_content_int(i, "own_id");
  22. cache_get_field_content(i, "type", bInfo[id][bType], mysql, 16);
  23. cache_get_field_content(i, "name", bInfo[id][bName], mysql, 36);
  24. bInfo[id][bType] = cache_get_field_content_int(i, "type");
  25. bInfo[id][bPosX] = cache_get_field_content_float(i, "posX");
  26. bInfo[id][bPosY] = cache_get_field_content_float(i, "posY");
  27. bInfo[id][bPosZ] = cache_get_field_content_float(i, "posZ");
  28. bInfo[id][interior] = cache_get_field_content_int(i, "interior");
  29. bInfo[id][vw] = cache_get_field_content_int(i, "vw");
  30. bInfo[id][vwint] = cache_get_field_content_int(i, "exitvw");
  31. bInfo[id][interiorID] = cache_get_field_content_int(i, "interiorid");
  32. bInfo[id][bForSale] = cache_get_field_content_int(i, "for_sale");
  33. bInfo[id][bPrice] = cache_get_field_content_int(i, "price");
  34. bInfo[id][bLocked] = cache_get_field_content_int(i, "locked");
  35. bInfo[id][faz] = cache_get_field_content_int(i, "faz");
  36. bInfo[id][bMoney] = cache_get_field_content_int(i, "money");
  37. bInfo[id][bEnterPrice] = cache_get_field_content_int(i, "enter_price");
  38. bInfo[id][bFaction] = cache_get_field_content_int(i, "faz");
  39. GetCoords2DZone(bInfo[id][bPosX], bInfo[id][bPosY], bInfo[id][bAddress], MAX_ZONE_NAME);
  40. GetInteriorCoord(id);
  41. CreateBuildingStuffs(id);
  42. }
  43. }
  44. return 1;
  45. }
  46.  
  47.  
  48.  
  49. CreateBuildingStuffs(bid)
  50. {
  51. new string[80];
  52. for(new i = 0; i < 80; i++)
  53. {
  54. string[i] = 0;
  55. }
  56. if(bInfo[bid][bForSale])
  57. {
  58. if(bInfo[bid][bType] == CASA)
  59. {
  60. format(string,sizeof(string), "Casa in vendita - %d %s\n(%d$)", bInfo[bid][bSQLID], bInfo[bid][bAddress], bInfo[bid][bPrice]);
  61. bInfo[bid][pickup] = CreateDynamicPickup(1273, 1, bInfo[bid][bPosX], bInfo[bid][bPosY], bInfo[bid][bPosZ],
  62. bInfo[bid][vw], bInfo[bid][interior], -1);
  63. }
  64. if(bInfo[bid][bType] == BIZ)
  65. {
  66. format(string,sizeof(string), "Biz in vendita - %d %s(%d$)", bInfo[bid][bSQLID], bInfo[bid][bAddress], bInfo[bid][bPrice]);
  67. bInfo[bid][pickup] = CreateDynamicPickup(1272, 1, bInfo[bid][bPosX], bInfo[bid][bPosY], bInfo[bid][bPosZ],
  68. bInfo[bid][vw], bInfo[bid][interior], -1);
  69. }
  70. if(bInfo[bid][bType] == COMPLEX)
  71. {
  72. format(string,sizeof(string), "Complex in vendita - %d %s(%d$)", bInfo[bid][bSQLID], bInfo[bid][bAddress], bInfo[bid][bPrice]);
  73. bInfo[bid][pickup] = CreateDynamicPickup(1314, 1, bInfo[bid][bPosX], bInfo[bid][bPosY], bInfo[bid][bPosZ],
  74. bInfo[bid][vw], bInfo[bid][interior], -1);
  75. }
  76. }
  77. else if(!bInfo[bid][bForSale])
  78. {
  79. if(bInfo[bid][bType] == CASA)
  80. {
  81. format(string,sizeof(string), "%d %s", bInfo[bid][bSQLID], bInfo[bid][bAddress]);
  82. bInfo[bid][CP] = CreateDynamicCP(bInfo[bid][bPosX], bInfo[bid][bPosY], bInfo[bid][bPosZ]-0.3, 2.2000,
  83. bInfo[bid][vw], bInfo[bid][interior], -1, 1.5);
  84. }
  85. if(bInfo[bid][bType] == BIZ)
  86. {
  87. format(string,sizeof(string), "%s", bInfo[bid][bName]);
  88. bInfo[bid][pickup] = CreateDynamicPickup(1272, 1, bInfo[bid][bPosX], bInfo[bid][bPosY], bInfo[bid][bPosZ],
  89. bInfo[bid][vw], bInfo[bid][interior], -1);
  90. }
  91. if(bInfo[bid][bType] == COMPLEX)
  92. {
  93. format(string,sizeof(string), "%s", bInfo[bid][bName]);
  94. bInfo[bid][pickup] = CreateDynamicPickup(1314, 1, bInfo[bid][bPosX], bInfo[bid][bPosY], bInfo[bid][bPosZ],
  95. bInfo[bid][vw], bInfo[bid][interior], -1);
  96. }
  97. }
  98. bInfo[bid][label] = CreateDynamic3DTextLabel(string, COLOR_WHITE, bInfo[bid][bPosX], bInfo[bid][bPosY], bInfo[bid][bPosZ]+0.5,
  99. 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, bInfo[bid][vw], bInfo[bid][interior], -1);
  100. return 1;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement