error 047: array sizes do not match, or destination array is too small warning 219: local variable "idx" shadows a variable at a preceding level
if(!strcmp(cmdtext, "/p", true)) { new idx,option[128]; option = strtok(cmdtext, idx); if(!strlen(option)) { SendClientMessage(playerid, -1, "Użyj: /p [szukaj/lista]."); } else if(strcmp(option,"szukaj",true) == 0) { } else if(strcmp(option,"lista",true) == 0) { new dialog[512]; new idx, item, amount; while(GetPlayerItems(playerid, idx, item, amount)) { format(dialog, 512, "%s%d x %s (ID:%d)\n", dialog, amount, GetItemName(item), item); } ShowPlayerDialog(playerid, DIALOG_ITEMSGUI, DIALOG_STYLE_LIST, "Przedmioty", dialog, "Wybierz", "Zamknij"); } else { SendClientMessage(playerid, -1, "Niepoprawna opcja."); //bad option msg } return 1; }
new option[128];
option = strtok(cmdtext, idx);
//rest of code...
//...
enum example[5]//5 might be to small or to big depending on what you are using it for.
{
blabla,
blabla1
}
error 047: array sizes do not match, or destination array is too small
new idx,option[128];
when i change it to 256 its good, but isnt optimal. what can i do?
|
if(!strcmp(cmdtext, "/p", true)) { new idx,option[256]; option = strtok(cmdtext, idx); if(!strlen(option)) { SendClientMessage(playerid, -1, "Użyj: /p [szukaj/lista]."); } else if(strcmp(option,"szukaj",true) == 0) { } else if(strcmp(option,"lista",true) == 0) { new dialog[512]; new item, amount; while(GetPlayerItems(playerid, idx, item, amount)) { format(dialog, 512, "%s%d x %s (ID:%d)\n", dialog, amount, GetItemName(item), item); } ShowPlayerDialog(playerid, DIALOG_ITEMSGUI, DIALOG_STYLE_LIST, "Przedmioty", dialog, "Wybierz", "Zamknij"); } else { SendClientMessage(playerid, -1, "Niepoprawna opcja."); } return 1; }
if(!strcmp(cmdtext, "/p", true))
{
new option[7];
if(sscanf(cmdtext, "s[7]", option)) return SendClientMessage(playerid, -1, "Użyj: /p [szukaj/lista].");
if(strcmp(option,"szukaj",true) == 0)
{
// code..
}
else if(strcmp(option,"lista",true) == 0)
{
new dialog[512], item, amount;
while(GetPlayerItems(playerid, idx, item, amount))
{
format(dialog, 512, "%s%d x %s (ID:%d)\n", dialog, amount, GetItemName(item), item);
}
ShowPlayerDialog(playerid, DIALOG_ITEMSGUI, DIALOG_STYLE_LIST, "Przedmioty", dialog, "Wybierz", "Zamknij");
}
else SendClientMessage(playerid, -1, "Niepoprawna opcja.");
return 1;
}