SA-MP Forums Archive
/reports command +REP - 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: /reports command +REP (/showthread.php?tid=523691)



/reports command +REP - Youssef214 - 03.07.2014

Hello,so how do i make /reports command that reads the reports from a file (By File.inc) and sends a messages that it is showing the current reports,how can i do that?


Re: /reports command +REP - Youssef214 - 03.07.2014

anyone?


Re: /reports command +REP - BroZeus - 03.07.2014

Learn to do it yourself
atleast try it if u face any prob during making it then ask
don't ask us to script whole thing for you
this is not right section for it

but here i am giving an example for it
try making it our self
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

stock Name(playerid)//stock to get player name
{
new name[24];
GetPlayerName(playerid, name, 24);
return name;
}


CMD:reprot(playerid, params[])
{
//first here do the checks if the player who playerid wants to report is connected or not

//now suppose that you store the playerid who is being reported in "targetid" and reason in "reason"

new str[128];
format(str,128,"%s|%s|%s",Name(playerid),Name(targetid),reason);
new File:file=fopen("Reports.txt", io_append);
fwrite(file, str);
fwrite(file, "\n\r");//this is to leave a line after writing
fclose(file);
return1;
}

CMD:checkreport(playerid params[])//comand to read the reports
{
//first check that the playerid is admin or not

new reporter[24],reported[24],reason[80],line[128],str[1000],temp[130];
new File:file=fopen("Reports.txt", io_read);
while(fread(file, line);
{
sscanf(line, "p<|>sss"reporter, reported, reason);//to split the line
format(temp, 130, "Reporter: %s || Player Reported: %s || reason: %s\n",reporter,reported,reason);
strcat(str, temp, 130);
}
fclose(file);
//now the reports have been stored in variable "str" show it using ShowPlayerDialog
return 1;
}



Re: /reports command +REP - Youssef214 - 04.07.2014

i didn't mean to ask,i just don't know how to make one.


Re: /reports command +REP - Youssef214 - 04.07.2014

When i put Checkreport Command, The PAWN Compiler Stops Working, help please.


Re: /reports command +REP - Youssef214 - 04.07.2014

nvm fixed by myself