Command not working
#1

The part that is wrong at the moment is when I type "test" ir displays "Server unkown command" and nothing appears.
Code:
pawn Код:
CMD:test(playerid,params[])
{
    for(new pItems:i; i < pItems; i++)
    {
        if(PlayerItems[playerid][i] > 0)
        {
            format(itemLine,sizeof(itemLine),"(%d) \t%s\n",PlayerItems[playerid][i], ReturnItemNameFromID(i));
            strcat(dialogLines,itemLine);
        }
    }
    ShowPlayerDialog(playerid,DIALOG_INV,DIALOG_STYLE_LIST,"Inventorius",dialogLines,"Naudoti","Atsaukti");
}
Reply
#2

If you're using zcmd (and it seems that you are), it will return the return value of the fired CallLocalFunction callback in the OnPlayerCommandText callback. If this is not 1, that error will appear.

Solution: return true to your command!
Reply
#3

I Agree with AndreT

Try This Code

pawn Код:
CMD:test(playerid,params[])
{
    for(new pItems:i; i < pItems; i++)
    {
        if(PlayerItems[playerid][i] > 0)
        {
            format(itemLine,sizeof(itemLine),"(%d) \t%s\n",PlayerItems[playerid][i], ReturnItemNameFromID(i));
            strcat(dialogLines,itemLine);
        }
    }
    ShowPlayerDialog(playerid,DIALOG_INV,DIALOG_STYLE_LIST,"Inventorius",dialogLines,"Naudoti","Atsaukti");
    return 1;
}
Reply
#4

So i added return 1; and I still get the error,and nothing happens!
Reply
#5

try to return false or 0 on the callback of OnPlayerCommandText

Something like this

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    return 0;
}
PS: Do you you use any filterscript that uses strcmp or dcmd command proccesor?
Reply
#6

return 0;,exists there. No i don't.

This is the only command that has this problem! And the only one that doesn't work
Reply
#7

Show the eror please..
Reply
#8

No errors while compiling, only "unknown command" IG
Reply
#9

I haved looked and configured for 2 minutes why. so i saw that. your showing the dialog after those 2 brackets
so try the command that i did

pawn Код:
CMD:test(playerid,params[])
{
    for(new pItems:i; i < pItems; i++)
    {
        if(PlayerItems[playerid][i] > 0)
        {
            format(itemLine,sizeof(itemLine),"(%d) \t%s\n",PlayerItems[playerid][i], ReturnItemNameFromID(i));
            strcat(dialogLines,itemLine);
        }
    }
    return ShowPlayerDialog(playerid,DIALOG_INV,DIALOG_STYLE_LIST,"Inventorius",dialogLines,"Naudoti","Atsaukti");
}
Reply
#10

didn't change anything,pds
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)