/report command???
#1

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
Reply
#2

for the "us" remove the [256]
Reply
#3

i will try that.

EDIT:

not really... just screw it.. i dont need it no more.
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)