/report - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /report (
/showthread.php?tid=441623)
/report -
whando - 03.06.2013
Hey, as I said i'm new to scripting and if I don't understand something I will ask it here, well.. I want a /report command so players can report each other, admins will get a message "*** reported ***: *reason*
Problem is it won't give the reported players name, how to fix it?
Код:
if(strcmp(cmd, "/report", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(JustReported[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "Wait 20 seconds after sending a next /report ! ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new giveplayerid;
giveplayerid = ReturnUser(tmp);
if(IsPlayerNPC(giveplayerid)) return 1;
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [player] [reason]");
return 1;
}
if(PlayerInfo[playerid][pReportMuted] == 1)
{
return SendClientMessage(playerid, COLOR_RED, "You are muted from sending any /reports!");
}
JustReported[playerid] = 1;
SetTimerEx("ReportReset", 20000, false, "i", playerid);
format(string, sizeof(string), "%s reporting %s: %s", RemoveUnderScore(playerid), RPN(giveplayerid), (result));
ABroadCast(COLOR_RED, string, 1);
SendClientMessage(playerid, COLOR_YELLOW, "Your report was succesfully sent.");
Reported[playerid] = 1;
}
return 1;
}
Re: /report -
NewerthRoleplay - 03.06.2013
pawn Код:
format(string, sizeof(string), "%s reporting %s: %s", RemoveUnderScore(playerid), RPN(giveplayerid), (result));
I'm guessing this is the line that is clearly not working?
Re: /report -
Pottus - 03.06.2013
You don't need this either....
if(IsPlayerConnected(playerid))
Obviously they are connected if they just typed a command.