SA-MP Forums Archive
4D Arrays - A possible way to sort them out? - 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: 4D Arrays - A possible way to sort them out? (/showthread.php?tid=483994)



4D Arrays - A possible way to sort them out? - Lordzy - 28.12.2013

Hello everyone,

I've been thinking to code something recently and now I'm in a difficult state in declaring some arrays. I don't know what, my mind is too blank right now in trying to sort this out. I'm trying to group a player's data - For example, a simple template message storage.
pawn Код:
#define MAX_TEMPLATE_TYPES  5 //Type of templates.
#define MAX_TEMPLATES 10 //Number of templates which each TYPE of templates could have.


new pExample[MAX_PLAYERS][MAX_TEMPLATE_TYPES][MAX_TEMPPLATES][128];
So what I really need is per-player templates, in such a way that there's a type of template while creating and 10 templates could be stored for each template type. Unfortunately, 4D arrays aren't supported and I couldn't find any methods to sort things out. If anyone would be able to clear this out, it'd be really good for me.

Thanks in advance.


Re: 4D Arrays - A possible way to sort them out? - xeeZ - 28.12.2013

Nothing stops you from doing this:

pawn Код:
new pExample[MAX_PLAYERS][MAX_TEMPLATE_TYPES * MAX_TEMPPLATES][128];



Re: 4D Arrays - A possible way to sort them out? - Lordzy - 29.12.2013

Quote:
Originally Posted by xeeZ
Посмотреть сообщение
Nothing stops you from doing this:

pawn Код:
new pExample[MAX_PLAYERS][MAX_TEMPLATE_TYPES * MAX_TEMPPLATES][128];
Thanks, it works well now.