Weird error:error 020: invalid symbol name ""
#1

pawn Код:
#define POS_SQUARE_CENTER_X 0.0
#define POS_SQUARE_CENTER_Y 0.0
#define POS_SQUARE_CENTER_Z 100.0

#define OFFSET_Y -4.0
#define OFFSET_Z 4.0
#define OFFSET_X -5.0

new const Float:PosArray_Squares[4][4][3] =
{
    {
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y, POS_SQUARE_CENTER_Z },
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y, POS_SQUARE_CENTER_Z + OFFSET_Z },
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y, POS_SQUARE_CENTER_Z + OFFSET_Z * 2.0 }, // error 020: invalid symbol name ""
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y, POS_SQUARE_CENTER_Z + OFFSET_Z * 3.0 }
    },
    {
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y, POS_SQUARE_CENTER_Z },
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y, POS_SQUARE_CENTER_Z + OFFSET_Z },
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y, POS_SQUARE_CENTER_Z + OFFSET_Z * 2.0 },
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y, POS_SQUARE_CENTER_Z + OFFSET_Z * 3.0 }
    },
    {
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y * 2.0, POS_SQUARE_CENTER_Z },
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y * 2.0, POS_SQUARE_CENTER_Z + OFFSET_Z },
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y * 2.0, POS_SQUARE_CENTER_Z + OFFSET_Z * 2.0 },
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y * 2.0, POS_SQUARE_CENTER_Z + OFFSET_Z * 3.0 }
    },
    {
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y * 3.0, POS_SQUARE_CENTER_Z },
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y * 3.0, POS_SQUARE_CENTER_Z + OFFSET_Z },
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y * 3.0, POS_SQUARE_CENTER_Z + OFFSET_Z * 2.0 },
        { POS_SQUARE_CENTER_X, POS_SQUARE_CENTER_Y + OFFSET_Y * 3.0, POS_SQUARE_CENTER_Z + OFFSET_Z * 3.0 }
    }
}; // error 010: invalid function or declarations
I do not understand why those get two Error:
error 020: invalid symbol name ""
error 010: invalid function or declaration
PS: Those code work fine in visual studio 2013 c++, I think it was the pawn compiler bug.
Reply
#2

Why you giving two times {} in
pawn Код:
new const Float:PosArray_Squares[4][4][3] =
?
Reply
#3

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
Why you giving two times {} in
pawn Код:
new const Float:PosArray_Squares[4][4][3] =
?
Because PosArray_Squares[4][4][3] is 3D array, the first 4 x 4 use to store the squares' x and y coords index(use two times {}), the[3]use to store coords in sa(X,Y,Z)
Reply
#4

You can't use brackets like that in arrays, and the errors are caused because of the "+ OFFSET_x" lines.

Don't precalculate the coordinates, retrieve them, calculate them, and then store them.
Reply
#5

Quote:
Originally Posted by Mionee
Посмотреть сообщение
You can't use brackets like that in arrays, and the errors are caused because of the "+ OFFSET_x" lines.

Don't precalculate the coordinates, retrieve them, calculate them, and then store them.
thx,I manually calculate coords, the problem solved!
BTW, the brackets I used is right in this array.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)