SA-MP Forums Archive
[HELP] /report Dialog - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] /report Dialog (/showthread.php?tid=204725)



[HELP] /report Dialog - ]B4E[kengston - 30.12.2010

Can some one make a Report Dialog for me? I have tired it, but it was fail -,-.
Please help me.


]B4E[kengston


Re: [HELP] /report Dialog - _rAped - 30.12.2010

/report that sends an message to the admins? What command base do you use? zcmd, dcmd or strcmp?


AW: [HELP] /report Dialog - ]B4E[kengston - 30.12.2010

I use strcmp. And yes, send the report only to the Admins.

Edit:
I already create an /report command but not in a Dialog.


AW: [HELP] /report Dialog - ]B4E[kengston - 04.01.2011

Can someone help me?? Please


Re: [HELP] /report Dialog - hanzen - 04.01.2011

pawn Код:
if(strcmp(cmd, "/report", true) == 0)
    {
        if(!CanUseCmd(PlayerInfo[playerid][pID], cmd)) return SendClientMessage(playerid, COLOR_LIGHTRED, ">> You are not eligible to use this command, because of misuse!");
        if(IsPlayerConnected(playerid))
        {
            if(Ticket[playerid] > 0)
            {
                SendClientMessage(playerid, COLOR_GRAD1, ">> You already have an open ticket with an admin, type /answer to talk to him.");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD1, ">> That's not the way, try: /report (message)");
                return 1;
            }
            SendClientMessage(playerid, COLOR_GRAD1, "Your report message has been sent to the admins online.");
            format(string, sizeof(string), "Report from [%d] %s: %s", playerid, sendername, (result));
            SendAdminMessage(COLOR_YELLOW2, string);
        }
        return 1;
    }
Assuming you got the colors defined and strtok() callback added.


Add this callback somewhere in your script.
pawn Код:
public SendAdminMessage(color, string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pAdmin] >= 1)
            {
                SendClientMessage(i, color, string);
            }
        }
    }
return 1;
}
I know the command could be much easier and cleaner with sscanf.


AW: [HELP] /report Dialog - ]B4E[kengston - 04.01.2011

I don't use idx and cmd...Do you think it works with inputtext?


Re: AW: [HELP] /report Dialog - hanzen - 04.01.2011

Quote:
Originally Posted by ]B4E[kengston
Посмотреть сообщение
I don't use idx and cmd...Do you think it works with inputtext?
Yup should work.


Re: [HELP] /report Dialog - hanzen - 04.01.2011

Should be something like this then:
pawn Код:
if(strcmp(cmd, "/report", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new sendername[MAX_PLAYER_NAME], string[256];
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SendClientMessage(playerid, COLOR_GRAD1, "Your report message has been sent to the admins online.");
            format(string, sizeof(string), "Report from [%d] %s: %s", playerid, sendername, cmdtext);
            SendAdminMessage(COLOR_YELLOW2, string);
        }
        return 1;
    }



Re: [HELP] /report Dialog - _rAped - 04.01.2011

Or you could just use ZCMD and sscanf.
pawn Код:
COMMAND:report(playerid, params[])
{
    new text[128], string[128], reportname[MAX_PLAYER_NAME];
    if(sscanf(params, "s[127]", text)) SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /report (message)");
    GetPlayerName(playerid, reportname, sizeof(reportname));
    format(string, sizeof(string), "Report from %s [%d]: %s ))", reportname, playerid, text);
    SendAdminMessage(0xFFF200, string);
    return 1;
}