SA-MP Forums Archive
error 033: array must be indexed (Need Uregent Help) - 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: error 033: array must be indexed (Need Uregent Help) (/showthread.php?tid=317859)



error 033: array must be indexed (Need Uregent Help) - Danyal - 12.02.2012

ERRORS
PHP код:
C:\Users\GamerZ\Desktop\123\a.pwn(113) : error 033: array must be indexed (variable "Open")
C:\Users\GamerZ\Desktop\123\a.pwn(122) : error 033: array must be indexed (variable "Open"
CODE
pawn Код:
if(Open == false) //========Line 113
                {
                    MoveObject(Gate[0], 2008.60, 1252.18, 4.30, 5);
                    Open = true;
                    return 1;
                }
                else
                {
                     MoveObject(Gate[0], 2008.60, 1252.18, 9.07, 5);co-ordinates.
                     Open = false; //=======Line 122
                     return 1;
                }
DEFINED
Код:
#define MAX_GATES 3

new Gate[MAX_GATES],
	bool:Open[MAX_GATES char];
Please Help


Re: error 033: array must be indexed (Need Uregent Help) - Madd Kat - 12.02.2012

well Open is an array

pawn Код:
if(Open[0] == false) //========Line 113
                {
                    MoveObject(Gate[0], 2008.60, 1252.18, 4.30, 5);
                    Open[0] = true;
                    return 1;
                }
                else
                {
                     MoveObject(Gate[0], 2008.60, 1252.18, 9.07, 5);co-ordinates.
                     Open[0] = false; //=======Line 122
                     return 1;
                }
this will check for Gate 0 only

either loop threw MAX_GATES and use the loop var or do it with else if

also i think this
pawn Код:
bool:Open[MAX_GATES char];
should be
pawn Код:
bool:Open[MAX_GATES];



Re: error 033: array must be indexed (Need Uregent Help) - Danyal - 12.02.2012

/facepalm i didnt think about that thank you so much for help
+REP