Help with report system
#1

Hello, i have this report command:
pawn Код:
CMD:report(playerid, params[])
{
    new target, Name[24], ReporterName[24], Reason[128], Msg[128];

    if (pInfo[playerid][LoggedIn] == true)
    {
        if (sscanf(params, "us[128]", target, Reason)) return SendClientMessage(playerid, RED, "USAGE: /report [ID] [Reason]");
        if(target == playerid) return SendClientMessage(playerid, RED, "You cannot report yourself!");
        if (pInfo[target][LoggedIn] == true)
        {
            GetPlayerName(target, Name, sizeof(Name));
            SendAdminText(playerid, "/REPORT", params);
            GetPlayerName(playerid, ReporterName, sizeof(ReporterName));
            format(Msg, 128, "*** Player %s (ID: %d) has reported player %s (ID:%d). (Reason: %s )", ReporterName, playerid, Name, target, Reason);
            MessageToAdmins(RED, Msg);
            SendClientMessage(playerid, YELLOW, "Report sent to online Admins/Operators. Thanks for reporting!");
        }
        else SendClientMessage(playerid, RED, "Player isn't connected!");
    }
    else return 0;
    return 1;
}
What i want to know is, if a player has reported someone and if an admin spec the reported player, it will send the message to the reporter saying "An Admin is checking your report"

I tried to make this and couldn't figure out how to. Can someone suggest me?
Reply
#2

You need if any admin is online then send message to him.
pawn Код:
CMD:report(playerid, params[])
{
    new target, Name[24], ReporterName[24], Reason[128], Msg[128];

    if (pInfo[playerid][LoggedIn] == true)
    {
        if (sscanf(params, "us[128]", target, Reason)) return SendClientMessage(playerid, RED, "USAGE: /report [ID] [Reason]");
        if(target == playerid) return SendClientMessage(playerid, RED, "You cannot report yourself!");
        if (pInfo[target][LoggedIn] == true)
        {
            GetPlayerName(target, Name, sizeof(Name));
            SendAdminText(playerid, "/REPORT", params);
            GetPlayerName(playerid, ReporterName, sizeof(ReporterName));
            format(Msg, 128, "*** Player %s (ID: %d) has reported player %s (ID:%d). (Reason: %s )", ReporterName, playerid, Name, target, Reason);
             for(new i=0; i<GetMaxPlayers(); i++)
                    {
                     if(IsPlayerConnected(i))
                                        {
                                        if(IsPlayerAdmin(i)){
                                            SendClientMessage(i, 0x555252AA, Msg);
                                            SendClientMessage(playerid, YELLOW, "Report sent to online Admins/Operators. Thanks for reporting!");
                                         }
                     }
                     else SendClientMessage(playerid, RED, "Player isn't connected!");
    }
    else return 0;
    return 1;
}
Reply
#3

You can create a global variable something like
pawn Код:
new GotAReported=0;
new AReported=0;
Then when the player uses /report, the report command would be like this
pawn Код:
CMD:report(playerid, params[])
{
    new target, Name[24], ReporterName[24], Reason[128], Msg[128];

    if (pInfo[playerid][LoggedIn] == true)
    {
        if (sscanf(params, "us[128]", target, Reason)) return SendClientMessage(playerid, RED, "USAGE: /report [ID] [Reason]");
        if(target == playerid) return SendClientMessage(playerid, RED, "You cannot report yourself!");
        if (pInfo[target][LoggedIn] == true)
        {
            GetPlayerName(target, Name, sizeof(Name));
            SendAdminText(playerid, "/REPORT", params);
            GetPlayerName(playerid, ReporterName, sizeof(ReporterName));
            format(Msg, 128, "*** Player %s (ID: %d) has reported player %s (ID:%d). (Reason: %s )", ReporterName, playerid, Name, target, Reason);
            GotAReported = target;
            AReported = playerid;
            MessageToAdmins(RED, Msg);
            SendClientMessage(playerid, YELLOW, "Report sent to online Admins/Operators. Thanks for reporting!");
        }
        else SendClientMessage(playerid, RED, "Player isn't connected!");
    }
    else return 0;
    return 1;
}
Then under the /spec command, you can check if the targetid of the /spec equals the "GotAReported" (which is normally the ID of the guy that got reported) then you send a message to AReported (the player who used the report command) and send him a message saying that "An admin is checking your report."

PS:The "A" in 'A'Reported Got'A'Reported = admin, AdminReported, GotAdminReported, but shorter and such.
Good luck, hope it helps.
Reply
#4

@MacT, if you didn't understand what i am asking then you better not try to help. I already have the MessageToAdmin function created to send messages to admins.

@MattTucker, thanks. I will try to make it in that way.
Reply
#5

Quote:
Originally Posted by iOxide
Посмотреть сообщение
@MattTucker, thanks. I will try to make it in that way.
Inform me if you find any bugs, though it should work fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)