SA-MP Forums Archive
Help - 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 (/showthread.php?tid=483764)



Help - Fjclip99 - 27.12.2013

Hi.
I have one problem.
I have a command /h(ouse) for putmoney, putdrugs, lock, info...
This is the part of the script:
Код:
     if(sscanf(params, "s[10]i", option,vrednost)) return SendCliientMessage...
     if(strcmp(option,"putmoney") == 0)
     {
      ...
     }
     if(strcmp(option,"info") == 0)
     {
     ...
     }
When i type command putmoney, putdrugs... i have to put /h putmoney [amount] this is OK
And when i type command lock, info... i have to put /h lock [amount]
Now, how can i make so that when i type commands lock, info... i dont have to put the "[amount]".

Thanks.


Re: Help - Fjclip99 - 28.12.2013

Anyone help ?


Re: Help - Fjclip99 - 04.01.2014

HELP ?


Re: Help - Fjclip99 - 07.02.2014

Can anyone help me ? Pleeease


Re: Help - Konstantinos - 07.02.2014

pawn Код:
if (!sscanf(params, "s[10]i", option, vrednost))
{
    if (!strcmp(option,"putmoney"))
    {
        ...
    }
    else if (!strcmp(option,"putdrugs"))
    {
        ...
    }
    else // send error message, valid options: putmoney, putdrugs
}
else if (!sscanf(params, "s[10]", option))
{
    if (!strcmp(option, "lock"))
    {
        ...
    }
    else if (!strcmp(option, "info"))
    {
        ...
    }
    else // send error message, valid options: lock, info
}
else // send usage..
or
pawn Код:
if (!sscanf(params, "s[10]i", option, vrednost))
{
    if (!strcmp(option, "putmoney"))
    {
        ...
    }
    else if (!strcmp(option, "putdrugs"))
    {
        ...
    }
    else // send error message, valid options: putmoney, putdrugs
}
else
{
    if (strlen(params))
    {
        if (!strcmp(params, "lock"))
        {
            ...
        }
        else if (!strcmp(params, "info"))
        {
            ...
        }
        else // send error message, valid options: lock, info
    }
    else // send usage..
}



Re: Help - Fjclip99 - 07.02.2014

Thanks, that works great