Report Help
#1

Okay so, I am working on a report command and I want it to have /report [id] [text] when it is only /report [text] now, the code is shown below

Код HTML:
CMD:report(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] < 1338)
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "You can't submit reports as an administrator.");
		return 1;
	}
	if(PlayerInfo[playerid][pRMuted] != 0)
	{
		ShowPlayerDialog(playerid,7955,DIALOG_STYLE_MSGBOX,"Report blocked","You are blocked from submitting any reports!\n\nTips when reporting:\n- Report what you need, not who you need.\n- Be specific, report exactly what you need.\n- Do not make false reports.\n- Do not flame admins.\n- Report only for in-game items.\n- For shop orders use the /onlineshop command","Close", "");
		return 1;
	}
	if(JustReported[playerid] > 0)
	{
		SendClientMessageEx(playerid, COLOR_GREY, "Wait 25 seconds before sending another report!");
		return 1;
	}

	if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /report [text]");

	JustReported[playerid]=25;
	SendReportToQue(playerid, params);
	SendClientMessageEx(playerid, COLOR_YELLOW, "Your report message was sent to the Admins On Duty, please wait patiently!");
	return 1;
}
I need to know how I add another text field into this and make it shown here
Код HTML:
stock SendReportToQue(reportfrom, report[])
{
    new bool:breakingloop = false, newid = INVALID_REPORT_ID;

	for(new i=0;i<MAX_REPORTS;i++)
	{
		if(!breakingloop)
		{
			if(Reports[i][HasBeenUsed] == 0)
			{
				breakingloop = true;
				newid = i;
			}
		}
    }
    if(newid != INVALID_REPORT_ID)
    {
        strmid(Reports[newid][Report], report, 0, strlen(report), 128);
        Reports[newid][ReportFrom] = reportfrom;
        Reports[newid][TimeToExpire] = 5;
        Reports[newid][HasBeenUsed] = 1;
        Reports[newid][BeingUsed] = 1;
        Reports[newid][ReportExpireTimer] = SetTimerEx("ReportTimer", 60000, 0, "d", newid);
        new string[128];
        format(string, sizeof(string), "%s (ID %i) | RID: %i | Report: %s", GetPlayerNameEx(reportfrom), reportfrom, newid, (report));
        ABroadCast(COLOR_REPORT,string,2);
    }
    else
    {
        ClearReports();
        SendReportToQue(reportfrom, report);
    }
    if(PlayerInfo[reportfrom][pDonateRank] == 4)
    {
        new string[128];
		format(string, sizeof(string), "~r~Priority Report: ~g~%d", newid);
		foreach(Player, i)
		{
		    if(PlayerInfo[i][pAdmin] >= 2)
		    {
		        GameTextForPlayer(i, string, 1500, 1);
			}
		}
	}
}
Reply
#2

Show us this function. We need to change it a bit to make it work the way you want.

SendReportToQue(playerid, params);

The Original function code from the game mode.
Reply
#3

Updated
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
This is what sscanf is for.
pawn Код:
CMD:report(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] < 1338)
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You can't submit reports as an administrator.");
        return 1;
    }
    if(PlayerInfo[playerid][pRMuted] != 0)
    {
        ShowPlayerDialog(playerid,7955,DIALOG_STYLE_MSGBOX,"Report blocked","You are blocked from submitting any reports!\n\nTips when reporting:\n- Report what you need, not who you need.\n- Be specific, report exactly what you need.\n- Do not make false reports.\n- Do not flame admins.\n- Report only for in-game items.\n- For shop orders use the /onlineshop command","Close", "");
        return 1;
    }
    if(JustReported[playerid] > 0)
    {
        SendClientMessageEx(playerid, COLOR_GREY, "Wait 25 seconds before sending another report!");
        return 1;
    }
    new text[200];
    if(sscanf(params,"s[200]",text)) return SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /report [text]");

    JustReported[playerid]=25;
    SendReportToQue(playerid, text);
    SendClientMessageEx(playerid, COLOR_YELLOW, "Your report message was sent to the Admins On Duty, please wait patiently!");
    return 1;
}
So simple
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
That's only one string parameter, you don't need sscanf for that. Nick_Phelps wanted an ID too.
Sorry for Bumping it but thought of giving him the Right Code.
pawn Код:
CMD:report(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] < 1338)
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You can't submit reports as an administrator.");
        return 1;
    }
    if(PlayerInfo[playerid][pRMuted] != 0)
    {
        ShowPlayerDialog(playerid,7955,DIALOG_STYLE_MSGBOX,"Report blocked","You are blocked from submitting any reports!\n\nTips when reporting:\n- Report what you need, not who you need.\n- Be specific, report exactly what you need.\n- Do not make false reports.\n- Do not flame admins.\n- Report only for in-game items.\n- For shop orders use the /onlineshop command","Close", "");
        return 1;
    }
    if(JustReported[playerid] > 0)
    {
        SendClientMessageEx(playerid, COLOR_GREY, "Wait 25 seconds before sending another report!");
        return 1;
    }
    new text[200],id;
    if(sscanf(params,"us[200]",id,text)) return SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /report [playerid/partofname] [text]");
 
    JustReported[playerid] = 1;
    SendReportToQue(playerid, text);
    SendClientMessageEx(playerid, COLOR_YELLOW, "Your report message was sent to the Admins On Duty, please wait patiently!");
    return 1;
}
@Nick -
pawn Код:
SendReportToQue(playerid, text);
This function already shows the player's id who has been reported therefore we do need to pass the reported player's id over here. Use the Code given above.
Reply
#6

Код:
SendReportToQue(playerid, text);
Error for text
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)