SA-MP Forums Archive
Which option to use? - 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: Which option to use? (/showthread.php?tid=660673)



Which option to use? - darkHero - 10.11.2018

Option 1:

Код:
enum einv
{
	inv,
	amount
};
new Inventory[MAX_PLAYERS][15][einv];
Option 2:

Код:
enum einv
{
	inv,
	amount
};
new Inventory[MAX_PLAYERS][einv][15];
Option 3:

Код:
enum einv
{
	inv[15],
	amount[15]
};
new Inventory[MAX_PLAYERS][einv];
Option 4:

Код:
new InventoryItem[MAX_PLAYERS][15];
new InventoryAmount[MAX_PLAYERS][15];



Re: Which option to use? - AlfaSufaIndo - 10.11.2018

Option 3


Re: Which option to use? - Blackaslan - 10.11.2018

Option 4


Re: Which option to use? - robibacsika - 10.11.2018

Option 4


Re: Which option to use? - khRamin78 - 10.11.2018

there is no different between option 2 and 4 just clearness and memory


Re: Which option to use? - khRamin78 - 10.11.2018

Quote:
Originally Posted by ******
Посмотреть сообщение
That is quite obviously wrong, just from looking at the code! Did you mean 2 and 3?

enums are a convenience - they make code look slightly cleaner at the expense of some speed. So there is no “best” answer, it depends on whether you prefer cleanliness (3) or speed (4).
tnx for info and i meant 3 and 4 ye i told that different in speed and memory i meant that