Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public: OnPhoneHistory(playerid, type, account_id, page)
- {
- new rows = cache_num_rows();
- if(rows)
- {
- new sql_id,
- phone_type,
- phone_id_incoming,
- phone_id_outgoing,
- phone_text[155],
- phone_date,
- exec_name[MAX_PLAYER_NAME],
- phone_dell;
- new year, month, day, hour, minute;
- new end_inter = page*MAX_PAGE_ITEMS+1,
- i = end_inter-MAX_PAGE_ITEMS-1;
- new further_button;
- new fmt_str[24+17+18+MAX_PLAYER_NAME];
- strdel(FormatData, 0, strlen(FormatData));
- if(type == PHONE_HISTORY_CALL) strcat(FormatData, "{b7c2c8}- Тип звонка\t{b7c2c8}- От кого/кому\t{b7c2c8}- Дата\n");
- else strcat(FormatData, "{b7c2c8}- Тип сообщения\t{b7c2c8}- От кого/кому\t{b7c2c8}- Дата\t{b7c2c8}- Сообщение\n");
- if(end_inter < rows)
- {
- strcat(FormatData, "- Далее\n");
- further_button = true;
- } else {
- end_inter = rows;
- i = 0;
- }
- SetPVarInt(playerid, "PHONE_HISTORY_LIST_PAGE", page);
- new list_check_item;
- for(; i < end_inter; i++)
- {
- cache_get_value_name_int(i, "dell", phone_dell);
- cache_get_value_name_int(i, "incoming", phone_id_incoming);
- cache_get_value_name_int(i, "outgoing", phone_id_outgoing);
- if(phone_dell)
- {
- if(phone_id_incoming == account_id) {
- list_check_item++;
- continue;
- }
- } else if(phone_dell == 2) if(phone_id_outgoing == account_id) {
- list_check_item++;
- continue;
- }
- cache_get_value_name_int(i, "id", sql_id);
- cache_get_value_name_int(i, "incoming", phone_id_incoming);
- cache_get_value_name_int(i, "type", phone_type);
- cache_get_value_name_int(i, "outgoing", phone_id_outgoing);
- cache_get_value_name_int(i, "date", phone_date);
- cache_get_value_name(i, "name", exec_name);
- if(type == PHONE_HISTORY_SMS) {
- cache_get_value_name(i, "text", phone_text);
- if(strlen(phone_text) > 15) {
- strdel(phone_text, 15, strlen(phone_text));
- strcat(phone_text, "...");
- }
- }
- SetPlayerListitemValue(playerid, i - list_check_item + further_button, sql_id);
- //SetListPhoneHistory(playerid, page, max_page, sql_id, further_button, i - list_check_item);
- UnixToDate(phone_date, year, month, day, hour, minute);
- switch(type)
- {
- case PHONE_HISTORY_CALL:
- {
- format
- (
- fmt_str,
- sizeof fmt_str,
- "{FFFFFF}%s\t%s\t%02d:%02d %02d.%02d.%d\n",
- (phone_id_incoming == account_id) ? ("{a6f230}Входящий") : ("{ffa300}Исходящий"),
- exec_name,
- hour, minute, day, month, year
- );
- }
- case PHONE_HISTORY_SMS:
- {
- format
- (
- fmt_str,
- sizeof fmt_str,
- "{FFFFFF}%s\t%s\t%02d:%02d %02d.%02d.%d\t%s\n",
- (phone_id_incoming == account_id) ? ("{a6f230}Входящие") : ("{ffa300}Исходящие"),
- exec_name,
- hour, minute, day, month, year,
- phone_text
- );
- }
- }
- strcat(FormatData, fmt_str);
- }
- if(page > 1) strcat(FormatData, "\n- Назад");
- if(type == PHONE_HISTORY_CALL) ShowDialog(playerid, DialogID(DIALOG_HISTORY_CALL), DIALOG_STYLE_TABLIST_HEADERS, "{b7c2c8} - История звонков", FormatData, "{b7c2c8}Далее", "Назад");
- else ShowDialog(playerid, DialogID(DIALOG_HISTORY_SMS), DIALOG_STYLE_TABLIST_HEADERS, "{b7c2c8} - История SMS сообщений", FormatData, "{b7c2c8}Далее", "Назад");
- } else SendClientMessage(playerid, 0xCECECEFF, "* Здесь пусто");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement