sscanf Help
#3

If you want definite results use sscanf like this.
pawn Код:
CMD:ban(playerid, params[])
{
    new pid, days, reason[128];
    if(sscanf(params, "uis[128]", pid, days, reason)) return SendClientMessage(playerid, 0xFF00FFFF, "Usage /ban <ID> <Days> <Reason>");
    ........
}
Ok well suppose you wanted your ban to work without days or a reason you can just do it like this then make some checks after to determine which gives a more specific result for instance.

pawn Код:
CMD:ban(playerid, params[])
{
    new pid, days, reason[128];
    sscanf(params, "uis[128]", pid, days, reason)
    if(days < 0) days = 1; // Default days
    ........
}
I prefer this method hands down.
Reply


Messages In This Thread
sscanf Help - by Rokzlive - 17.06.2013, 01:07
Re: sscanf Help - by park4bmx - 17.06.2013, 01:12
Re: sscanf Help - by Pottus - 17.06.2013, 01:14
Re: sscanf Help - by Rokzlive - 17.06.2013, 01:47

Forum Jump:


Users browsing this thread: 1 Guest(s)