SA-MP Forums Archive
Command 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)
+--- Thread: Command problem (/showthread.php?tid=395269)



Command problem - Amine_Mejrhirrou - 25.11.2012

What's the problem with this ?
if any one can send me an example of cmd like that thatwill help me to fix my errors thnks
Код:
    if(strcmp(cmd, "/craft", true) == 0)
    {
        new choice[32];
        if(strcmp(strtok, "s[32]", choice))
        {
            SendClientMessage(playerid, DENN, "[SERVER] Usage: /craft [bate/knife]");
            return 1;
        }
        if(strcmp(choice, "bate", true) == 0)
        {
//blabla
        return 1;
        }
        else if(strcmp(choice, "knife", true) == 0)
        {
//bla bla
        return 1;
        }
        return 1;
    }



Re: Command problem - Nordic - 25.11.2012

try this

Код:
    if(strcmp(cmd, "/craft", true) == 0)
    {
        new choice[32];
        choice = strtok(cmdtext, [the index variable u used earlier]);
        if(!strlen(choice))
        {
            SendClientMessage(playerid, DENN, "[SERVER] Usage: /craft [bate/knife]");
            return 1;
        }
        if(strcmp(choice, "bate", true) == 0)
        {
                  //blabla
                  return 1;
        }
        else if(strcmp(choice, "knife", true) == 0)
        {
                 //bla bla
        }
        return 1;
    }