21.06.2013, 17:52
Quote:
|
I will make it for you later today. You need file function to save the reports in a specific file in scripfiles. And then later you can open that file and get the first three lines.
|
Verb
Require something because it's essential or very important.
Nope, it's not needed to save reports. This is an example, not sure if it will work. (Never done anything like this, not sure if this would work)
pawn Код:
#define MAX_REPORTS 3
enum ReportData
{
Reason[128],
ReportedID,
InUse
}
new ReportInfo[MAX_REPORTS][ReportData];
new LastReport;
CMD:report(playerid, params[])
{
new hacker; new reason[50]; new string[200]; new str[200];
if(sscanf(params, "us[50]", hacker, reason))return SendClientMessage(playerid, COLOR_GREY, "[USAGE]: /report {FF0000}[PlayerID] {FF0000}[Reason]");
if(!IsPlayerConnected(hacker))return SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}This player is {FF0000}NOT {FFFFFF}connected!");
format(string, sizeof(string), "[REPORT]: {800080}%s(ID:%d) {FFFFFF}has Reported {800080}%s(ID:%d) {FFFFFF}|| Reason: {800080}%s", GetName(playerid), playerid, GetName(hacker), hacker, reason);
SendAdminMessage(COLOR_RED, string);
format(str, sizeof(str), "[SYSTEM]: {FFFFFF}You have Reported {800080}%s(ID:%d) {FFFFFF}|| Reason: {800080}%s", GetName(hacker), hacker, reason);
SendClientMessage(playerid, COLOR_GREEN, str);
SendAdminGameText("~w~New ~g~Report!");
LastReport = GetAvailableReport();
format(ReportInfo[GetAvailableReport();][Reason], 128, "%s", reason);
ReportInfo[GetAvailableReport();][ReportedID] = hacker;
ReportInfo[GetAvailableReport();][InUse] = 1;
return 1;
}
CMD:reports(playerid, params[])
{
if(AdminVariableHere[playerid] = AdminValue) //Change to your admin variable
{
new string[128], reports = 0;
for(new i = 0; i < MAX_REPORTS; i++)
{
if(ReportInfo[i][InUse] == 1)
{
reports ++;
format(string, sizeof(string), "%s\nReported: %s (%i) || Reason: %s", string, GetName(ReportInfo[i][ReportedID]), ReportInfo[i][ReportedID], ReportInfo[i][Reason]);
}
}
if(reports == 0)
{
ShowPlayerDialog(playerid, DIALOG_REPORTS, DIALOG_STYLE_MSGBOX, "Reports", "There are no reports to show!", "Close", "");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REPORTS, DIALOG_STYLE_MSGBOX, "Reports", string, "Close", "");
}
}
return 1;
}
stock GetAvailableReport()
{
for(new i = 0; i < MAX_REPORTS; i++)
{
if(ReportInfo[i][InUse] == 0)
{
return i;
}
}
if(LastReport = 2) return 0;
else return LastReport + 1;
}


