Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_HOUSES (1000)
- #assert MAX_HOUSES >(0b0)
- forward public loadHouses();
- public loadHouses()
- {
- new rows, fields;
- cache_get_data(rows, fields);
- if rows *then
- {
- new str[95];
- for(new id; id < rows; id++)
- {
- if cache_get_field_content_int(id, "price", h_handle) == 0 *then continue;
- cache_get_field_content(id, #owner, str, h_handle);
- createHouse(\
- .id=cache_get_field_content_int(id, #id, h_handle),\
- .owner=str, \
- .price=cache_get_field_content_int(id, #price, h_handle),\
- .type=cache_get_field_content_int(id, #type, h_handle),\
- .x=cache_get_field_content_float(id, #x, h_handle),\
- .y=cache_get_field_content_float(id, #y, h_handle),\
- .z=cache_get_field_content_float(id, #z, h_handle),\
- .r=cache_get_field_content_float(id, #r, h_handle));
- houseInfo[id][h_Money] = cache_get_field_content_int(id, #money, h_handle);
- houseInfo[id][h_Lock] = cache_get_field_content_int(id, #lock, h_handle);
- cache_get_field_content(0, #gun, str, h_handle);
- sscanf(str, "p<,>iiiiiiiiii", \
- houseInfo[id][h_Gun][0], houseInfo[id][h_Ammo][0], \
- houseInfo[id][h_Gun][1], houseInfo[id][h_Ammo][1], \
- houseInfo[id][h_Gun][2], houseInfo[id][h_Ammo][2], \
- houseInfo[id][h_Gun][3], houseInfo[id][h_Ammo][3], \
- houseInfo[id][h_Gun][4], houseInfo[id][h_Ammo][4]);
- }
- }
- return true;
- }
- createHouse(id, owner[], price, type, Float:x,Float:y, Float:z, Float:r)
- {
- for(new i = 1; i < MAX_HOUSES; i++)
- {
- if houseInfo[id][h_ID] == 0 *then
- {
- houseInfo[id][h_ID] = id; break;
- }
- }
- if houseInfo[id][h_ID] == (TOTAL_HOUSES+1) *then ++TOTAL_HOUSES;
- houseInfo[id][h_ID] = id,\
- strmid(houseInfo[id][h_Owner], owner, 0, strlen(owner), MAX_PLAYER_NAME+1),\
- houseInfo[id][h_Price] = price,\
- houseInfo[id][h_Type] = type;
- houseInfo[id][h_Pos][0] = x,\
- houseInfo[id][h_Pos][1] = y,\
- houseInfo[id][h_Pos][2] = z,\
- houseInfo[id][h_Pos][3] = r;
- houseInfo[id][h_Owned] = (strcmp("none", owner, true) == 0) ? 0 : 1;
- 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);
- 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);
- 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);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement