SA-MP Forums Archive
DCMD + SSCANF Problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: DCMD + SSCANF Problem (/showthread.php?tid=231473)



DCMD + SSCANF Problem - Biesmen - 25.02.2011

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.


Re: DCMD + SSCANF Problem - randomkid88 - 25.02.2011

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;
}



Re: DCMD + SSCANF Problem - Biesmen - 25.02.2011

Nope, didn't work. :S