4d Array? - 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 Array? (
/showthread.php?tid=641628)
4d Array? -
ToiletDuck - 18.09.2017
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
Re: 4d Array? -
Dayrion - 18.09.2017
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?
Re: 4d Array? -
Logic_ - 18.09.2017
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.