error 001: expected token: "}", but found "["
#1

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 "["
Reply
#2

bumppppppppppppppppppppppppp(((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((
Reply
#3

PHP код:
enum abcd 

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

Edit : too late!
Reply
#5

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
Reply
#6

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
Reply
#7

is 'enum' datatype must have "MAX_PLAYERS" array
Reply
#8

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.
Reply
#9

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.
Reply
#10

Try this;

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

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"
Reply
#12

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)