Доступ к готовым решениям

Переход в группу "Пользователь"

300.00 ₽
Одноразовый платёж
Быстрый переход в группу "Пользователи", без надобности написания постов и ожидания.

Покупка дает возможность:
Быть полноправным участником форума
Нормальное копирование кода
Создавать темы
Скачивать файлы
Доступ к архиву Pawno-Info

Мануал Система репорта по очереди

Brain_Voker

Умник
Доброго времени суток) Решил вырезать вам с мода Twix'a
Систему репорта:
В начале мода ко все new
PHP:
const 
	MAX_ADMIN_REPORTS = 61,
	MAX_ADMIN_REPORT_TEXT_LENGTH = 116;

enum e_ADMIN_REPORT_INFO
{
	rID,
	rPlayerID,
	rText[MAX_ADMIN_REPORT_TEXT_LENGTH],
	rWhenWroted_Text[10],
	rWhenWroted_Time,
	bool:rIsTooked
};
new aReportInfo[MAX_ADMIN_REPORTS][e_ADMIN_REPORT_INFO];
Добавим таймер очистки жалоб
PHP:
forward admin_reports_cleaner();
public admin_reports_cleaner()
{
	static const
		admin_clean_message[] = "[REPORT-CLEANER] Было удалено: %d жалоб/сообщений.";

	new
		string[sizeof(admin_clean_message) + (-2+2)],
		total_cleaned_reports = 0;

	for(new i = 1; i < MAX_ADMIN_REPORTS; i++)
	{
		if(aReportInfo[i][rPlayerID] == -1)
			continue;

		if(gettime() - aReportInfo[i][rWhenWroted_Time] >= 10)
		{
			SendClientMessage(aReportInfo[i][rPlayerID], -1, !"[report] Ваша жалоба/сообщение для администрации было удалено системой.");

			DeletePVar(aReportInfo[i][rPlayerID], "report_id");

			aReportInfo[i][rIsTooked] = false;
			aReportInfo[i][rID] = i;
			aReportInfo[i][rPlayerID] = -1;
			aReportInfo[i][rText][0] = EOS;
			aReportInfo[i][rWhenWroted_Time] = -1;
			aReportInfo[i][rWhenWroted_Text][0] = EOS;

			total_cleaned_reports++;
		}
	}
	format(string, sizeof(string), admin_clean_message, total_cleaned_reports);
	/* Ващ админ чат */ SendAdminMessage(-1, string);
	return 1;
}
В public OnGameModeInit()
PHP:
for(new i = 1; i < MAX_ADMIN_REPORTS; i++)
	{
		aReportInfo[i][rIsTooked] = false;
		aReportInfo[i][rID] = i;
		aReportInfo[i][rPlayerID] = -1;
		aReportInfo[i][rText][0] = EOS;
		aReportInfo[i][rWhenWroted_Time] = -1;
		aReportInfo[i][rWhenWroted_Text][0] = EOS;
	}
	SetTimer("admin_reports_cleaner", 60000*10, 1); // 10 - minutes
В public OnPlayerDisconnect
PHP:
if(GetPVarInt(playerid, "report_id"))
	{
		new report_id = GetPVarInt(playerid, "report_id");

		aReportInfo[report_id][rIsTooked] = false;
		aReportInfo[report_id][rID] = report_id;
		aReportInfo[report_id][rPlayerID] = -1;
		aReportInfo[report_id][rText][0] = EOS;
		aReportInfo[report_id][rWhenWroted_Time] = -1;
		aReportInfo[report_id][rWhenWroted_Text][0] = EOS;
	}
В public OnDialogResponse
PHP:
case 800:
		{
			if(!response) return 1;
			if(aReportInfo[listitem + 1][rIsTooked] == false) ShowPlayer_Admin_Report_Answer(playerid, listitem + 1);
			else SendClientMessage(playerid, -1, !"Важно: администрация уже отвечает на данную жалобу/сообщение.");
		}
		case 801:
		{
			if(!response)
			{
				aReportInfo[GetPVarInt(playerid, "report_id_to_answer")][rIsTooked] = false;
				DeletePVar(playerid, "report_id_to_answer");
				ShowPlayer_Admin_Report_List(playerid);
			}
			else
			{
				new
					report_id = GetPVarInt(playerid, "report_id_to_answer"),
					target_id = aReportInfo[report_id][rPlayerID];

				if(target_id == INVALID_PLAYER_ID)
					return SendClientMessage(playerid, -1, !"Ошибка: Данный игрок отключился от сервера!");

				static const
					target_msg[] = "[report] Ответ от %s[%d]: %s",
					admins_msg[] = "[ADMIN-REPORT] Администратор %s[%d] ответил %s[%d]: %s";

				new
					string[sizeof(admins_msg) + (-2+MAX_PLAYER_NAME)*2 + (-2+90)];

				format(string, sizeof(string), admins_msg, PlayerInfo[playerid][pNames], playerid, PlayerInfo[target_id][pNames], target_id, inputtext);
				/*Сюда Ваш Админ чат*/SendAdminMessage(-1, string);

				format(string, sizeof(string), target_msg, PlayerInfo[playerid][pNames], playerid, inputtext);
				SendClientMessage(target_id, -1, string);

				DeletePVar(target_id, "report_id");

				aReportInfo[report_id][rIsTooked] = false;
				aReportInfo[report_id][rID] = report_id;
				aReportInfo[report_id][rPlayerID] = -1;
				aReportInfo[report_id][rText][0] = EOS;
				aReportInfo[report_id][rWhenWroted_Time] = -1;
				aReportInfo[report_id][rWhenWroted_Text][0] = EOS;
			}
		}
