Creating a command with multi parameters
#4

pawn Код:
CMD:test(playerid, cmdtext[])
{
    new sz_Param[30], sz_A_Param[30];

    if (sscanf(cmdtext, "s[30]S()[30]", sz_Param, sz_A_Param) )
    {
        SendClientMessage(playerid, -1, "/test parameter | parameter | parameter");
        return 1;
    }

    if (!strcmp(sz_Param, "parameter", true) ){
        new giveplayerid, amount;
        if (sscanf(sz_A_Param, "ud", giveplayerid, amount) )
        {
            SendClientMessage(playerid, -1, "/test parameter [ID/partofName] [amount]");
            return 1;
        }

    }

    else if (!strcmp(sz_Param, "parameter_two", true) ) {
        new Float:givefloat;
        if (sscanf(sz_A_Param, "f", givefloat) )
        {
            SendClientMessage(playerid, -1, "/test parameter_two [float]");
            return 1;
        }

    }

    return 1;
}
Here's a much simpler way of doing it.
Reply


Messages In This Thread
Creating a command with multi parameters - by OuDayas - 10.01.2019, 19:09
Re: Creating a command with multi parameters - by OuDayas - 10.01.2019, 23:48
Re: Creating a command with multi parameters - by Jefff - 11.01.2019, 01:43
Re: Creating a command with multi parameters - by Kane - 11.01.2019, 05:16

Forum Jump:


Users browsing this thread: 1 Guest(s)