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



/report need help - grizzley - 27.10.2013

For now, players can spam /report to admins. Can someone help me how to make it delay for a minute?

and admin like /acceptreport and then it will show "Hello, my name is *playername* (ID: #), I'm helping you now" to player that /report

thanks

here's the pwn

pawn Код:
CMD:report(playerid, params[])
{
    new string[128];
    new reporter[MAX_PLAYER_NAME];
    GetPlayerName(playerid, reporter, sizeof(reporter));
    if(!sscanf(params, "s[128]", string))
    {
        SendClientMessage(playerid, COLOR_YELLOW, "Report Anda telah dikirim kepada Admin.");
        if(PlayerInfo[playerid][pAdmin] >= 2)
        {
            if(strlen(string) > 65)
            {
                new string2[63], string3[65];
                strmid(string2, string, 65, strlen(string), 63);
                strmid(string3, string, 0, 65, 65);
                strdel(string, 80, strlen(string));
                format(string, sizeof(string), "Report from %s (ID: %d) %s ... ", reporter, playerid, string3);
                SendToAdmin(COLOR_ORANGE, string);
                format(string, sizeof(string), "Report from %s (ID: %d) ... %s ", reporter, playerid, string2);
                SendToAdmin(COLOR_ORANGE, string);
            }
            else
            {
                format(string, sizeof(string), "Report from %s (ID: %d): %s", reporter, playerid, params);
                SendToAdmin(COLOR_ORANGE, string);
            }
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "PENGGUNAAN: /report [text]");
    }
    return 1;
}



Re: /report need help - mrtms - 27.10.2013

https://sampwiki.blast.hk/wiki/SetTimerEx


Re: /report need help - grizzley - 27.10.2013

Can you give me an example please?


Re: /report need help - mrtms - 27.10.2013

First create a variable like

new bool:reporting[MAX_PLAYERS];

When they do the /report set the:
reporting[playerid] = true;

Add this inside where you want your timer to be at
SetTimerEx("ReportEnabled", 15000, false, "i", playerid);

Then outside
forward ReportEnabled(playerid);
public ReportEnabled(playerid) {
reporting[playerid] = false;
}


Re: /report need help - grizzley - 27.10.2013

I confused, can you make it for me.. or explain more detail please?


Re: /report need help - Pottus - 27.10.2013

No not SetTimerEx() crazy scripters....

pawn Код:
new ReportTime[MAX_PLAYERS];

CMD:report(playerid, params[])
{
    if(gettime() - ReportTime[playerid] > 60)
    {
        new string[128];
        new reporter[MAX_PLAYER_NAME];
        GetPlayerName(playerid, reporter, sizeof(reporter));
        if(!sscanf(params, "s[128]", string))
        {
            SendClientMessage(playerid, COLOR_YELLOW, "Report Anda telah dikirim kepada Admin.");
            if(PlayerInfo[playerid][pAdmin] >= 2)
            {
                if(strlen(string) > 65)
                {
                    new string2[63], string3[65];
                    strmid(string2, string, 65, strlen(string), 63);
                    strmid(string3, string, 0, 65, 65);
                    strdel(string, 80, strlen(string));
                    format(string, sizeof(string), "Report from %s (ID: %d) %s ... ", reporter, playerid, string3);
                    SendToAdmin(COLOR_ORANGE, string);
                    format(string, sizeof(string), "Report from %s (ID: %d) ... %s ", reporter, playerid, string2);
                    SendToAdmin(COLOR_ORANGE, string);
                }
                else
                {
                    format(string, sizeof(string), "Report from %s (ID: %d): %s", reporter, playerid, params);
                    SendToAdmin(COLOR_ORANGE, string);
                }
                ReportTime[playerid] = gettime();
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "PENGGUNAAN: /report [text]");
        }
    }
    else SendClientMessage(playerid, COLOR_GREY, "You must wait a minute before sending another report");
    return 1;
}



Re: /report need help - grizzley - 27.10.2013

Thank you very much! repped

Can you help me with the second one?
admin to /acceptreport and then it will show "Hello, my name is *playername* (ID: #), I'm helping you now" to player that /report