SA-MP Forums Archive
/reports - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /reports (/showthread.php?tid=166030)



/reports - [RVRP]Tyler - 07.08.2010

My reports command looks like this:

pawn Код:
new Report[128];
CMD:reports(playerid, params[])
{
    if(GetPVarInt(playerid, "adminlevel") < 1) return SendClientMessage(playerid, RED, "You are not an administrator.");
    {
        SendClientMessage(playerid, YELLOW, "|__________Open Reports__________|");
        foreach(Player, i)
        {
            if(IsPlayerConnected(i))
            {
                if(GetPVarInt(i, "reported") == 1)
                {
                    new string[128];
                    format(string, sizeof(string), "REPORT: %s [%i]: %s", ReturnPlayerName(i), i, Report);
                    SendClientMessage(playerid, ORANGE, string);
                }
            }
        }
    }
    return 1;
}
It only shows the most recent report though, how do I make it so that each player gets their own Report string?


Re: /reports - Calgon - 07.08.2010

Show me your /report command.


Re: /reports - [RVRP]Tyler - 07.08.2010

pawn Код:
CMD:report(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new string[128];
        new
        reason;
        if(sscanf(params, "s", reason)) { return SendClientMessage(playerid, CYAN, "[Usage]: /report [text]. Use this to report for admin assistance, or report a hacker/rulebreaker."); }
        {
            format(string, sizeof(string), "REPORT: %s [ID:%i]: %s", ReturnPlayerName(playerid), playerid, reason);
            ShowForAdmin(ORANGE, string);
            SetPVarInt(playerid, "reported", 1);
            SendClientMessage(playerid, GREEN, "You report has been delivered. Don't report again until an admin accepts your report.");
            Report[playerid] = reason;
        }
    }
    return 1;
}
I'm sure my mistake is the "Report[playerid]", I just don't know what I should put there.


Re: /reports - Calgon - 07.08.2010

Quote:
Originally Posted by [RVRP]Tyler
Посмотреть сообщение
pawn Код:
CMD:report(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new string[128];
        new
        reason;
        if(sscanf(params, "s", reason)) { return SendClientMessage(playerid, CYAN, "[Usage]: /report [text]. Use this to report for admin assistance, or report a hacker/rulebreaker."); }
        {
            format(string, sizeof(string), "REPORT: %s [ID:%i]: %s", ReturnPlayerName(playerid), playerid, reason);
            ShowForAdmin(ORANGE, string);
            SetPVarInt(playerid, "reported", 1);
            SendClientMessage(playerid, GREEN, "You report has been delivered. Don't report again until an admin accepts your report.");
            Report[playerid] = reason;
        }
    }
    return 1;
}
I'm sure my mistake is the "Report[playerid]", I just don't know what I should put there.
Create an array which supports 128 characters, and for MAX_PLAYERS, or a PVar String (as I plan on demonstrating):

pawn Код:
CMD:report(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new
            reason,
            string[128];
           
        if(sscanf(params, "s", reason))
        {
            SendClientMessage(playerid, CYAN, "[Usage]: /report [text]. Use this to report for admin assistance, or report a hacker/rulebreaker.");
        }
        else
        {
            format(string, sizeof(string), "REPORT: %s [ID:%i]: %s", ReturnPlayerName(playerid), playerid, reason);
            ShowForAdmin(ORANGE, string);
            SetPVarInt(playerid, "reported", 1);
            SendClientMessage(playerid, GREEN, "You report has been delivered. Don't report again until an admin accepts your report.");
            SetPVarString(playerid, "reportReason", reason);
        }
    }
    return 1;
}

CMD:reports(playerid, params[])
{
    if(GetPVarInt(playerid, "adminlevel") < 1) return SendClientMessage(playerid, RED, "You are not an administrator.");
    {
        new
            reportString[128],
            reportBody[128];
           
        SendClientMessage(playerid, YELLOW, "|__________Open Reports__________|");
       
        foreach(Player, i)
        {
            if(IsPlayerConnected(i))
            {
                if(GetPVarInt(i, "reported") == 1)
                {
                    GetPVarString(i, "reportReason", reportBody, sizeof(reportBody));
                    format(reportString, sizeof(reportString), "REPORT: %s [%i]: %s", ReturnPlayerName(i), i, reportBody);
                    SendClientMessage(playerid, ORANGE, reportString);
                }
            }
        }
    }
    return 1;
}