SA-MP Forums Archive
error 001: expected token: "}", but found "[" - 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 001: expected token: "}", but found "[" (/showthread.php?tid=335876)



error 001: expected token: "}", but found "[" - Unknown1234 - 20.04.2012

no idea. help me.
PHP код:
enum abcd
{
    
Float:a,
    
b,
    
c[33],
    
d,
    
e,
    
f,
    
g,
    
h[5][20], // error here
    
i[5]
// i tried with ';' too . not working
new j[abcd]; 
error 001: expected token: "}", but found "["


Re: error 001: expected token: "}", but found "[" - Unknown1234 - 20.04.2012

bumppppppppppppppppppppppppp(((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((


Re : error 001: expected token: "}", but found "[" - Tomer!.$ - 20.04.2012

PHP код:
enum abcd 

    
Float:a
    
b
    
c[33], 
    
d
    
e
    
f
    
g
    
h[5][20],
    
i[5];
}
new 
j[abcd]; 



Re: error 001: expected token: "}", but found "[" - Faisal_khan - 20.04.2012

Edit : too late!


Re: error 001: expected token: "}", but found "[" - FalconX - 20.04.2012

Quote:
Originally Posted by Unknown1234
Посмотреть сообщение
bumppppppppppppppppppppppppp(((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((
pawn Код:
//use [MAX_PLAYERS] in it..
like this:-

pawn Код:
new j[MAX_PLAYERS][adcd];
or just visit the following link for knowing what enumeration means.

https://sampwiki.blast.hk/wiki/Keywords:Initialisers

-FalconX


Re: error 001: expected token: "}", but found "[" - Unknown1234 - 20.04.2012

Quote:
Originally Posted by Tomer!.$
Посмотреть сообщение
PHP код:
enum abcd 

    
Float:a
    
b
    
c[33], 
    
d
    
e
    
f
    
g
    
h[5][20],
    
i[5];
}
new 
j[abcd]; 
not working, same error

Quote:
Originally Posted by FalconX
Посмотреть сообщение
pawn Код:
//use [MAX_PLAYERS] in it..
like this:-

pawn Код:
new j[MAX_PLAYERS][adcd];
or just visit the following link for knowing what enumeration means.

https://sampwiki.blast.hk/wiki/Keywords:Initialisers

-FalconX
no bro. i dont want to use MAX_PLAYERS in that case. i must made some mistake.. i dont want to increase the variable size by adding "MAX_PLAYERS" which is not used any way for that variable "j".
My English poor. sorry. hope someone can help me


Re: error 001: expected token: "}", but found "[" - Unknown1234 - 20.04.2012

is 'enum' datatype must have "MAX_PLAYERS" array


Re: error 001: expected token: "}", but found "[" - [Diablo] - 20.04.2012

i think you can't have 2d arrays in enum, someone correct me if i'm wrong.

but this should compile.

pawn Код:
enum FirstEnum
{
    string_1[5],
    string_2[20]
}

enum abcd  
{  
    Float:a,  
    b,  
    c[33],  
    d,  
    e,  
    f,  
    g,  
    h[FirstEnum],
    i[5]
}
new j[abcd];
not tested.


Re: error 001: expected token: "}", but found "[" - FalconX - 20.04.2012

Quote:
Originally Posted by Unknown1234
Посмотреть сообщение
is 'enum' datatype must have "MAX_PLAYERS" array
pawn Код:
new variable; // this one is global
new variable[MAX_PLAYERS]; // this one is not global but for specific players o.o
As far as I know, we have to use MAX_PLAYERS in an enum as in the wiki it only tells us with MAX_PLAYERS.


Re: error 001: expected token: "}", but found "[" - Twisted_Insane - 20.04.2012

Try this;

pawn Код:
new j[abcd][MAX_PLAYERS];



Re: error 001: expected token: "}", but found "[" - Unknown1234 - 20.04.2012

Quote:
Originally Posted by [Diablo]
Посмотреть сообщение
i think you can't have 2d arrays in enum, someone correct me if i'm wrong.

but this should compile.

pawn Код:
enum FirstEnum
{
    string_1[5],
    string_2[20]
}

enum abcd  
{  
    Float:a,  
    b,  
    c[33],  
    d,  
    e,  
    f,  
    g,  
    h[FirstEnum],
    i[5]
}
new j[abcd];
not tested.
haha only you undertood my question. thanks bro
for others, don`t just say same thing which others said, as i mentioned, u don`t always want to use "MAX_PLAYERS"


Re: error 001: expected token: "}", but found "[" - [Diablo] - 20.04.2012

you are welcome. there is an underscore '_' after each "string" in the first enum, i'm not sure why it doesn't show.


Re: error 001: expected token: "}", but found "[" - ReneG - 20.04.2012

pawn Код:
h[5][20],
pawn Код:
j[playerid][h][5][20] // Too big.
You cannot have 2D arrays in enumerators if you are using the MAX_PLAYERS with it as well. The MAX_PLAYER array is one, the enum itself is one, and adding another 2 arrays just won't work. Create it separately if you actually require that size of an array.