Two things about DCMD
#1

Hello

I have decided to check out dcmd and I have got two questions about it.

1. Is it possible to add two commands which do the same thing? Like normally you do:
Код:
if(strcmp(cmd, "/something", true) == 0 || strcmp(cmd, "/somethingelse", true) == 0)
But is i possible to do something like that with dcmd?

2. Another thing is about commands with more than one parameter. For example I would like to do command /give which would have options something and somethingelse and it would affect selected player id (/give [option] [playerid])
Normally you would do something like that:
pawn Код:
if(strcmp(cmd, "/give", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
              new x_nr[256];
                    x_nr = strtok(cmdtext, idx);
                    if(!strlen(x_nr)) {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /give [item] [playerid]");
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ITEM:] something, somethingelse");
                        return 1;
                    }
                  if(strcmp(x_nr,"something",true) == 0)
                    {
                      tmp = strtok(cmdtext, idx);
                        if(!strlen(tmp)) {
                            SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /give something [playerid]");
                            return 1;
                        }
                        giveplayerid = ReturnUser(tmp);
                        if(IsPlayerConnected(giveplayerid))
                        {
// and other stuff
As you can see, when I write only '/give something' it shows me different message as when I write only '/give.' If I use sscanf with dcmd and I write only '/give something' it will still show me the first message until I fill out all the parameters.
So how could I make that when I fill up only one parameter it will already show me the message I choose?

Thanks for help
Reply


Messages In This Thread
Two things about DCMD - by Sergei - 07.08.2009, 22:55
Re: Two things about DCMD - by MadeMan - 07.08.2009, 23:11
Re: Two things about DCMD - by Sergei - 07.08.2009, 23:24
Re: Two things about DCMD - by MadeMan - 07.08.2009, 23:28
Re: Two things about DCMD - by Sergei - 07.08.2009, 23:31
Re: Two things about DCMD - by Ez - 08.08.2009, 01:06
Re: Two things about DCMD - by ruarai - 08.08.2009, 01:48
Re: Two things about DCMD - by Sergei - 08.08.2009, 06:34

Forum Jump:


Users browsing this thread: 2 Guest(s)