Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql_function_query(dbHandle, "SELECT * FROM `house`", true, "load_houses", "");
- fpublic: load_houses()
- {
- new temp[128];
- static rows, fields;
- cache_get_data(rows, fields);
- if(rows)
- {
- for(new h = 0; h < rows; h++)
- {
- cache_get_row(h, 0, temp), house_info[h][hid] = strval(temp);
- cache_get_row(h, 1, temp), house_info[h][henterx] = floatstr(temp);
- cache_get_row(h, 2, temp), house_info[h][hentery] = floatstr(temp);
- cache_get_row(h, 3, temp), house_info[h][henterz] = floatstr(temp);
- cache_get_row(h, 4, temp), house_info[h][howned] = strval(temp);
- cache_get_row(h, 5, temp), strmid(house_info[h][howner], temp, 0, strlen(temp), 24);
- cache_get_row(h, 6, temp), house_info[h][hcost] = strval(temp);
- cache_get_row(h, 7, temp), strmid(house_info[h][htype], temp, 0, strlen(temp), 24);
- cache_get_row(h, 8, temp), house_info[h][hkvar] = strval(temp);
- cache_get_row(h, 9, temp), house_info[h][hint] = strval(temp);
- cache_get_row(h, 10, temp), house_info[h][haenterx] = floatstr(temp);
- cache_get_row(h, 11, temp), house_info[h][haentery] = floatstr(temp);
- cache_get_row(h, 12, temp), house_info[h][haenterz] = floatstr(temp);
- cache_get_row(h, 13, temp), house_info[h][haenterrot] = floatstr(temp);
- cache_get_row(h, 14, temp), house_info[h][haexitx] = floatstr(temp);
- cache_get_row(h, 15, temp), house_info[h][haexity] = floatstr(temp);
- cache_get_row(h, 16, temp), house_info[h][haexitz] = floatstr(temp);
- cache_get_row(h, 17, temp), house_info[h][hlock] = strval(temp);
- cache_get_row(h, 18, temp), strmid(house_info[h][hpos], temp, 0, strlen(temp), 24);
- cache_get_row(h, 19, temp), strmid(house_info[h][hdistrict], temp, 0, strlen(temp), 24);
- cache_get_row(h, 20, temp), house_info[h][hpay] = strval(temp);
- totalhouse++;
- BuyHouse(h);
- }
- }
- printf("Äîìà (%d øò) çàãðóæåíû óñïåøíî", totalhouse);
- return 1;
- }
- stock SellGovHouse(h)
- {
- new query[95];
- format(query, sizeof(query), "UPDATE `house` SET `howner` = '%s', `howned` = '0' WHERE `hid` = '%d'", house_info[h][howner], house_info[h][hid]);
- mysql_function_query(dbHandle, query, false, "", "");
- DestroyDynamicMapIcon(house_info[h][hicon]);
- DestroyDynamicPickup(house_info[h][hpickup]);
- house_info[h][hpickup] = CreateDynamicPickup(1273, 23, house_info[h][henterx], house_info[h][hentery], house_info[h][henterz], -1);
- house_info[h][hicon] = CreateDynamicMapIcon(house_info[h][henterx], house_info[h][hentery], house_info[h][henterz], 31, 0, -1, -1, -1, 180);
- return 1;
- }
- stock SaveHouse(h)
- {
- new query[128];
- 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]);
- mysql_function_query(dbHandle, query, false, "", "");
- return 1;
- }
- stock BuyHouse(h)
- {
- if(house_info[h][howned] == 0)
- {
- DestroyDynamicMapIcon(house_info[h][hicon]);
- DestroyDynamicPickup(house_info[h][hpickup]);
- house_info[h][hpickup] = CreateDynamicPickup(1273, 23, house_info[h][henterx], house_info[h][hentery], house_info[h][henterz], -1);
- house_info[h][hicon] = CreateDynamicMapIcon(house_info[h][henterx], house_info[h][hentery], house_info[h][henterz], 31, 0, -1, -1, -1, 180);
- return 1;
- }
- if(house_info[ho][howned] == 1)
- {
- DestroyDynamicMapIcon(house_info[ho][hicon]);
- DestroyDynamicPickup(house_info[ho][hpickup]);
- house_info[ho][hpickup] = CreateDynamicPickup(19522, 23, house_info[ho][henterx], house_info[ho][hentery], house_info[ho][henterz], -1);
- house_info[ho][hicon] = CreateDynamicMapIcon(house_info[ho][henterx], house_info[ho][hentery], house_info[ho][henterz], 32, 0, -1, -1, -1, 180);
- return 1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement