Help with this cmd.
#1

When I add the reason it doesnt show up.

pawn Код:
CMD:report(playerid, params[])
{
    new id, reason[128];
    new nameid[20];

    if(sscanf(params, "s[20]s[70]",nameid, reason))
    {

        SendClientMessage(playerid, COLOR_WHITE, "Use: It will report the selected player.");
        return SendClientMessage(playerid, COLOR_WHITE, "Usage: /Report [Name / ID] [Reason]");
    }
    if(ReturnUser(nameid,playerid) == -1)
    {
        return 1;
    }
    else
    {
        id = ReturnUser(nameid, playerid);
    }

//    if(id==playerid) return SendClientMessage(playerid,COLOR_WHITE,"You cannot report yourself!");
    if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"This player is not connected!");
    {
        new Name[MAX_PLAYER_NAME], ReportMessage[128];
        new Name2[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Name, sizeof(Name));
        GetPlayerName(id, Name2, sizeof(Name2));
        format(ReportMessage, sizeof(ReportMessage), "New Report From: %s [ID: %d] reported %s [ID: %d] [Reason: %s]", Name, playerid, Name2, id, ReportMessage);
        SendClientMessageToAdmins(COLOR_WHITE, ReportMessage);
        Report[playerid] = 1;
     }
    return 1;
}
Reply
#2

Untested:

pawn Код:
CMD:report(playerid, params[])
{
    new id, reason[128], sendername[MAX_PLAYER_NAME], receivername[MAX_PLAYER_NAME];
    if(sscanf(params, "us[128]", id, reason) == 0)
    {
        if(id != playerid)
        {
            if(strlen(reason) > 2)
            {
                new ReportMessage[256];
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GetPlayerName(id, receivername, sizeof(receivername));
                format(ReportMessage, sizeof(ReportMessage), "New Report From: %s [ID: %d] reported %s [ID: %d] [Reason: %s]", Name, playerid, Name2, id, ReportMessage);
                SendClientMessageToAdmins(COLOR_WHITE, ReportMessage);
                Report[playerid] = 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "Error - Your report was invalid. (Too short)");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "Error - You can't report yourself!");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [PlayerID/PartOfName] [Reason]");
        return 1;
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)