Foreach multi-iterator problem
#7

Код:
public ListPlayerItems(playerid)
{
	new list_items[2048], item_count = Iter_Count(PlayerItem[playerid]), item_weight, item_weight_sum;
	format(list_items, sizeof(list_items), "UID\tNazwa przedmiotu\tWaga\n \t» Funkcja zaznaczania\n \t» Przedmioty w pobliżu\n---\n");
	
	printf("ListPlayerItems[1]");
	foreach(new itemid : PlayerItem[playerid])
	{
	    printf("ListPlayerItems[2]: %d", itemid);
	    if(PlayerItemCache[playerid][itemid][iUID])
	    {
	        printf("ListPlayerItems[3]: %d", itemid);
	    	item_weight = GetPlayerItemWeight(playerid, itemid);
	    	if(PlayerItemCache[playerid][itemid][iUsed])
	    	{
				format(list_items, sizeof(list_items), "%s\n{FFFFFF}%d\t{C0C0C0}%s\t%dg", list_items, PlayerItemCache[playerid][itemid][iUID], PlayerItemCache[playerid][itemid][iName], item_weight);
			}
			else
			{
   			 	format(list_items, sizeof(list_items), "%s\n{C0C0C0}%d\t{C0C0C0}%s\t%dg", list_items, PlayerItemCache[playerid][itemid][iUID], PlayerItemCache[playerid][itemid][iName], item_weight);
			}

			item_weight_sum += item_weight;
			printf("ListPlayerItems[4]: %d", itemid);
  		}
	}

	printf("ListPlayerItems[5]");
	if(item_count > 0)
	{
		new title[256];
		
		format(title, sizeof(title), "Lista Twoich przedmiotуw [ilość: %d | suma wag: %dg]", item_count, item_weight_sum);
		ShowPlayerDialog(playerid, D_ITEM_USE, DIALOG_STYLE_TABLIST_HEADERS, title, list_items, "Użyj", "Opcje...");
	}
	else
	{
        TD_ShowSmallInfo(playerid, 5, "Nie posiadasz ~r~zadnych ~w~przedmiotow w ekwipunku.");
	}
	printf("ListPlayerItems[6]");
	return 1;
}
ServerLog:

Код:
[12:25:19] ListPlayerItems[1]
[12:25:19] ListPlayerItems[2]: 0
[12:25:19] ListPlayerItems[3]: 0
[12:25:19] ListPlayerItems[4]: 0
[12:25:19] ListPlayerItems[2]: 1
[12:25:19] ListPlayerItems[3]: 1
[12:25:19] ListPlayerItems[4]: 1
[12:25:19] ListPlayerItems[2]: 2
[12:25:19] ListPlayerItems[3]: 2
[12:25:19] ListPlayerItems[4]: 2
[12:25:19] ListPlayerItems[2]: 5
[12:25:19] ListPlayerItems[2]: 8
[12:25:19] ListPlayerItems[2]: 11
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
[12:25:19] ListPlayerItems[2]: 14
Looks like infinite looping. But why?

That's all is after using iter_saferemove of course in checking items.
Reply


Messages In This Thread
Foreach multi-iterator problem - by Dodus - 09.07.2016, 08:11
Re: Foreach multi-iterator problem - by Misiur - 09.07.2016, 08:35
Re: Foreach multi-iterator problem - by Dodus - 09.07.2016, 09:00
Re: Foreach multi-iterator problem - by Dodus - 09.07.2016, 09:07
Re: Foreach multi-iterator problem - by Dodus - 09.07.2016, 09:16
Re: Foreach multi-iterator problem - by Misiur - 09.07.2016, 10:21
Re: Foreach multi-iterator problem - by Dodus - 09.07.2016, 10:35
Re: Foreach multi-iterator problem - by Misiur - 09.07.2016, 11:04
Re: Foreach multi-iterator problem - by Dodus - 09.07.2016, 11:40
Re: Foreach multi-iterator problem - by Misiur - 09.07.2016, 11:59

Forum Jump:


Users browsing this thread: 1 Guest(s)