Help with YCMD and SSCANF!
#1

Hello, I want a command like this:

pawn Код:
YCMD:sell(playerid, params[], pHELPS)
{
    new Fun[12];

    if(sscanf(params, "s[12]", Fun))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "USE: /sell [drug/medicament]");
        return 1;
    }
    if(!strcmp(Fun, "drug"))
    {
        new qnt, vlr;

        if(sscanf(params, "dd", qnt, vlr))
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "USE: /sell [drug] [amount] [price]");
            return 1;
        }
        SendPlayerMessage(playerid, 0xFFFFFFFF, "test %d - %d :D", qnt, vlr);
        return 1;
    }
    if(!strcmp(Fun, "medicament"))
    {
        new qnt, vlr;

        if(sscanf(params, "dd", qnt, vlr))
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "USE: /sell [medicament] [amount] [price]");
            return 1;
        }
        SendPlayerMessage(playerid, 0xFFFFFFFF, "test %d - %d uhuuuu", qnt, vlr);
        return 1;
    }
    return 1;
}
However, the command I did above does not work. Could someone fix for me?

Thank you very much!
Reply
#2

What part is not working? We cant help unless we know what exactly is wrong
Reply
#3

If I type /sell drug 1 5 nothing happens. The parameters are not recognized. The message is not displayed in SendPlayerMessage ... ie, the "secondary" sscanf is not working.

Even if I enter only one parameter (/sell drugs 1) it does not return an error message requiring the second parameter.
Reply
#4

YCMDell(playerid, params[], help)
Reply
#5

The "help" parameter you can change to anything you like. I use more than 80 commands with "pHelps".

Please, help me with sscanf
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)