Advertisement
FanHamMer

Untitled

Sep 13th, 2015
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.26 KB | None | 0 0
  1. #define MAX_HOUSES                  (1000)
  2. #assert MAX_HOUSES                  >(0b0)
  3.  
  4. forward public loadHouses();
  5. public loadHouses()
  6. {
  7.         new rows, fields;
  8.         cache_get_data(rows, fields);
  9.         if rows *then
  10.         {
  11.             new str[95];
  12.             for(new id; id < rows; id++)
  13.         {
  14.             if cache_get_field_content_int(id, "price", h_handle) == 0 *then continue;
  15.  
  16.                 cache_get_field_content(id, #owner, str, h_handle);
  17.                         createHouse(\
  18.                         .id=cache_get_field_content_int(id, #id, h_handle),\
  19.                         .owner=str, \
  20.                         .price=cache_get_field_content_int(id, #price, h_handle),\
  21.                         .type=cache_get_field_content_int(id, #type, h_handle),\
  22.                         .x=cache_get_field_content_float(id, #x, h_handle),\
  23.                         .y=cache_get_field_content_float(id, #y, h_handle),\
  24.                         .z=cache_get_field_content_float(id, #z, h_handle),\
  25.                         .r=cache_get_field_content_float(id, #r, h_handle));
  26.                         houseInfo[id][h_Money] = cache_get_field_content_int(id, #money, h_handle);
  27.                         houseInfo[id][h_Lock] = cache_get_field_content_int(id, #lock, h_handle);
  28.                         cache_get_field_content(0, #gun, str, h_handle);
  29.                         sscanf(str, "p<,>iiiiiiiiii", \
  30.                         houseInfo[id][h_Gun][0], houseInfo[id][h_Ammo][0], \
  31.                         houseInfo[id][h_Gun][1], houseInfo[id][h_Ammo][1], \
  32.                         houseInfo[id][h_Gun][2], houseInfo[id][h_Ammo][2], \
  33.                         houseInfo[id][h_Gun][3], houseInfo[id][h_Ammo][3], \
  34.                         houseInfo[id][h_Gun][4], houseInfo[id][h_Ammo][4]);
  35.                 }
  36.         }
  37.         return true;
  38. }
  39.  
  40. createHouse(id, owner[], price, type, Float:x,Float:y, Float:z, Float:r)
  41. {
  42.     for(new i = 1; i < MAX_HOUSES; i++)
  43.     {
  44.         if houseInfo[id][h_ID] == 0 *then
  45.         {
  46.             houseInfo[id][h_ID] = id; break;
  47.         }
  48.     }
  49.     if houseInfo[id][h_ID] == (TOTAL_HOUSES+1) *then ++TOTAL_HOUSES;
  50.     houseInfo[id][h_ID] = id,\
  51.     strmid(houseInfo[id][h_Owner], owner, 0, strlen(owner), MAX_PLAYER_NAME+1),\
  52.     houseInfo[id][h_Price] = price,\
  53.     houseInfo[id][h_Type] = type;
  54.     houseInfo[id][h_Pos][0] = x,\
  55.     houseInfo[id][h_Pos][1] = y,\
  56.     houseInfo[id][h_Pos][2] = z,\
  57.     houseInfo[id][h_Pos][3] = r;
  58.     houseInfo[id][h_Owned] = (strcmp("none", owner, true) == 0) ? 0 : 1;
  59.  
  60.     houseInfo[id][h_MapIcon] = CreateDynamicMapIcon(.x=x, .y=y, .z=z, .type=(houseInfo[id][h_Owned] == 0) ? ICON_EMPTY_HOUSE : ICON_FULL_HOUSE, .color=-1, .worldid = 0, .interiorid = 0, .streamdistance = HOUSE_STREAM_DISTANCE);
  61.     houseInfo[id][h_Pickup][0] = CreateDynamicPickup(.modelid = (houseInfo[id][h_Owned] == 0) ? PICKUP_EMPTY_HOUSE : PICKUP_FULL_HOUSE, .type =1, .x=x,.y=y,.z=z, .worldid = 0, .interiorid= 0,.streamdistance = HOUSE_STREAM_DISTANCE);
  62.     houseInfo[id][h_Pickup][1] = CreateDynamicPickup(.modelid = PICKUP_INSIDE_HOUSE, .type = 1, .x=Interiors[houseInfo[id][h_Type]][iX],.y=Interiors[houseInfo[id][h_Type]][iY],.z=Interiors[houseInfo[id][h_Type]][iZ], .worldid = houseInfo[id][h_ID], .interiorid= Interiors[houseInfo[id][h_Type]][iInt],.streamdistance = 20);
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement