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



/report command??? - sciman001 - 23.04.2011

Hi all... i made this command:

pawn Код:
COMMAND:report(playerid, params[])
{
    new id, str[256];
    if(sscanf(params, "us[256]", id, str))
    {
        if(IsPlayerConnected(id))
        {
            new name[12], pname[12];
            GetPlayerName(playerid, name, sizeof(name));
            GetPlayerName(playerid, pname, sizeof(pname));
            format(str, sizeof(str), "%s: %s_%s", name, pname, str);
            for(new slots = GetMaxPlayers(), i; i<slots; i++)
            {
                if(IsPlayerConnected(i) && IsPlayerAdmin(i))
                {
                    SCM(i, COLOR_RED, str);
                }
            }
        }
        else return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected");
    }
    else return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /report <playerid> <message>");
    return 1;
}
It gets no errors and the plugin DOES load. But when i /report it doesnt work. WHAT TO DO


Re: /report command??? - Tommy_Mandaz - 23.04.2011

for the "us" remove the [256]


Re: /report command??? - sciman001 - 23.04.2011

i will try that.

EDIT:

not really... just screw it.. i dont need it no more.


Re: /report command??? - Seven_of_Nine - 23.04.2011

pawn Код:
COMMAND:report(playerid,params[]) {
    new
        name1[30],
        name2[30],
        id,
        text[128],
        reason[50];
    if(sscanf(params,"us",id,reason))
        return SendClientMessage(playerid,red,"USAGE: /report [id] [reason]");
    if(IsPlayerConnected(id)) {
        SendClientMessage(playerid,yellow,"Your report has been sent to online admins.");
        for(new i = 0; i < MAX_PLAYERS; ++i) {
            if(IsPlayerConnected(i) && !IsPlayerNPC(i) && IsPlayerAdmin(i)) {
            GetPlayerName(playerid,name1,sizeof(name1));
            GetPlayerName(id,name2,sizeof(name2));
            new Hour,Minute,Second;
            gettime(Hour,Minute,Second);
            format(text,sizeof(text),"|| %d:%d:%d || [Report] | \"%s\" [%i] has reported \"%s\" [%i], reason: %s.",Hour,Minute,Second,name1,playerid,name2,id,reason);
            SendClientMessage(i,COLOR_WHITE,text);
            }
        }
    } else {
        return SendClientMessage(playerid,red,"Invalid ID");
    }
    return 1;
}
This should work

EDIT: you need to define COLOR_WHITE...