Advertisement
Guest User

[last-times.ro] house system

a guest
Jan 28th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. #include <YSI/y_hooks>
  2. #include <YSY/y_timers>
  3. #include <YSI/y_commands>
  4.  
  5. #define MAX_HOUSES (100)
  6.  
  7. enum hInfo {
  8. hID,
  9. hOwner,
  10. hType, // 0 - small, 1 - medium, 2 - big
  11. Float:hExteriorX,
  12. Float:hExteriorY,
  13. Float:hExteriorZ,
  14. Float:hInteriorX,
  15. Float:hInteriorY,
  16. Float:hInteriorZ,
  17. hInterior,
  18. hRentPrice,
  19. hPrice,
  20. hLock,
  21. hUpgrades[1], // 0 - house /eat
  22.  
  23. Text3D:hLabel,
  24. hPickup
  25. }
  26.  
  27. new houseVariables[MAX_HOUSES][hInfo],
  28. Iterator:server_houses<MAX_HOUSES>;
  29.  
  30. hook OnGameModeInit() {
  31. iniHouses();
  32. }
  33.  
  34. function iniHouses() {
  35. new Cache:houses = mysql_query(SQL, "SELECT * FROM `server_houses`"), x;
  36. for(new i; i < cache_get_row_count(); i++;) {
  37. x = cache_get_field_content_int(i, "houseID");
  38. houseVariables[x][hOwner] = cache_get_field_content_int(i, "houseOwner");
  39. houseVariables[x][hType] = cache_get_field_content_int(i, "houseType");
  40. houseVariables[x][hExteriorX] = cache_get_field_content_float(i, "houseExteriorX");
  41. houseVariables[x][hExteriorY] = cache_get_field_content_float(i, "houseExteriorY");
  42. houseVariables[x][hExteriorZ] = cache_get_field_content_float(i, "houseExteriorZ");
  43.  
  44. houseVariables[x][hInteriorX] = cache_get_field_content_float(i, "houseInteriorX");
  45. houseVariables[x][hInteriorY] = cache_get_field_content_float(i, "houseInteriorY");
  46. houseVariables[x][hInteriorZ] = cache_get_field_content_float(i, "houseInteriorZ");
  47.  
  48. houseVariables[x][hInterior] = cache_get_field_content_int(i, "houseInterior");
  49. houseVariables[x][hRentPrice] = cache_get_field_content_int(i, "houseRentPrice");
  50. houseVariables[x][hPrice] = cache_get_field_content_int(i, "housePrice");
  51.  
  52. houseVariables[x][hLock] = cache_get_field_content_int(i, "houseLock");
  53. houseVariables[x][hUpgrades][0] = cache_get_field_content_int(i, "houseEatUpgrade");
  54.  
  55.  
  56. }
  57. return true;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement