[Help]: /reports command
#7

Quote:
Originally Posted by Goldilox
Посмотреть сообщение
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.
Need
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;
}
Reply


Messages In This Thread
[Help]: /reports command - by Areax - 21.06.2013, 14:07
Re: [Help]: /reports command - by ScripteRNaBEEL - 21.06.2013, 14:39
Re: [Help]: /reports command - by Areax - 21.06.2013, 14:41
Re: [Help]: /reports command - by ScripteRNaBEEL - 21.06.2013, 14:46
Re: [Help]: /reports command - by Areax - 21.06.2013, 14:48
Re: [Help]: /reports command - by Goldilox - 21.06.2013, 16:43
Re: [Help]: /reports command - by Kindred - 21.06.2013, 17:52
Re: [Help]: /reports command - by Areax - 22.06.2013, 11:43

Forum Jump:


Users browsing this thread: 1 Guest(s)