Confirmation Dialog before sending report
#1

I'm not sure if this is possible, and I'm probably over thinking it.....

What I'm trying to do is when a player does /report ID 1 TP hacks, the report doesn't get sent immediately, instead a confirmation dialog pops up the first time they report during that log in session and say a message reminding what /report is used for and not used for, and "Are you sure you want to send this report?" When they click yes, the report is sent, when no, then the report is cancelled. I can do the "1 time per login session" but basically achieving the "pause until they click "Yes" on the dialog" is where I'm stuck at. I'm returning to SA-MP after being gone for a few years and have forgotten a lot of things lol
Any help would be appreciated.
Код:
CMD:report(playerid, params[])
{
	new reportid = -1;

	if (isnull(params))
	{
	    SendSyntaxMessage(playerid, "/report [reason]");
	    SendClientMessage(playerid, COLOR_LIGHTRED, "[WARNING]:{FFFFFF} Please only use this command for valid purposes only.");
	    return 1;
	}
	if (Report_GetCount(playerid) > 5)
	    return SendErrorMessage(playerid, "You already have 5 active reports!");

	if (PlayerData[playerid][pReportTime] >= gettime())
	    return SendErrorMessage(playerid, "You must wait %d seconds before sending another report.", PlayerData[playerid][pReportTime] - gettime());

	if ((reportid = Report_Add(playerid, params)) != -1)
	{
		ShowPlayerFooter(playerid, "Your ~g~report~w~ has been sent!");

		foreach (new i : Player)
		{
			if (PlayerData[i][pAdmin] > 0 && PlayerData[i][pAdminDuty]) {
				SendClientMessageEx(i, COLOR_LIGHTYELLOW, "[REPORT %d]: %s (ID: %d) reports: %s", reportid, ReturnName(playerid, 0), playerid, params);
			}
		}
		PlayerData[playerid][pReportTime] = gettime() + 15;
		SendServerMessage(playerid, "Your report has been sent to any admins online.");
	}
	else
	{
	    SendErrorMessage(playerid, "The report list is full. Please wait for a while.");
	}
	return 1;
}
Reply
#2

Hello.
Maybe U should create variable 4 this. Like.
PHP код:
new reporttext[120][MAX_PLAYERS]; 
And When player click "YES" message will be sent with reporttext.
Reply
#3

Quote:
Originally Posted by Pearson
Посмотреть сообщение
Hello.
Maybe U should create variable 4 this. Like.
PHP код:
new reporttext[120][MAX_PLAYERS]; 
And When player click "YES" message will be sent with reporttext.
This will create an array with the size of 120 and each index will have another array with size of 24 inside.

Switch "120" and "MAX_PLAYERS"
Reply
#4

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
This will create an array with the size of 120 and each index will have another array with size of 24 inside.

Switch "120" and "MAX_PLAYERS"
Not sure what you mean?
Reply
#5

new reporttext[MAX_PLAYERS][120];
Reply
#6

A dialog is a kind of asynchronous event; it doesn't block code that comes after it. So what you likely should should do is, if it is the first report, store the params in a variable. A PVar is a good choice for this because it'll only be used once. Then in OnDialogResponse, if they click Yes, fetch those params and execute the command again for that player with those params. Making sure that you alter the variable that stores whether it's the first report otherwise you'll get stuck in a loop.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)