Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.88 KB | None | 0 0
  1. public: OnPhoneHistory(playerid, type, account_id, page)
  2. {
  3.     new rows = cache_num_rows();
  4.     if(rows)
  5.     {
  6.         new sql_id,
  7.             phone_type,
  8.             phone_id_incoming,
  9.             phone_id_outgoing,
  10.             phone_text[155],
  11.             phone_date,
  12.             exec_name[MAX_PLAYER_NAME],
  13.             phone_dell;
  14.        
  15.         new year, month, day, hour, minute;
  16.    
  17.         new end_inter = page*MAX_PAGE_ITEMS+1,
  18.             i = end_inter-MAX_PAGE_ITEMS-1;
  19.    
  20.         new further_button;
  21.    
  22.         new fmt_str[24+17+18+MAX_PLAYER_NAME];
  23.         strdel(FormatData, 0, strlen(FormatData));
  24.         if(type == PHONE_HISTORY_CALL) strcat(FormatData, "{b7c2c8}- Тип звонка\t{b7c2c8}- От кого/кому\t{b7c2c8}- Дата\n");
  25.             else strcat(FormatData, "{b7c2c8}- Тип сообщения\t{b7c2c8}- От кого/кому\t{b7c2c8}- Дата\t{b7c2c8}- Сообщение\n");
  26.    
  27.         if(end_inter < rows)
  28.         {
  29.             strcat(FormatData, "- Далее\n");
  30.             further_button = true;
  31.         } else {
  32.             end_inter = rows;
  33.             i = 0;
  34.         }
  35.    
  36.    
  37.         SetPVarInt(playerid, "PHONE_HISTORY_LIST_PAGE", page);
  38.    
  39.         new list_check_item;
  40.         for(; i < end_inter; i++)
  41.         {
  42.             cache_get_value_name_int(i, "dell", phone_dell);
  43.             cache_get_value_name_int(i, "incoming", phone_id_incoming);
  44.             cache_get_value_name_int(i, "outgoing", phone_id_outgoing);
  45.    
  46.             if(phone_dell)
  47.             {
  48.                 if(phone_id_incoming == account_id) {
  49.                     list_check_item++;
  50.                     continue;
  51.                 }
  52.             } else if(phone_dell == 2) if(phone_id_outgoing == account_id) {
  53.                 list_check_item++;
  54.                 continue;
  55.             }
  56.             cache_get_value_name_int(i, "id", sql_id);
  57.             cache_get_value_name_int(i, "incoming", phone_id_incoming);
  58.             cache_get_value_name_int(i, "type", phone_type);
  59.             cache_get_value_name_int(i, "outgoing", phone_id_outgoing);
  60.             cache_get_value_name_int(i, "date", phone_date);
  61.             cache_get_value_name(i, "name", exec_name);
  62.            
  63.             if(type == PHONE_HISTORY_SMS) {
  64.                 cache_get_value_name(i, "text", phone_text);
  65.                 if(strlen(phone_text) > 15) {
  66.                     strdel(phone_text, 15, strlen(phone_text));
  67.                     strcat(phone_text, "...");
  68.                 }
  69.             }
  70.    
  71.             SetPlayerListitemValue(playerid, i - list_check_item + further_button, sql_id);
  72.                 //SetListPhoneHistory(playerid, page, max_page, sql_id, further_button, i - list_check_item);
  73.             UnixToDate(phone_date, year, month, day, hour, minute);
  74.             switch(type)
  75.                 {
  76.                         case PHONE_HISTORY_CALL:
  77.                         {
  78.                             format
  79.                             (
  80.                                 fmt_str,
  81.                                 sizeof fmt_str,
  82.                                 "{FFFFFF}%s\t%s\t%02d:%02d %02d.%02d.%d\n",  
  83.                                 (phone_id_incoming == account_id) ? ("{a6f230}Входящий") : ("{ffa300}Исходящий"),
  84.                                 exec_name,
  85.                                 hour, minute, day, month, year
  86.                             );
  87.                         }
  88.                         case PHONE_HISTORY_SMS:
  89.                         {
  90.                             format
  91.                             (
  92.                                 fmt_str,
  93.                                 sizeof fmt_str,
  94.                                 "{FFFFFF}%s\t%s\t%02d:%02d %02d.%02d.%d\t%s\n",
  95.                                 (phone_id_incoming == account_id) ? ("{a6f230}Входящие") : ("{ffa300}Исходящие"),
  96.                                 exec_name,
  97.                                 hour, minute, day, month, year,
  98.                                 phone_text
  99.                             );    
  100.                         }
  101.             }
  102.             strcat(FormatData, fmt_str);
  103.         }
  104.         if(page > 1) strcat(FormatData, "\n- Назад");
  105.         if(type == PHONE_HISTORY_CALL) ShowDialog(playerid, DialogID(DIALOG_HISTORY_CALL), DIALOG_STYLE_TABLIST_HEADERS, "{b7c2c8} - История звонков", FormatData, "{b7c2c8}Далее", "Назад");
  106.             else ShowDialog(playerid, DialogID(DIALOG_HISTORY_SMS), DIALOG_STYLE_TABLIST_HEADERS, "{b7c2c8} - История SMS сообщений", FormatData, "{b7c2c8}Далее", "Назад");
  107.     } else SendClientMessage(playerid, 0xCECECEFF, "* Здесь пусто");
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement