SSCANF help.
#2

pawn Код:
CMD:report(playerid, params[])
{
    if(!sscanf(params, "Us[128]", params[0], params[1]))
    {
        if(!params[0])
       {
              Reported{playerid} = true;
              format(ReportText[playerid], 128, "%s", params[1]);
              ReportPlayer[playerid] = INVALID_PLAYER_ID;
              SCMEx(playerid, COLOR_CYAN, "You have sent a report: %s", params[1]);
              format(mstr, sizeof(mstr), "The player %s[ID:%d] has reported: %s.", GetNameEx(playerid), playerid,                    params[1]);
              AdminsMSG(COLOR_LIGHTRED, mstr);
    }
    else if(params[0])
    {
        Reported{playerid} = true;
        format(ReportText[playerid], 128, "%s", params[1]);
        ReportPlayer[playerid] = id;
        SCMEx(playerid, COLOR_CYAN, "You have reported %s[ID:%d]: %s", GetNameEx(id), params[0], params[1]);
        format(mstr, sizeof(mstr), "> %s[ID:%d] reported %s[ID:%d]: %s.", GetNameEx(playerid), playerid, GetNameEx(params[0]), params[0], params[1]);
        AdminsMSG(COLOR_LIGHTRED, mstr);
    }
    else return SyntaxMSG(playerid, "/report (Optional[playerid]) [report text]");
    return 1;
}
I think that should work. Also check this:
https://sampforum.blast.hk/showthread.php?tid=120356
The part of optional specifiers.
Reply


Messages In This Thread
SSCANF help. - by PaulDinam - 24.06.2013, 04:36
Respuesta: SSCANF help. - by JustBored - 24.06.2013, 04:59
Re: SSCANF help. - by Pottus - 24.06.2013, 05:11

Forum Jump:


Users browsing this thread: 2 Guest(s)