/report sends out y with accent
#1

So below is my /report command, I've been trying to fix it cause you needed and ID to report someone so now that i removed the ID it send out everything perfect exept the reportext, It sends a y with an accent

Код:
CMD:report(playerid, params[])
{
	new reporttext[128];
	if(sscanf(params, "us[64]", reporttext)) return Syntax(playerid, "report", "[reporttext].");
	if(strlen(reporttext) > 64) return Error(playerid, "Your report text cannot be more than 64 characters");
	if(PlayerInfo[playerid][pRMuted]) return Error(playerid, "You are currently muted from the reports system. Report not sent.");
	if(GetPlayerActiveReport(playerid)) return Error(playerid, "You already have an active report. Please wait until it is closed out to re-report.");
	new reportid = GetNewReportID();
	if(reportid == INVALID_REPORT_ID) return Error(playerid, "There are currently too many reports in the system. Please try again in a few minutes.");
	new q[256];
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, 24);
	new time = gettime();
	format(q, 256, "INSERT INTO reports (`reporter`, reporttext`, `time`, `accepted`, `resolved`, `rtime`) VALUES ('%s', '%s', %d, %d, %d, %d)", name, reporttext, time, 0, 0, 0);


	new string[128];
	format(STRING, "[RID: %d] Report from %s [%d] : %s", reportid, GetPlayerNameEx(playerid), playerid, reporttext);
	SendAdminMessage(COLOR_ADMIN, string);
	SendAdminText();
	print(string);
	format(STRING, "Your report has been sent to the admins. Please be paitient and wait until an admin can help you.");
	Message(playerid, string);


	Reports[reportid][rep_reporter] = playerid;
	Reports[reportid][rep_text] = reporttext;
	Reports[reportid][rep_time] = time;
	Reports[reportid][rep_accepted] = 0;

	return 1;
}
Reply
#2

Try: (you had 'STRING' instead of 'string' as defined)
pawn Код:
format(string, "[RID: %d] Report from %s [%d] : %s", reportid, GetPlayerNameEx(playerid), playerid, reporttext);
format(string, "Your report has been sent to the admins. Please be paitient and wait until an admin can help you.");
Reply
#3

Nope...
Reply
#4

Quote:
Originally Posted by AchievementMaster360
Посмотреть сообщение
Nope...
You've forgotten to remove the playerid selection via sscanf.
pawn Код:
if(sscanf(params, "us[64]", reporttext)) return Syntax(playerid, "report", "[reporttext].");
To:
pawn Код:
if(sscanf(params, "s[64]", reporttext)) return Syntax(playerid, "report", "[reporttext].");
Reply
#5

pawn Код:
CMD:report(playerid, params[])
{
    new reporttext[64];
    if(sscanf(params, "s[64]", reporttext)) return Syntax(playerid, "report", "[reporttext].");
    if(strlen(reporttext) > 64) return Error(playerid, "Your report text cannot be more than 64 characters");
    if(PlayerInfo[playerid][pRMuted]) return Error(playerid, "You are currently muted from the reports system. Report not sent.");
    if(GetPlayerActiveReport(playerid)) return Error(playerid, "You already have an active report. Please wait until it is closed out to re-report.");
    new reportid = GetNewReportID();
    if(reportid == INVALID_REPORT_ID) return Error(playerid, "There are currently too many reports in the system. Please try again in a few minutes.");
    new q[256];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, 24);
    new time = gettime();
    format(q, 256, "INSERT INTO reports (`reporter`, reporttext`, `time`, `accepted`, `resolved`, `rtime`) VALUES ('%s', '%s', %d, %d, %d, %d)", name, reporttext, time, 0, 0, 0);


    new string[128];
    format(STRING, "[RID: %d] Report from %s [%d] : %s", reportid, GetPlayerNameEx(playerid), playerid, reporttext);
    SendAdminMessage(COLOR_ADMIN, string);
    SendAdminText();
    print(string);
    format(STRING, "Your report has been sent to the admins. Please be paitient and wait until an admin can help you.");
    Message(playerid, string);


    Reports[reportid][rep_reporter] = playerid;
    Reports[reportid][rep_text] = reporttext;
    Reports[reportid][rep_time] = time;
    Reports[reportid][rep_accepted] = 0;

    return 1;
}
Your sscanf format was wrong.

You forgot to remove the ID parameter in your format

EDIT: Too late,
Reply
#6

EDIT: Wops! Didn't see too many people already answered it!
pawn Код:
if(sscanf(params, "us[64]", reporttext)) return Syntax(playerid, "report", "[reporttext].");
You removed the ID but you didn't remove the datatype in the sscanf line. Fixed below.

pawn Код:
if(sscanf(params, "s[64]", reporttext)) return Syntax(playerid, "report", "[reporttext].");
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)