В конец мода добавляем stock
PHP:
stock ShowPlayer_Admin_Report_List(playerid)
{
	static
		string[1048],
		total_admin_reports = 0;

	for(new i = 1; i < MAX_ADMIN_REPORTS; i++)
	{
		if(aReportInfo[i][rPlayerID] == -1) continue;
		format(string, sizeof(string), "%s %d. %s\n", string, i, PlayerInfo[aReportInfo[i][rPlayerID]][pNames]);
		total_admin_reports++;
	}
	if(total_admin_reports == 0)
		return SendClientMessage(playerid, -1, !"Важно: На данный момент нет доступных жалоб/сообщений от игроков.");

	ShowPlayerDialog(playerid, 800, DIALOG_STYLE_LIST, "Список жалоб/сообщений от игроков", string, "Выбрать", "Отмена");
	return 1;
}
Добавляем ко всем командам
PHP:
CMD:areport(playerid, params[])
{
	if(pInfo[playerid][pAdmin] < 1) return 1;
	ShowPlayer_Admin_Report_List(playerid);
	return 1;
}
CMD:report(playerid, params[])
{
    if(sscanf(params,"s[117]",params[0])) return SendClientMessage(playerid, -1, !"Используйте: /report [текст]");
	if(GetPVarInt(playerid, "report_id")) return SendClientMessage(playerid, -1, !"Важно: Вы уже отправили жалобу/сообщение для администрации. Ожидайте ответ.");
	new
		string[144],
		hour,
		minute,
		second;

	format(string, sizeof(string), "[report] %s[%d] оставил жалобу/сообщение для администрации (просмотреть: /areport).", PlayerInfo[playerid][pNames], playerid);
	/*Укажите Ваш админ чат */SendAdminMessage(-1, string);

	SendClientMessage(playerid, -1, !"Информация: Вы успешно отправили жалобу/сообщение для администрации.");
	format(string, sizeof(string), "Текст: %s", params[0]);
	SendClientMessage(playerid, -1, string);
	for(new i = 1; i < MAX_ADMIN_REPORTS; i++)
	{
		if(aReportInfo[i][rPlayerID] != -1) continue;
		aReportInfo[i][rIsTooked] = false;
		aReportInfo[i][rID] = i;
		aReportInfo[i][rPlayerID] = playerid;
		format(string, sizeof(string), "%s", params);
		strmid(aReportInfo[i][rText], string, 0, MAX_ADMIN_REPORT_TEXT_LENGTH, MAX_ADMIN_REPORT_TEXT_LENGTH);
		aReportInfo[i][rWhenWroted_Time] = gettime();
		gettime(hour, minute, second);
		format(string, sizeof(string), "%02d:%02d:%02d", hour, minute, second);
		strmid(aReportInfo[i][rWhenWroted_Text], string, 0, 10, 10);
		SetPVarInt(playerid, "report_id", i);
		break;
	}
	return 1;
}
Добавь к stock'am
PHP:
stock ShowPlayer_Admin_Report_Answer(playerid, report_id) 
{ 
    SetPVarInt(playerid, "report_id_to_answer", report_id); 
    aReportInfo[report_id][rIsTooked] = true; 
    static const 
        dialog_header_text[] = "%d. %s", 
        dialog_string_text[] = 
            "Жалоба/сообщение: %s\n\n\ 
            Отправил: %s\n\ 
            Время отправки: %s\n\n\ 
            Введите ваш ответ в диалоговое поле ниже:"; 
    new 
        dialog_header[sizeof(dialog_header_text) + (-2+2) + (-2+MAX_PLAYER_NAME)], 
        dialog_string[sizeof(dialog_string_text) + (-2+MAX_ADMIN_REPORT_TEXT_LENGTH) + (-2+MAX_PLAYER_NAME) + (-2+10)]; 
    format(dialog_header, sizeof(dialog_header), dialog_header_text, report_id, PlayerInfo[aReportInfo[report_id][rPlayerID]][pNames]); 
    format(dialog_string, sizeof(dialog_string), dialog_string_text, aReportInfo[report_id][rText], PlayerInfo[aReportInfo[report_id][rPlayerID]][pNames], aReportInfo[report_id][rWhenWroted_Text]); 
    ShowPlayerDialog(playerid, 801, DIALOG_STYLE_INPUT, dialog_header, dialog_string, "Ответить", "Назад"); 
    return 1; 
}
 
Последнее редактирование модератором:
Сверху Снизу