/report command help
#1

I'm having a slight issue with my /report command. sometimes when people do /report it reports their ID and not the id they wanted to report.

EX:
Jake /report Bob Hacking!
[INFO]: Jake (0) Has Reported Jake (0) for: Hacking!

Here is the command code:
pawn Код:
if(strcmp(cmd, "/report", true) == 0 || strcmp(cmd, "/re", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(JustReported[playerid] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "** Wait 1 minute after sending another report! ");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/re)port [playerid/PartOfName] [text]");
                return 1;
            }
            giveplayerid = strval(tmp);
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            if(IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    new length = strlen(cmdtext);
                    while ((idx < length) && (cmdtext[idx] <= ' '))
                    {
                        idx++;
                    }
                    new offset = idx;
                    new result[128];
                    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                    {
                        result[idx - offset] = cmdtext[idx];
                        idx++;
                    }
                    result[idx - offset] = EOS;
                    if(!strlen(result))
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/re)port [playerid] [text]");
                        return 1;
                    }
                    if(PlayerInfo[playerid][pRegularRank] == 0)
                    {
                        format(string, sizeof(string), "[INFO]: %s (%d) Has Reported %s (%d) for: %s",sendername, playerid, giveplayer, giveplayerid, (result));
                    }
                    else
                    {
                        format(string, sizeof(string), "[INFO]: High-Ranking Player %s (%d) Has Reported %s (%d) for: %s",sendername, playerid, giveplayer, giveplayerid, (result));
                    }
                    SendAdminMessage(COLOR_GREEN,string);
                    SendAdminMessage(COLOR_LIGHTRED, "----------------------------------------------------------------------------------------------");
                    SendAdminMessage(COLOR_GREEN,"Type '/acceptreport (/ar) [reporter id]' or '/trashreport (/tr) [reporter id]'");
                    SendClientMessage(playerid, COLOR_LIGHTRED, "* Your report was sent and reviewed by the Server Admins that are online.");
                    JustReported[playerid] = 1;
                    PlayerNeedsHelp[playerid] = 1;
                    SetTimerEx("ReportReset", 60000, false, "i", playerid);
                    new y, m, d;
                    new h,mi,s;
                    getdate(y,m,d);
                    gettime(h,mi,s);
                    format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Reported %s for: %s",d,m,y,h,mi,s,sendername, giveplayer, (result));
                    ReportLog(string);
                    Reports[MAX_REPORTS-1] = string;
                }
            }
        }
        return 1;
 }
Please & thanks for help with this issue
Reply
#2

Why are you using STRCMP?
Reply
#3

idk, but does anyone see the problem?
Reply
#4

Yes, i see a problem. STRCMP D:
Reply
#5

Is that a LARP/Raven's edit?
Reply
#6

That's not the problem...

It's a code error, not the type of command processor I'm using.



EDIT: This is in fact a command from Raven's RP. I have used a few things from Ravens RP in my GM. NO my server is not Ravens RP and NO I am not going to post a billion Ravens RP bug questions.
Reply
#7

Use sscanf, it'll be much less confusing. And take a look at this tutorial.
Reply
#8

I'll take a look into sscanf or DCMD.

I have looked into that tutorial and still am not sure what I did wrong...
Reply
#9

Here's a small report system.

pawn Код:
enum pInfo
{
     pAdmin
};
new PlayerInfo[MAX_PLAYERS][pInfo];

stock SendAdminMessage(color, string[]);
{
     Foreach(Player,i)
     {
          if(PlayerInfo[i][pAdmin] >= 1)
          {
               SendClientMessage(i, color, string);
          }
     }
}

CMD:report(playerid, params[])
{
     new string[256], reason;
     if(sscanf(params, "s[60]", reason)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /report [reason]");

     SendClientMessage(playerid,0xFFFFFFA, "Message sent to online administrators!");
     new pname[MAX_PLAYER_NAME];
     GetPlayerName(playerid, pname,sizeof(pname));
     format(string, sizeof(string), "[REPORT] %s has reported: %s",pname, reason);
     SendAdminMessage(0xFFFF00AA, string);
     return 1;
}
Reply
#10

I'll give u some tips :

LEAVE STRMP --- Theres the ZCMD the best include.

Second - If this is not comfortable and its not to you and fully bugs change to freestyle text instead that player report on another player cause if player want say something to admin or he bugged , Think about that , Each server need report free style...
Reply
#11

Ummm I'll note that. But for now...

Does anyone see anything wrong with my code (NOT THE PROCESSOR lol)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)