4d Array?
#1

PS. This is only an Illustrator code
Код:
#define	MAX_OBJECT               100
#define     LIMIT_ANOTHERTEST   10
enum e_testinfo
{
	e_ObjectId,
	Float:e_ObjectPos[3]

};
new ObjectData[MAX_OBJECT][MAX_PLAYERS][e_testinfo];

enum anothertestinfo
{
	e_ObjectName[64],
        e_ObjectQuantity
};
new AnotherObjectData[MAX_OBJECT][MAX_PLAYERS][LIMIT_ANOTHERTEST][anothertestinfo]; // I need this to connect to enum e_TestInfo for looping and saving
but 4d Don't work :/ Is there any other way to solve this one? I'm out of idea instead doing
Код:
enum anothertestinfo
{
	e_ObjectName1[64],
        e_ObjectQuantity1,
        e_ObjectName2[64],
        e_ObjectQuantity2,
        e_ObjectName3[64],
        e_ObjectQuantity3,
       e_Object......
       e_Object.....
};
new AnotherObjectData[MAX_OBJECT][MAX_PLAYERS][anothertestinfo]; 
// then use it like
for(new x = 0; x < MAX_OBJECT; x ++)
{
       format(AnotherObjectData[x][playerid][e_ObjectName1], 64, "Nothing");
       AnotherObjectData[x][playerid][e_ObjectQuantity1] = 0;
.... 10 Codes of AnotherObjectData[x][playerid][e_ObjectName1] // This structured slowing my compiler.
}
I just need to do like this
Код:
for(new loop = 0; loop < 10; loop++)
{
       for(new x = 0; x < MAX_OBJECT; x ++)
      { // 
             format(AnotherObjectData[x][playerid][loop][e_ObjectName], 64, "Nothing"); // something like this
             AnotherObjectData[x][playerid][loop][e_ObjectQuantity] = 0;
      }
}
PS. I know that my coding flaw is sux I hope you guys understand what I'm trying to say
Reply
#2

This more like a 5D array which is pretty bad.
What are you trying to do? Why every objets need to indexed with every players?
Reply
#3

Prepare some outlines on how you want your code to be, how you want your code to work like, and think of an appropriate manner of writing the code. After you're done with it, go ahead to writing your code and come back here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)