SA-MP Forums Archive
A Better Report System Than /report [id] [reason] - 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: A Better Report System Than /report [id] [reason] (/showthread.php?tid=287904)



A Better Report System Than /report [id] [reason] - SantarioLeone - 05.10.2011

I have the /report [ID] [Reason] in my script followed by admin commands /acceptreport(/ar) [Id] and /markfalse [Id]. I want to make three more commands to end a report, /reply /endreportgood [Reason] Or /endreportbad [Reason]

Here's my questions, I want to create a ReportLogs.txt. Where when a player reports something it is logged into a file. The file would write something like this in the TxT file. How would i go about doing so? Can someone point me in the direction of a useful tutorial, or explain where i would start?

Example Of A Good Ended Report:

[10/2/2011 >10:40A.M]ReportID[ID]Reginald_Bailey reported Tom_Hanks. Reason: He Deathmatched Me. //Line One
Administrator: Santario_Leone has Accepted ReportID [ID] From Reginald_Bailey. //Line Two
CompletedReport: Reginald Bailey Ended ReportID[ID] Good because [Reason]


Example Of A Badly Ended Report:

[10/2/2011 >10:40A.M]ReportID[ID]Reginald_Bailey reported Tom_Hanks. Reason: He Deathmatched Me. //Line One
Administrator: Santario_Leone has Accepted ReportID [ID] From Reginald_Bailey. //Line Two
CompletedReport: Reginald Bailey Ended ReportID[ID] Bad because [Reason]


Example Of A Marked False Report:

[10/2/2011 >10:40A.M]ReportID[ID]Reginald_Bailey reported Tom_Hanks. Reason: noobs. //Line One
Administrator: Santario_Leone has Marked ReportID [ID] False From Reginald_Bailey. //Line Two
CompletedReport: Reginald Bailey Ended ReportID[ID] Bad because [Reason]


Re: A Better Report System Than /report [id] [reason] - TheLazySloth - 05.10.2011

Код:
stock WriteReportsLog(string[])
{
if(!fexist("Reports.log")) dini_Create("Reports.log"); // You need to change dini_Create to your file creating system. new
entry[255], File: hFile;
format(entry, sizeof(entry), "%s\r\n", string); hFile = fopen("Reports.log", io_append); fwrite(hFile, entry); fclose(hFile);
}
The above code I provided was created by me. =] Thanks to sa-mp resources.
The above was tested by me and it works without compile errors or file errors.


Copy&Paste to the bottom line of your gamemode or where ever you want to put it.
Then change dini_Create("Reports.log"); to you file creating system's Create function.
Last, somewhere in /report [playerid] [Reason] all you do is add WriteReportsLog(string); !

Enjoy and don't forget to +rep me (the star to far left).


Re: A Better Report System Than /report [id] [reason] - Surferdude - 06.10.2011

This helped me to, Thanks!


Re: A Better Report System Than /report [id] [reason] - SantarioLeone - 06.10.2011

Thanks, for that, + Repped, now only thing left is for the cmds. Can you or anyone assist me with that?


Re: A Better Report System Than /report [id] [reason] - Tigerkiller - 06.10.2011

by creating this commands or edit it ?

which command processor did you use ?


Re: A Better Report System Than /report [id] [reason] - SantarioLeone - 07.10.2011

Creating it, i dont have the /endreport good/bad or /reply command made, and i am using Zcmd


Re: A Better Report System Than /report [id] [reason] - SantarioLeone - 09.10.2011

Bump^

New issue, the report log is saved, but it displays the wrong text.
My Report Command. It displays "Your message was sent to the online admins" but i want it to output like my first post.
pawn Код:
CMD:report(playerid,params[])
{
    new id, reason[35], string[128], sendername[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    if(sscanf(params,"uz", id, reason)) return SendClientMessage(playerid, COLOR_GREY,"[True:RP]: /report [playerid/partofname] [reason]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY,"Invalid player ID");
    else
    {
        GetPlayerName(id, name,sizeof(name));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new hour, minute, second, year, month, day;
        gettime(hour, minute, second);
        getdate(year, month, day);
        format(string, sizeof(string), "[ID:%d] %s has reported %s: %s. [Date:%d/%d/%d][Time:  %d:%d:%d]", playerid, sendername, name, reason, month, day, year, hour, minute, second);
        ABroadCast(COLOR_LIGHTRED,string,1);
        format(string, sizeof(string), "Use /markfalse [id] or /acceptreport [id]");
        ABroadCast(COLOR_LIGHTBLUE,string,1);
        format(string, sizeof(string), "Your report was just sent to the online admins use (/reply) to reply, please wait for a reply");
        SendClientMessage(playerid,COLOR_LIGHTRED,string);
        PlayerNeedsHelp[playerid] = 1;
        WriteReportsLog(string);
        return 1;
    }
}

the file writing Stock
pawn Код:
stock WriteReportsLog(string[])
{
if(!fexist("Reports.log")) dini_Create("Reports.log"); // You need to change dini_Create to your file creating system.
new
entry[255],
File: hFile;
format(entry, sizeof(entry), "%s\r\n", string);
hFile = fopen("Reports.log", io_append);
fwrite(hFile, entry);
fclose(hFile);
}



Re: A Better Report System Than /report [id] [reason] - DRIFT_HUNTER - 09.10.2011

pawn Код:
CMD:report(playerid,params[])
{
    new id, reason[35], string[128], sendername[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    if(sscanf(params,"uz", id, reason)) return SendClientMessage(playerid, COLOR_GREY,"[True:RP]: /report [playerid/partofname] [reason]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY,"Invalid player ID");
    else
    {
        GetPlayerName(id, name,sizeof(name));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        new hour, minute, second, year, month, day;
        gettime(hour, minute, second);
        getdate(year, month, day);
        format(string, sizeof(string), "[ID:%d] %s has reported %s: %s. [Date:%d/%d/%d][Time:  %d:%d:%d]", playerid, sendername, name, reason, month, day, year, hour, minute, second);
        ABroadCast(COLOR_LIGHTRED,string,1);
        format(string, sizeof(string), "Use /markfalse [id] or /acceptreport [id]");
        ABroadCast(COLOR_LIGHTBLUE,string,1);
        format(string, sizeof(string), "Your report was just sent to the online admins use (/reply) to reply, please wait for a reply");
        SendClientMessage(playerid,COLOR_LIGHTRED,string);
        PlayerNeedsHelp[playerid] = 1;
        format(string, sizeof(string), "[ID:%d] %s has reported %s: %s. [Date:%d/%d/%d][Time:  %d:%d:%d]", playerid, sendername, name, reason, month, day, year, hour, minute, second);
        WriteReportsLog(string);
        return 1;
    }
}