Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. public: LoadGangRepositories()
  2. {
  3. new idx;
  4. new Cache: result, rows;
  5.  
  6. result = mysql_query(mysql, "SELECT * FROM gang_repositories", true);
  7. rows = cache_num_rows();
  8.  
  9. if(rows > MAX_GZ)
  10. {
  11. rows = MAX_GZ;
  12. print("[GangRepositories]: DB rows > MAX_GANG_REPOSITORIES");
  13. }
  14.  
  15. for(idx = 0; idx < rows; idx ++)
  16. {
  17. SetGangRepositoryData(idx, GR_GANG, cache_get_field_content_int(idx, "id"));
  18. SetGangRepositoryData(idx, GR_METALL, cache_get_field_content_int(idx, "metall"));
  19. SetGangRepositoryData(idx, GR_AMMO, cache_get_field_content_int(idx, "ammo"));
  20. SetGangRepositoryData(idx, GR_DRUGS, cache_get_field_content_int(idx, "drugs"));
  21. SetGangRepositoryData(idx, GR_MONEY, cache_get_field_content_int(idx, "money"));
  22.  
  23. SetGangRepositoryData(idx, GR_LOCK, bool: cache_get_field_content_int(idx, "lock"));
  24.  
  25. new fmt_text[330],
  26. gang_id = GetGangRepositoryData(idx, GR_GANG);
  27.  
  28.  
  29. format
  30. (
  31. fmt_text, sizeof fmt_text,
  32. "Склад\n\
  33. %s\n\n\
  34. {FFFFFF}Наркотики: {ff9900}%d из 20000 г\n\
  35. {FFFFFF}Патроны: {ff9900}%d из 50000 шт\n\
  36. {FFFFFF}Металл: {ff9900}%d из 6000 кг\n\
  37. {FFFFFF}Деньги: {3366FF}$%d\n\n\
  38. %s\
  39. ",
  40. GetTeamName(idx + TEAM_GANG_GROVE),
  41. GetGangRepositoryData(idx, GR_DRUGS),
  42. GetGangRepositoryData(idx, GR_AMMO),
  43. GetGangRepositoryData(idx, GR_METALL),
  44. GetGangRepositoryData(idx, GR_MONEY),
  45. GetGangRepositoryData(idx, GR_LOCK) ? "{66CC33}Открыт" : "{FF3300}Закрыт"
  46. );
  47.  
  48.  
  49. g_gang_repository[idx][GR_LABEL] = CreateDynamic3DTextLabel
  50. (
  51. fmt_text,
  52. 0xFFFFFFFF,
  53. GetTeamData(idx + TEAM_GANG_GROVE, O_REPOSITORY_POS)[0],
  54. GetTeamData(idx + TEAM_GANG_GROVE, O_REPOSITORY_POS)[1],
  55. GetTeamData(idx + TEAM_GANG_GROVE, O_REPOSITORY_POS)[2] + 1.5,
  56. 10.0
  57. );
  58.  
  59. g_gang_repository[idx][GR_PICKUP] = CreatePickup
  60. (
  61. 1239,
  62. 23,
  63. GetTeamData(idx + TEAM_GANG_GROVE, O_REPOSITORY_POS)[0],
  64. GetTeamData(idx + TEAM_GANG_GROVE, O_REPOSITORY_POS)[1],
  65. GetTeamData(idx + TEAM_GANG_GROVE, O_REPOSITORY_POS)[2],
  66. -1,
  67. PICKUP_ACTION_TYPE_GANG_REPOSIT,
  68. gang_id
  69. );
  70. }
  71.  
  72. cache_delete(result);
  73.  
  74. printf("[GangRepositories]: Склады банд загружены");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement