SA-MP Forums Archive
y_iterate get an element by index - 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: y_iterate get an element by index (/showthread.php?tid=623786)



y_iterate get an element by index - X337 - 05.12.2016

Hello, i have this inside my code:
Код:
if(response)
{
	new l;
	foreach(new i : Drifts)
	{
		if(listitem == l)
		{
			g_SelectedOption[playerid] = i;
			Dialog_Show(playerid, "managedrift2", DIALOG_STYLE_LIST, g_Drift[i][drname], "Teleport to entrance\nDelete track", SELECT, CLOSE);
			return 1;
		}
		else
			l++;
	}
}
Is there any way to get an element by a number, so i can just insert like Drifts<index> or Drifts[index] to get an element from an iterator?
Thanks in advance.


Re: y_iterate get an element by index - Konstantinos - 05.12.2016

Not possible because values are stored differently every time.


Re: y_iterate get an element by index - X337 - 05.12.2016

Oh okay, thanks for the answer.