report system help
#1

Hey, I want to make my report system require an ID.
Example: /report ID TEXT
It's currently /report TEXT
The code I think I need to change is below, but I just can't figue it out (I'm a bit of a newb and our experienced scripter quit.)

/report command:
Код:
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 /shoporder 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 [ID] [text]");

 	JustReported[playerid]=25;
 	SendReportToQue(playerid, params);
	SendClientMessageEx(playerid, COLOR_YELLOW, "Your report message was sent to the Admins.");
	return 1;
}
Sendreporttoque:
Код:
stock SendReportToQue(reportfrom, reporttarget, 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 [%i] reporting %s [%i] (RID: %i): %s", GetPlayerNameEx(reportfrom), reportfrom, GetPlayerNameEx(reporttarget), reporttarget, newid, (report));
		ABroadCast(COLOR_REPORT,string,2);
	}
	else
	{
		ClearReports();
		SendReportToQue(reportfrom, reporttarget, 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);
			}
		}
	}
}
I would really appreciate some help on this!
Reply
#2

Use sscanf.
Reply
#3

Okay... As I said I'm a new, how exactly would I implement sscanf to do this?
Reply
#4

PHP код:
if(isnull(params)) return SendClientMessageEx(playeridCOLOR_GRAD2"USAGE: /report [ID] [text]"); 
to

PHP код:
new playerbmessage[64];
if(
sscanf(params"us[64]"playerbmessage)) return SendClientMessage(playeridCOLOR_GRAD2"USAGE: /report [ID] [text]"); 
----------------------------------------------------------------------------------------------------------------------------

PHP код:
SendReportToQue(playeridparams); 
to

PHP код:
SendReportToQue(playeridplayerbmessage); 
Reply
#5

Quote:
Originally Posted by Jacksta21
Посмотреть сообщение
Okay... As I said I'm a new, how exactly would I implement sscanf to do this?
Download sscanf, place the plugins and include to their specific folder (INC file goes to pawno>includes and plugins in the plugins folder). Next add sscanf to your server.cfg,
Код:
plugins sscanf2
After that, add
pawn Код:
#include <sscanf>
Reply
#6

Quote:
Originally Posted by HardRock
Посмотреть сообщение
PHP код:
if(isnull(params)) return SendClientMessageEx(playeridCOLOR_GRAD2"USAGE: /report [ID] [text]"); 
to

PHP код:
new playerbmessage[64];
if(
sscanf(params"us[64]"playerbmessage)) return SendClientMessage(playeridCOLOR_GRAD2"USAGE: /report [ID] [text]"); 
----------------------------------------------------------------------------------------------------------------------------

PHP код:
SendReportToQue(playeridparams); 
to

PHP код:
SendReportToQue(playeridplayerbmessage); 
This works fine.
But I'm getting an error trying to check if playerb argument IsNumeric, I found this on the internet and lots of people say its handy but I just get this error:
error 035: argument type mismatch (argument 1)
for this code:
Код:
 	new playerb, message[64];
	if(sscanf(params, "us[64]", playerb, message)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /report [ID] [text]");
	if(!IsNumeric(playerb)) // Error is on this line
	{
	    SendClientMessageEx(playerid, COLOR_GRAD1, "USAGE: /report [ID] [text]");
		return 1;
	}
Reply
#7

Dunno if it will "help" you fully, but uh, i made a /report command tutorial:
https://sampforum.blast.hk/showthread.php?tid=468794
Might help you, not sure.. well, good luck.
Reply
#8

PM me your report system, i'll fix it for ya.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)