SA-MP Forums Archive
Multidimensional array error ( 3D ) - 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: Multidimensional array error ( 3D ) (/showthread.php?tid=455024)



Multidimensional array error ( 3D ) - saamp - 31.07.2013

pawn Код:
// Top of the script
enum mE
{
    Float:POS[3],
    Int
}
new TD[MAX_PLAYERS][mE][5];

// OnGameModeInit
TD[0][POS[0]][0] = 1.0; // error 028: invalid subscript (not an array or too many subscripts): "POS"



Re: Multidimensional array error ( 3D ) - Konstantinos - 31.07.2013

I'm not sure for the last array. It'd be:
pawn Код:
TD[0/*playerid*/][POS][0][0] = 1.0;
But I'm not sure if it supports that many arrays.


Re: Multidimensional array error ( 3D ) - DeMoX - 31.07.2013

Quote:
Originally Posted by _Zeus
Посмотреть сообщение
I'm not sure for the last array. It'd be:
pawn Код:
TD[0/*playerid*/][POS][0][0] = 1.0;
But I'm not sure if it supports that many arrays.
I don't think that's gonna work, try to focus on the arrays


Re: Multidimensional array error ( 3D ) - Konstantinos - 31.07.2013

Quote:
Originally Posted by DeMoX
Посмотреть сообщение
But why there's 'playerid' ?
It was a comment that the first 0 is supposed to be the playerid in other callbacks!


Re: Multidimensional array error ( 3D ) - saamp - 31.07.2013

Quote:
Originally Posted by _Zeus
Посмотреть сообщение
I'm not sure for the last array. It'd be:
pawn Код:
TD[0/*playerid*/][POS][0][0] = 1.0;
But I'm not sure if it supports that many arrays.
Still not working


Re: Multidimensional array error ( 3D ) - Konstantinos - 31.07.2013

Quote:
Originally Posted by saamp
Посмотреть сообщение
Still not working
Quote:
Originally Posted by _Zeus
Посмотреть сообщение
But I'm not sure if it supports that many arrays.
It's not possible then.


Re: Multidimensional array error ( 3D ) - Hanger - 31.07.2013

It is not allowed in PAWN, use:
pawn Код:
enum {
PosX,
PosY,
Posz
};



Re: Multidimensional array error ( 3D ) - Konstantinos - 31.07.2013

Quote:
Originally Posted by Hanger
Посмотреть сообщение
It is not allowed in PAWN, use:
pawn Код:
enum {
PosX,
PosY,
Posz
};
That's not the problem. The last array is wrong only.

pawn Код:
enum mE
{
    Float:POS[3],
    Int
}
new TD[MAX_PLAYERS][mE];

// OnGameModeInit
TD[0][POS][0] = 1.0;
TD[0][POS][1] = 1.0;
TD[0][POS][2] = 1.0;
That's correct.