SA-MP Forums Archive
Annoying "Server:Unknown commad: - 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: Annoying "Server:Unknown commad: (/showthread.php?tid=431352)



Annoying "Server:Unknown commad: - SkizzoTrick1 - 17.04.2013

I know it is a silly question but i just can't find what i've done wrong...maybe i am tired.
here is the code:
pawn Код:
if (strcmp("/opendoor", cmdtext, true, 10) == 0)
    {
        if(AL(playerid) >= 5 || FR(playerid, 3, 1, 2) == 1)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /opendoor <NUMBER>"); return 1; }
            new id = strval(tmp);

            if(id == 1){
                MoveDynamicObject(door1, 1163.458374, -1322.698486,1386.884888,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 1 is open !");
            }
            if(id == 2){
                MoveDynamicObject(door2, 1151.116577, -1319.286621, 1386.996338,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 2 is open !");
            }
            if(id == 3){
                MoveDynamicObject(door4,1148.669922, -1307.760986, 1386.799072, 0.8);
                MoveDynamicObject(door3,1152.505493, -1307.765869, 1386.817383, 0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 3 is open !");
            }
        }
        else SendClientMessage(playerid, COLOR_WHITE, "You are not a member of LSMD!");
        return 1;
    }
    if (strcmp("/closedoor", cmdtext, true, 11) == 0)
    {
        if(AL(playerid) >= 5 || FR(playerid, 3, 1, 2) == 1)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /closedoor <NUMBER>"); return 1; }
            new id = strval(tmp);

            if(id == 1){
                MoveDynamicObject(door1, 1163.458374, -1326.698486,1386.884888,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 1 is closed !");
            }
            else if(id == 2){
                MoveDynamicObject(door2, 1157.116577, -1319.286621, 1386.996338,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 2 is closed !");
            }
            else if(id == 3){
                MoveDynamicObject(door4, 1151.669922, -1307.760986, 1386.799072, 0.8);
                MoveDynamicObject(door3, 1149.505493, -1307.765869, 1386.817383, 0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 3 is closed !");
            }
            else SendClientMessage(playerid, COLOR_WHITE, "Wrong number");
        }
        else SendClientMessage(playerid, COLOR_WHITE, "You are not a member of LSMD!");
        return 1;
    }
i keep getting "Server:Unknown Command" InGame.


Re: Annoying "Server:Unknown commad: - IstuntmanI - 17.04.2013

https://sampwiki.blast.hk/wiki/Debugging


Re: Annoying "Server:Unknown commad: - Necip - 17.04.2013

Try:

pawn Код:
if (strcmp("/opendoor ", cmdtext, true, 10) == 0)
    {
        if(AL(playerid) >= 5 || FR(playerid, 3, 1, 2) == 1)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /opendoor <NUMBER>"); return 1; }
            new id = strval(tmp);

            if(id == 1){
                MoveDynamicObject(door1, 1163.458374, -1322.698486,1386.884888,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 1 is open !");
            }
            if(id == 2){
                MoveDynamicObject(door2, 1151.116577, -1319.286621, 1386.996338,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 2 is open !");
            }
            if(id == 3){
                MoveDynamicObject(door4,1148.669922, -1307.760986, 1386.799072, 0.8);
                MoveDynamicObject(door3,1152.505493, -1307.765869, 1386.817383, 0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 3 is open !");
            }
        }
        else SendClientMessage(playerid, COLOR_WHITE, "You are not a member of LSMD!");
        return 1;
    }
    if (strcmp("/closedoor ", cmdtext, true, 11) == 0)
    {
        if(AL(playerid) >= 5 || FR(playerid, 3, 1, 2) == 1)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /closedoor <NUMBER>"); return 1; }
            new id = strval(tmp);

            if(id == 1){
                MoveDynamicObject(door1, 1163.458374, -1326.698486,1386.884888,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 1 is closed !");
            }
            else if(id == 2){
                MoveDynamicObject(door2, 1157.116577, -1319.286621, 1386.996338,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 2 is closed !");
            }
            else if(id == 3){
                MoveDynamicObject(door4, 1151.669922, -1307.760986, 1386.799072, 0.8);
                MoveDynamicObject(door3, 1149.505493, -1307.765869, 1386.817383, 0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 3 is closed !");
            }
            else SendClientMessage(playerid, COLOR_WHITE, "Wrong number");
        }
        else SendClientMessage(playerid, COLOR_WHITE, "You are not a member of LSMD!");
        return 1;
    }
What you did wrong was the space.You didn't leave space on /opendoor and /closedoor


Re: Annoying "Server:Unknown commad: - HurtLocker - 17.04.2013

Did you put that inside public OnPlayerCommandText?


Re: Annoying "Server:Unknown commad: - SkizzoTrick1 - 17.04.2013

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
Did you put that inside public OnPlayerCommandText?
Yes.


Re: Annoying "Server:Unknown commad: - SkizzoTrick1 - 17.04.2013

Quote:
Originally Posted by Necip
Посмотреть сообщение
Try:

pawn Код:
if (strcmp("/opendoor ", cmdtext, true, 10) == 0)
    {
        if(AL(playerid) >= 5 || FR(playerid, 3, 1, 2) == 1)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /opendoor <NUMBER>"); return 1; }
            new id = strval(tmp);

            if(id == 1){
                MoveDynamicObject(door1, 1163.458374, -1322.698486,1386.884888,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 1 is open !");
            }
            if(id == 2){
                MoveDynamicObject(door2, 1151.116577, -1319.286621, 1386.996338,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 2 is open !");
            }
            if(id == 3){
                MoveDynamicObject(door4,1148.669922, -1307.760986, 1386.799072, 0.8);
                MoveDynamicObject(door3,1152.505493, -1307.765869, 1386.817383, 0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 3 is open !");
            }
        }
        else SendClientMessage(playerid, COLOR_WHITE, "You are not a member of LSMD!");
        return 1;
    }
    if (strcmp("/closedoor ", cmdtext, true, 11) == 0)
    {
        if(AL(playerid) >= 5 || FR(playerid, 3, 1, 2) == 1)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /closedoor <NUMBER>"); return 1; }
            new id = strval(tmp);

            if(id == 1){
                MoveDynamicObject(door1, 1163.458374, -1326.698486,1386.884888,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 1 is closed !");
            }
            else if(id == 2){
                MoveDynamicObject(door2, 1157.116577, -1319.286621, 1386.996338,0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 2 is closed !");
            }
            else if(id == 3){
                MoveDynamicObject(door4, 1151.669922, -1307.760986, 1386.799072, 0.8);
                MoveDynamicObject(door3, 1149.505493, -1307.765869, 1386.817383, 0.8);
                SendClientMessage(playerid, COLOR_WHITE,"Door 3 is closed !");
            }
            else SendClientMessage(playerid, COLOR_WHITE, "Wrong number");
        }
        else SendClientMessage(playerid, COLOR_WHITE, "You are not a member of LSMD!");
        return 1;
    }
What you did wrong was the space.You didn't leave space on /opendoor and /closedoor
Sorry for doubleposting but this is solved.
Thank you, that was the problem.