Command
#9

Код:
CMD:p(playerid, params[])
{
    new option[7];
    if(sscanf(params, "s[7]", option)) return SendClientMessage(playerid, -1, "Usage: /items [find/list].");
    if(strcmp(option,"find",true) == 0)
    {
        // code..
    }
    else if(strcmp(option,"list",true) == 0)
    {
        new dialog[512], item, amount, idx;
        while(GetPlayerItems(playerid, idx, item, amount)) // CHECK THIS FUNCTION, MAYBE RETURNS 0 OR SOMETHING.
        {
            format(dialog, 512, "%s%d x %s (ID:%d)\n", dialog, amount, GetItemName(item), item);
        }
        ShowPlayerDialog(playerid, DIALOG_ITEMSGUI, DIALOG_STYLE_LIST, "Items", dialog, "Select", "Close"); // CHECK FOR VALID ID.
    }
    else SendClientMessage(playerid, -1, "Bad option");
    return 1;
}
Check that the function GetPlayerItems and the dialogid returns a valid id. And I also recommend you not to put else just before return 1;

You can delete that else or put it at the beginning with a different syntax, for example, if(strcmp(...) != 0 && strcmp(...) != 0) return SOMETHING;
Reply


Messages In This Thread
Command - by cnoopers - 11.01.2014, 18:06
Re: Command - by cnoopers - 11.01.2014, 18:44
Re: Command - by AliveBG - 11.01.2014, 18:51
Re: Command - by Konstantinos - 11.01.2014, 18:51
Re: Command - by 1FreeHost - 11.01.2014, 18:51
Re: Command - by cnoopers - 11.01.2014, 18:58
Re: Command - by cnoopers - 11.01.2014, 19:59
Re: Command - by cnoopers - 11.01.2014, 21:14
Respuesta: Command - by Stront - 11.01.2014, 21:34

Forum Jump:


Users browsing this thread: 2 Guest(s)