DCMD + SSCANF Problem
#1

I'm using DCMD + SSCANF to make some kind of sections in a command.
Somehow, this doesn't work. I had posted this problem earlier, but I changed method now.

This is the command:

pawn Код:
dcmd_test(playerid, params[])
{
        new select[31], select2[31];
        if(sscanf(params, "s[31]s[31]", select, select2))
        {
            SendClientMessage(playerid, COLOR_WHITE, "Usage: /test [Take/Place] [Stuff]");
            SendClientMessage(playerid, COLOR_WHITE, "Available stuff: Money, Weapon");
            return 1;
        }
  if(strcmp(select,"place", true) == 0)
  {
    if(strcmp(select2,"weapon",true) == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "WEAPONSS :D");
        return 1;
    }
 }
 return 1;
}
It doesn't go further than the "USAGE" part.
Reply
#2

Try putting your strcmp's under an "else" statement. Like so:
pawn Код:
dcmd_test(playerid, params[])
{
        new select[31], select2[31];
        if(sscanf(params, "s[31]s[31]", select, select2))
        {
            SendClientMessage(playerid, COLOR_WHITE, "Usage: /test [Take/Place] [Stuff]");
            SendClientMessage(playerid, COLOR_WHITE, "Available stuff: Money, Weapon");
            return 1;
        }
        else
        {  
               if(strcmp(select,"place", true) == 0)
              {
                     if(strcmp(select2,"weapon",true) == 0)
                     {
                            SendClientMessage(playerid, COLOR_RED, "WEAPONSS :D");
                            return 1;
                       }
                }
           }
 return 1;
}
Reply
#3

Nope, didn't work. :S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)