SA-MP Forums Archive
Command not working - 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 not working (/showthread.php?tid=419624)



Command not working - dusk - 01.03.2013

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



Re: Command not working - AndreT - 01.03.2013

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!


Re: Command not working - Patrick - 01.03.2013

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



Re: Command not working - dusk - 01.03.2013

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


Re: Command not working - Patrick - 01.03.2013

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?


Re: Command not working - dusk - 01.03.2013

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


Re: Command not working - Kenway - 01.03.2013

Show the eror please..


Re: Command not working - dusk - 01.03.2013

No errors while compiling, only "unknown command" IG


Re: Command not working - Patrick - 01.03.2013

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



Re: Command not working - dusk - 01.03.2013

didn't change anything,pds