ENUMERATOR:
PHP код:
enum ReportData
{
Reported, Reporter, rReason[128], rText[256]
};
new Report[MAX_PLAYERS][ReportData];
CMD:reports
PHP код:
CMD:reports(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 3) return SendError(playerid, "You need to be Admin Level 3 to use that command!");
//--------------------------------------------------------------------------
new ReportCounter = 0; Str[0] = '\0';
//--------------------------------------------------------------------------
for(new i = 1; i < MAX_REPORTS; i++) if(strcmp(Reports[i], "NoReports", true) != 0) ReportCounter++, format(Str, sizeof(Str), "%s\n{FFFFFF}%s", Str, Reports[i]);
//--------------------------------------------------------------------------
if(ReportCounter == 0) return SendClientMessage(playerid, Red, "There are no reports.");
else return ShowPlayerDialog(playerid, 123, DIALOG_STYLE_LIST, "{FF0000}Active reports {FFFFFF}- Use {FFD700}/res [id] [text] {FFFFFF}to solve the report!", Str, "Close", "");
}
CMD:res
PHP код:
CMD:res(playerid, params[])
{
new Player, Solve[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]", Player, Solve)) 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(Str, sizeof(Str), "{375FFF}Admin {15FF00}%s {375FFF}has solved report with id: {15FF00}%d#{375FFF}!", PlayerName(playerid), Player), SendMessageToAdmins(Str);
format(Str, sizeof(Str), "{FFFF00}Administrator %s has solved your report! (Method: %s)", PlayerName(playerid), Solve); SendClientMessage(Player, -1, Str);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
format(LittleCounter, 10, "i", ServerInfo[ServerReports]); TextDrawSetString(ReportInfo[1], LittleCounter);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
foreach(new i: Player) if(PlayerInfo[i][Level] >= 3)
{
if(ServerInfo[ServerReports] == 0) TextDrawHideForPlayer(i, ReportInfo[0]), TextDrawHideForPlayer(i, ReportInfo[1]);
else TextDrawShowForPlayer(i, ReportInfo[0]), TextDrawHideForPlayer(i, ReportInfo[1]);
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
format(Report[Player][rText], 256, ""), format(Report[Player][rReason], 128, "");
Report[Player][Reported] = -1; Str[0] = '\0'; Report[Player][Reporter] = -1;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
foreach(new i: Player) if(Report[i][Reporter] != -1) format(Str, sizeof(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 i = 1; i < MAX_REPORTS-1; i++) 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.