Report System - Need help
#1

Hi yall!

Recently I begun a Report System which is based on reported player id.


I've made a command called "/res". This command is for admins only, and with this command you can solve a report.

My question is, if I can delete only one report with that command from the /Reports list

Photo:

Thanks in advance!!!

Reply
#2

From what you're saying you want reports to have ASSIGNED ID's so you can delete them after they have been resolved?

Make a variable that stores Report ID's so everytime someone accepts a report it gets deleted.
Reply
#3

This list is a string only. I was thinking if I can delete an report from that list.
Reply
#4

Pretty sure its still possible, Maybe wait for someone more experienced to answer your question. Check other gamemodes or filterscripts to see if someone has something similar you can learn from
Reply
#5

Hi,

Why not create an enum for the reports, and store the data for each one in an enum. This will make it a lot easier to track and delete a certain report.

EDIT: Assuning youve already done the above. Whichever the listitem is equal to, just reset the values of that iteration of the enum if that makes sense.

I.e. Reports[listitem][variables]
Reply
#6

Well, I have already tried with enumerator. I used a variable to store the id for each report.
But actually, my problem is , that i don't know how to delete one item/report only from that list.
Reply
#7

Quote:
Originally Posted by TheHonnor
Посмотреть сообщение
Well, I have already tried with enumerator. I used a variable to store the id for each report.
But actually, my problem is , that i don't know how to delete one item/report only from that list.
If you have all your reports in a enum with the ID stored, then that's perfect.

All you need to do is reset the enum:

Код:
new tmpReport[eReport]     //'eReport' being the name of your enum clearly
Report[reportID] = tmpReport     //this sets that specific enum instance to your enum defaults(so basically empties the enum at Report[reportID])
Then where your code is to format the string for the dialog, that you pass through ShowPlayerDialog. You'll need to do a for loop, to loop through each report and add to list, which I would imagine you're already doing for your dialog. Inside this for loop, just do an if statement to check the Report enum to see if the variables inside are set. If so, display in list, else break from the loop.


I don't know if any of that make sense, it's kind of hard to explain. If not, could you post your code please, and I can help you that way.
Reply
#8

ENUMERATOR:
PHP код:
enum ReportData
{
    
Reported,               Reporter,               rReason[128],           rText[256]
};
new 
Report[MAX_PLAYERS][ReportData]; 
CMD:reports
PHP код:
CMD:reports(playeridparams[])
{
    if(
PlayerInfo[playerid][Level] < 3) return SendError(playerid"You need to be Admin Level 3 to use that command!");
    
//--------------------------------------------------------------------------
    
new ReportCounter 0Str[0] = '\0';
    
//--------------------------------------------------------------------------
    
for(new 1MAX_REPORTSi++) if(strcmp(Reports[i], "NoReports"true) != 0ReportCounter++, format(Strsizeof(Str), "%s\n{FFFFFF}%s"StrReports[i]);
    
//--------------------------------------------------------------------------
    
if(ReportCounter == 0) return SendClientMessage(playeridRed"There are no reports.");
    else return 
ShowPlayerDialog(playerid123DIALOG_STYLE_LIST"{FF0000}Active reports {FFFFFF}- Use {FFD700}/res [id] [text] {FFFFFF}to solve the report!"Str"Close""");

CMD:res
PHP код:
CMD:res(playeridparams[])
{
    new 
PlayerSolve[128], LittleCounter[10]; Str[0] = '\0'eString[0] = '\0';
    
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
if(PlayerInfo[playerid][Level] < 3) return SendError(playerid"You are not authorized to use that command!");
    if(
sscanf(params"us[128]"PlayerSolve)) return SendUsage(playerid"/Res [ID] [Method]");
    if(
Player == INVALID_PLAYER_ID) return SendError2(playerid"Jucatorul cu acest ID nu este conectat!""The player with this ID is not connected!");
    if(
Report[Player][Reporter] == -1) return SendError2(playerid"Acest jucator nu a fost raportat niciun jucator.""That player has been reported by no-one.");
    
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
format(Strsizeof(Str), "{375FFF}Admin {15FF00}%s {375FFF}has solved report with id: {15FF00}%d#{375FFF}!"PlayerName(playerid), Player), SendMessageToAdmins(Str);
    
format(Strsizeof(Str), "{FFFF00}Administrator %s has solved your report! (Method: %s)"PlayerName(playerid), Solve);                     SendClientMessage(Player, -1Str);
    
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
format(LittleCounter10"i"ServerInfo[ServerReports]); TextDrawSetString(ReportInfo[1], LittleCounter);
    
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
foreach(new iPlayer) if(PlayerInfo[i][Level] >= 3)
    {
        if(
ServerInfo[ServerReports] == 0)      TextDrawHideForPlayer(iReportInfo[0]), TextDrawHideForPlayer(iReportInfo[1]);
        else                                    
TextDrawShowForPlayer(iReportInfo[0]), TextDrawHideForPlayer(iReportInfo[1]);
    }
    
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
format(Report[Player][rText], 256""), format(Report[Player][rReason], 128"");
    
Report[Player][Reported] = -1Str[0] = '\0';  Report[Player][Reporter] = -1;
    
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
foreach(new iPlayer) if(Report[i][Reporter] != -1format(Strsizeof(Str), "{00FF00}%d {FF8000}%s {FFFFFF}reported {FF0000}%s {FFFFFF}: %s"Report[i][Reported], PlayerName(Report[i][Reporter]), PlayerName(Report[i][Reported]), Report[i][rReason]);
    
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
for(new 1MAX_REPORTS-1i++) Reports[i] = Reports[i+1]; Reports[MAX_REPORTS-1] = Str;
    
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
ServerInfo[ServerReports]--; return 1;

I know that there are more loops but I was thinking that this method should work.
Reply
#9

Thanks yall for your help. But, with a variable called „ReportedBy” and with some loops, I ve done this system successfully.

The commands that i left here, are available no more. I remade these commands.
Good luck !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)