sscanf parameter help
#1

I can't remember how to do this or what to look up to figure out how to do this, but how do you make a command that has a "parameter tree" (idk what to call it)

pawn Код:
//example of what i mean
CMD:example(playerid,params[])
{
    new param1[128],param2;
    if(sscanf(params,"s[128]i",param1)) return SendClientMessage(playerid,-1,"example text");
    if(!strcmp(param1,"sometext",true))
    {
        if(sscanf(params,"s[128]i",param1,param2)) return SendClientMessage(playerid,-1,"example text 2");  //this is what I mean by "parameter tree"
        //code here
    }
}
I hope that what I'm asking isn't too confusing, I just don't know what it would be called.
Reply
#2

If this one help you to understand :
PHP код:
CMD:set(playeridparams[])
{
    if(
pAccount[playerid][pAdmin] < ADMIN) return ErrorMsg(playeridfalse);
    new
        
parametre[30+'\0'],
        
scmd[50];

    if(
sscanf(params"s[30]S()[130]"parametrescmd)) return SCM(playeridLBLUE"/set [money - score - kills - death - skin - vhp - hp - armor - v(irtual)w(orld) - int(erior)]");

    if(!
strcmp(parametre"money"))
    {
        if(
pAccount[playerid][pAdmin] < SADMIN) return ErrorMsg(playeridfalse);

        new 
cible,
            
money;

        if(
sscanf(scmd"ui"ciblemoney)) return SCM(playeridLBLUE"/set money [playerid/name] [montant]");

        if(!
IsPlayerConnected(cible))
            return 
ErrorMsg(playerid_"Ce personne n'est pas connectйe.");

        
GivePlayerMoney(cibleGetPlayerMoney(cible) + money);
        if(
money 0
            return 
InfoAnnonce(cible"%i$ on йtй crйditйs sur votre agent de poche."money);
        else
            return 
InfoAnnonce(cible"%i$ ont йtй retirйs de votre argent de poche."0-money);
    } 
Reply
#3

By wrapping around arguments in curly braces "{}". It will ignore each data type with the curly braces around them.
Reply
#4

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
By wrapping around arguments in curly braces "{}". It will ignore each data type with the curly braces around them.
All the arguments or just the initial argument?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)