Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.80 KB | None | 0 0
  1. mysql_function_query(dbHandle, "SELECT * FROM `house`", true, "load_houses", "");
  2.  
  3. fpublic: load_houses()
  4. {
  5.     new temp[128];
  6.     static rows, fields;
  7.     cache_get_data(rows, fields);
  8.     if(rows)
  9.     {
  10.         for(new h = 0; h < rows; h++)
  11.         {
  12.             cache_get_row(h, 0, temp), house_info[h][hid] = strval(temp);
  13.             cache_get_row(h, 1, temp), house_info[h][henterx] = floatstr(temp);
  14.             cache_get_row(h, 2, temp), house_info[h][hentery] = floatstr(temp);
  15.             cache_get_row(h, 3, temp), house_info[h][henterz] = floatstr(temp);
  16.             cache_get_row(h, 4, temp), house_info[h][howned] = strval(temp);
  17.             cache_get_row(h, 5, temp), strmid(house_info[h][howner], temp, 0, strlen(temp), 24);
  18.             cache_get_row(h, 6, temp), house_info[h][hcost] = strval(temp);
  19.             cache_get_row(h, 7, temp), strmid(house_info[h][htype], temp, 0, strlen(temp), 24);
  20.             cache_get_row(h, 8, temp), house_info[h][hkvar] = strval(temp);
  21.             cache_get_row(h, 9, temp), house_info[h][hint] = strval(temp);
  22.             cache_get_row(h, 10, temp), house_info[h][haenterx] = floatstr(temp);
  23.             cache_get_row(h, 11, temp), house_info[h][haentery] = floatstr(temp);
  24.             cache_get_row(h, 12, temp), house_info[h][haenterz] = floatstr(temp);
  25.             cache_get_row(h, 13, temp), house_info[h][haenterrot] = floatstr(temp);
  26.             cache_get_row(h, 14, temp), house_info[h][haexitx] = floatstr(temp);
  27.             cache_get_row(h, 15, temp), house_info[h][haexity] = floatstr(temp);
  28.             cache_get_row(h, 16, temp), house_info[h][haexitz] = floatstr(temp);
  29.             cache_get_row(h, 17, temp), house_info[h][hlock] = strval(temp);
  30.             cache_get_row(h, 18, temp), strmid(house_info[h][hpos], temp, 0, strlen(temp), 24);
  31.             cache_get_row(h, 19, temp), strmid(house_info[h][hdistrict], temp, 0, strlen(temp), 24);
  32.             cache_get_row(h, 20, temp), house_info[h][hpay] = strval(temp);
  33.             totalhouse++;
  34.             BuyHouse(h);
  35.         }
  36.     }
  37.     printf("Äîìà (%d øò) çàãðóæåíû óñïåøíî", totalhouse);
  38.     return 1;
  39. }
  40. stock SellGovHouse(h)
  41. {
  42.     new query[95];
  43.     format(query, sizeof(query), "UPDATE `house` SET `howner` = '%s', `howned` = '0' WHERE `hid` = '%d'", house_info[h][howner], house_info[h][hid]);
  44.     mysql_function_query(dbHandle, query, false, "", "");
  45.     DestroyDynamicMapIcon(house_info[h][hicon]);
  46.     DestroyDynamicPickup(house_info[h][hpickup]);
  47.     house_info[h][hpickup] = CreateDynamicPickup(1273, 23, house_info[h][henterx], house_info[h][hentery], house_info[h][henterz], -1);
  48.     house_info[h][hicon] = CreateDynamicMapIcon(house_info[h][henterx], house_info[h][hentery], house_info[h][henterz], 31, 0, -1, -1, -1, 180);
  49.     return 1;
  50. }
  51. stock SaveHouse(h)
  52. {
  53.     new query[128];
  54.     format(query, sizeof(query), "UPDATE `house` SET `howner` = '%s', `howned` = '%d' WHERE `hid` = '%d'", house_info[h][howner], house_info[h][howned], house_info[h][hid]);
  55.     mysql_function_query(dbHandle, query, false, "", "");
  56.     return 1;
  57. }
  58. stock BuyHouse(h)
  59. {
  60.     if(house_info[h][howned] == 0)
  61.     {
  62.         DestroyDynamicMapIcon(house_info[h][hicon]);
  63.         DestroyDynamicPickup(house_info[h][hpickup]);
  64.         house_info[h][hpickup] = CreateDynamicPickup(1273, 23, house_info[h][henterx], house_info[h][hentery], house_info[h][henterz], -1);
  65.         house_info[h][hicon] = CreateDynamicMapIcon(house_info[h][henterx], house_info[h][hentery], house_info[h][henterz], 31, 0, -1, -1, -1, 180);
  66.         return 1;
  67.     }
  68.     if(house_info[ho][howned] == 1)
  69.     {
  70.         DestroyDynamicMapIcon(house_info[ho][hicon]);
  71.         DestroyDynamicPickup(house_info[ho][hpickup]);
  72.         house_info[ho][hpickup] = CreateDynamicPickup(19522, 23, house_info[ho][henterx], house_info[ho][hentery], house_info[ho][henterz], -1);
  73.         house_info[ho][hicon] = CreateDynamicMapIcon(house_info[ho][henterx], house_info[ho][hentery], house_info[ho][henterz], 32, 0, -1, -1, -1, 180);
  74.         return 1;
  75.     }
  76.     return 1;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement