/reports
#1

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?
Reply
#2

Show me your /report command.
Reply
#3

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.
Reply
#4

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)