optional parameters with sscanf
#5

This is an example of how it should be done:

pawn Код:
CMD:kick(playerid, params[])
{
    new targetid, reason[128], string[128], aname[MAX_PLAYER_NAME];
    if(sscanf(params, "uS(No Reason)[128]", targetid, reason)) return SendClientMessage(playerid, 0xAFAFAFAA, "Usage: /kick [id] [reason]");
    else
    {
        GetPlayerName(playerid, aname, sizeof(aname));
        //rest of code
        format(string, sizeof(string), "* Administrator %s has kicked %s, reason: %s", aname, targetid, reason);
        SendClientMessageToAll(COLOR_HERE, string)
    }
    return 1;
}
Reply


Messages In This Thread
optional parameters with sscanf - by jamjamnewbie - 22.05.2014, 13:12
Re: optional parameters with sscanf - by rappy93 - 22.05.2014, 13:14
Re: optional parameters with sscanf - by AndySedeyn - 22.05.2014, 13:21
Re: optional parameters with sscanf - by jamjamnewbie - 22.05.2014, 13:32
Re: optional parameters with sscanf - by AndySedeyn - 22.05.2014, 13:36
Re: optional parameters with sscanf - by jamjamnewbie - 22.05.2014, 13:39
Re: optional parameters with sscanf - by Konstantinos - 22.05.2014, 13:42
Re: optional parameters with sscanf - by AndySedeyn - 22.05.2014, 13:43

Forum Jump:


Users browsing this thread: 1 Guest(s)