SA-MP Forums Archive
Help with YCMD and SSCANF! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with YCMD and SSCANF! (/showthread.php?tid=488662)



Help with YCMD and SSCANF! - SuperChock - 18.01.2014

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!


Re: Help with YCMD and SSCANF! - Blademaster680 - 18.01.2014

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


Re: Help with YCMD and SSCANF! - SuperChock - 18.01.2014

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.


Re: Help with YCMD and SSCANF! - Scrillex - 18.01.2014

YCMDell(playerid, params[], help)


Re: Help with YCMD and SSCANF! - SuperChock - 19.01.2014

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

Please, help me with sscanf