SA-MP Forums Archive
Weird error:error 020: invalid symbol name "" - 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: Weird error:error 020: invalid symbol name "" (/showthread.php?tid=536021)



[Solved]:error 020: invalid symbol name "" - Skpler - 07.09.2014

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.


Re: Weird error:error 020: invalid symbol name "" - IceBilizard - 07.09.2014

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


Re: Weird error:error 020: invalid symbol name "" - Skpler - 07.09.2014

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)


Re: Weird error:error 020: invalid symbol name "" - Dignity - 07.09.2014

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.


Re: Weird error:error 020: invalid symbol name "" - Skpler - 07.09.2014

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.