11.01.2014, 21:34
Код:
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; }
You can delete that else or put it at the beginning with a different syntax, for example, if(strcmp(...) != 0 && strcmp(...) != 0) return SOMETHING;