SA-MP Forums Archive
/report command help - 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: /report command help (/showthread.php?tid=432907)



/report command help - jakejohnsonusa - 24.04.2013

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


Re: /report command help - Skyrise - 24.04.2013

Why are you using STRCMP?


Re: /report command help - jakejohnsonusa - 25.04.2013

idk, but does anyone see the problem?


Re: /report command help - arakuta - 25.04.2013

Yes, i see a problem. STRCMP D:


Re: /report command help - Skyrise - 25.04.2013

Is that a LARP/Raven's edit?


Re: /report command help - jakejohnsonusa - 25.04.2013

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.


Re: /report command help - Onfroi - 25.04.2013

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


Re: /report command help - jakejohnsonusa - 25.04.2013

I'll take a look into sscanf or DCMD.

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


Re: /report command help - Tom Kingston - 25.04.2013

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;
}



Re: /report command help - yaron0600 - 25.04.2013

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...


Re: /report command help - jakejohnsonusa - 25.04.2013

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

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